是否有 API 端点可以找到私人频道的驱动器
Is there an API endpoint to find the drive of a private channel
我们正在考虑在我们的组织中创建团队,并在文件选项卡中使用预填充的文件夹结构。
对于普通频道,这很容易,因为文件位于组的根 SharePoint 中以频道命名的目录中。所以我们可以对 POST 请求
https://graph.microsoft.com/beta/groups/{group-id}/drive/items/root/children
端点并为频道创建文件夹。来自端点的答案包含新文件夹的 ID,我们可以继续使用此 ID 为频道创建文件夹结构。
然而,私人频道位于 SharePoint 组之外。
问题是,是否有可能使用创建私人频道的 https://graph.microsoft.com/beta/teams/{id}/channels
POST 调用提供的信息获取驱动器的根目录?
有一个名为 filesFolder
的频道资源的 documented 导航 属性。来自 Graph v1.0 端点:
<EntityType Name="channel" BaseType="microsoft.graph.entity">
<Property Name="displayName" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
<Property Name="isFavoriteByDefault" Type="Edm.Boolean"/>
<Property Name="email" Type="Edm.String"/>
<Property Name="webUrl" Type="Edm.String"/>
<Property Name="membershipType" Type="microsoft.graph.channelMembershipType"/>
<NavigationProperty Name="messages" Type="Collection(microsoft.graph.chatMessage)" ContainsTarget="true"/>
<NavigationProperty Name="chatThreads" Type="Collection(microsoft.graph.chatThread)" ContainsTarget="true"/>
<NavigationProperty Name="tabs" Type="Collection(microsoft.graph.teamsTab)" ContainsTarget="true"/>
<NavigationProperty Name="members" Type="Collection(microsoft.graph.conversationMember)" ContainsTarget="true"/>
<NavigationProperty Name="filesFolder" Type="microsoft.graph.driveItem" ContainsTarget="true"/>
</EntityType>
您可以使用此模板调用它:
/v1.0/teams/{teamId}/channels/{channelId}/filesFolder
这将 return 与私人频道关联的驱动器:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('{teamsId}')/channels('{channelId}')/filesFolder/$entity",
"id": "{id}",
"createdDateTime": "0001-01-01T00:00:00Z",
"lastModifiedDateTime": "2019-11-13T16:49:13Z",
"name": "Private",
"webUrl": "https://{tenant}.sharepoint.com/sites/{team}-Private/Shared%20Documents/{channel}",
"size": 0,
"parentReference": {
"driveId": "{driveId}",
"driveType": "documentLibrary"
},
"fileSystemInfo": {
"createdDateTime": "2019-11-13T16:49:13Z",
"lastModifiedDateTime": "2019-11-13T16:49:13Z"
},
"folder": {
"childCount": 0
}
}
目前私人频道的 /filesFolder returns BadGateway
您遇到的问题是,在您实际访问团队应用程序中的频道之前,不会生成私人频道的驱动器和站点。那一次访问将触发驱动器和站点的创建。我自己被困在这里,因为我无法触发私人频道来创建 SharePoint 网站和驱动器,直到我真正打开团队应用程序并访问该频道。
我们正在考虑在我们的组织中创建团队,并在文件选项卡中使用预填充的文件夹结构。
对于普通频道,这很容易,因为文件位于组的根 SharePoint 中以频道命名的目录中。所以我们可以对 POST 请求
https://graph.microsoft.com/beta/groups/{group-id}/drive/items/root/children
端点并为频道创建文件夹。来自端点的答案包含新文件夹的 ID,我们可以继续使用此 ID 为频道创建文件夹结构。
然而,私人频道位于 SharePoint 组之外。
问题是,是否有可能使用创建私人频道的 https://graph.microsoft.com/beta/teams/{id}/channels
POST 调用提供的信息获取驱动器的根目录?
有一个名为 filesFolder
的频道资源的 documented 导航 属性。来自 Graph v1.0 端点:
<EntityType Name="channel" BaseType="microsoft.graph.entity">
<Property Name="displayName" Type="Edm.String"/>
<Property Name="description" Type="Edm.String"/>
<Property Name="isFavoriteByDefault" Type="Edm.Boolean"/>
<Property Name="email" Type="Edm.String"/>
<Property Name="webUrl" Type="Edm.String"/>
<Property Name="membershipType" Type="microsoft.graph.channelMembershipType"/>
<NavigationProperty Name="messages" Type="Collection(microsoft.graph.chatMessage)" ContainsTarget="true"/>
<NavigationProperty Name="chatThreads" Type="Collection(microsoft.graph.chatThread)" ContainsTarget="true"/>
<NavigationProperty Name="tabs" Type="Collection(microsoft.graph.teamsTab)" ContainsTarget="true"/>
<NavigationProperty Name="members" Type="Collection(microsoft.graph.conversationMember)" ContainsTarget="true"/>
<NavigationProperty Name="filesFolder" Type="microsoft.graph.driveItem" ContainsTarget="true"/>
</EntityType>
您可以使用此模板调用它:
/v1.0/teams/{teamId}/channels/{channelId}/filesFolder
这将 return 与私人频道关联的驱动器:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('{teamsId}')/channels('{channelId}')/filesFolder/$entity",
"id": "{id}",
"createdDateTime": "0001-01-01T00:00:00Z",
"lastModifiedDateTime": "2019-11-13T16:49:13Z",
"name": "Private",
"webUrl": "https://{tenant}.sharepoint.com/sites/{team}-Private/Shared%20Documents/{channel}",
"size": 0,
"parentReference": {
"driveId": "{driveId}",
"driveType": "documentLibrary"
},
"fileSystemInfo": {
"createdDateTime": "2019-11-13T16:49:13Z",
"lastModifiedDateTime": "2019-11-13T16:49:13Z"
},
"folder": {
"childCount": 0
}
}
目前私人频道的 /filesFolder returns BadGateway
您遇到的问题是,在您实际访问团队应用程序中的频道之前,不会生成私人频道的驱动器和站点。那一次访问将触发驱动器和站点的创建。我自己被困在这里,因为我无法触发私人频道来创建 SharePoint 网站和驱动器,直到我真正打开团队应用程序并访问该频道。