使用图 API 创建文档集 - 配置
Create a documentSet using graph API - configuration
我使用 Graph API 实现了几次创建文档集的调用。
我遵循了此处发布的关于在 SharePoint 中创建 DocumentSet 的可能性的答案:Is it possible to create a project documentset using graph API?
为此,我遵循了这些步骤:
1.获取库 driveId :
`GET https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}?$expand=drive`
2。创建文件夹:
POST https://graph.microsoft.com/v1.0/drives/${driveId}/root/children
我必须通过 object:
{
"name": ${nameOfTheFolder},
"folder": {},
}
3。获取 Sharepoint itemId:
4.更新文档库:
`PATCH https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/items/${sharepointIds.listItemId}`
并传递 body:
{
"contentType": {
"id": "content-type-id-of-the-document-set"
},
"fields": {
//whatever fields you want to set
}
}
我对文件夹创建和更新有疑问:
文件夹 object 中的预期内容是什么?
{
"name": ${nameOfTheFolder},
"folder": {},
}
关于路径步骤:
{
"contentType": {
"id": "content-type-id-of-the-document-set"
},
"fields": {
//whatever fields you want to set
}
}
我有几个问题:
- 让我们假设我有一个名为 invoices 的文档类型。文档类型 ID 应使用哪个 ID?
- 最后我该如何传递字段?假设我想传递 3 个字段:invoiceId、claimId、clientId。
图表 API 很棒,但更多信息会有所帮助。谢谢!
我对文件夹创建和更新有疑问:文件夹对象中需要什么?
文件夹对象(作为 {} 发送)用于告诉图形 API 您正在创建文件夹而不是文件。这是一个property of the drive item
假设我有一个称为发票的文档类型。文档类型 ID 应使用哪个 ID?
这是您正在修补的 ID contentType subfield of the list item
ally 我如何传递字段?假设我想传递 3 个字段:invoiceId、claimId、clientId。
您只需将它们与相应的值一起传递,如下所示。参见 Update listItem
{
"invoiceId": "value",
"claimId": "value"
...
}
我没有正确表达的一点是知道这里期望的 id :
{
"contentType": {
"id": "content-type-id-of-the-document-set"
},
"fields": {
//whatever fields you want to set
}
}
我通过调用这种 URL 检索了我网站的不同内容类型,并检查该内容类型是否存在。
https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/contentTypes
从结果中我在值对象中检索了 id。
ID 看起来像这样:
0x0120D5200082903AB771604546844DB2AC483D905B00E58445A7D..........
在现代 SharePoint 中,您还可以通过浏览到 SharePoint 网站 > 网站设置 > 网站内容类型 > <ContentTypeName>
> 内容类型 ID 从 UI 获取内容类型 ID。
Content Type ID
不确定这是否比通过图表更容易,但这至少是另一种选择。
我使用 Graph API 实现了几次创建文档集的调用。 我遵循了此处发布的关于在 SharePoint 中创建 DocumentSet 的可能性的答案:Is it possible to create a project documentset using graph API?
为此,我遵循了这些步骤:
1.获取库 driveId :
`GET https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}?$expand=drive`
2。创建文件夹:
POST https://graph.microsoft.com/v1.0/drives/${driveId}/root/children
我必须通过 object:
{
"name": ${nameOfTheFolder},
"folder": {},
}
3。获取 Sharepoint itemId:
4.更新文档库:
`PATCH https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/items/${sharepointIds.listItemId}`
并传递 body:
{
"contentType": {
"id": "content-type-id-of-the-document-set"
},
"fields": {
//whatever fields you want to set
}
}
我对文件夹创建和更新有疑问: 文件夹 object 中的预期内容是什么?
{
"name": ${nameOfTheFolder},
"folder": {},
}
关于路径步骤:
{
"contentType": {
"id": "content-type-id-of-the-document-set"
},
"fields": {
//whatever fields you want to set
}
}
我有几个问题:
- 让我们假设我有一个名为 invoices 的文档类型。文档类型 ID 应使用哪个 ID?
- 最后我该如何传递字段?假设我想传递 3 个字段:invoiceId、claimId、clientId。
图表 API 很棒,但更多信息会有所帮助。谢谢!
我对文件夹创建和更新有疑问:文件夹对象中需要什么?
文件夹对象(作为 {} 发送)用于告诉图形 API 您正在创建文件夹而不是文件。这是一个property of the drive item
假设我有一个称为发票的文档类型。文档类型 ID 应使用哪个 ID? 这是您正在修补的 ID contentType subfield of the list item
ally 我如何传递字段?假设我想传递 3 个字段:invoiceId、claimId、clientId。
您只需将它们与相应的值一起传递,如下所示。参见 Update listItem
{
"invoiceId": "value",
"claimId": "value"
...
}
我没有正确表达的一点是知道这里期望的 id :
{
"contentType": {
"id": "content-type-id-of-the-document-set"
},
"fields": {
//whatever fields you want to set
}
}
我通过调用这种 URL 检索了我网站的不同内容类型,并检查该内容类型是否存在。
https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/contentTypes
从结果中我在值对象中检索了 id。 ID 看起来像这样:
0x0120D5200082903AB771604546844DB2AC483D905B00E58445A7D..........
在现代 SharePoint 中,您还可以通过浏览到 SharePoint 网站 > 网站设置 > 网站内容类型 > <ContentTypeName>
> 内容类型 ID 从 UI 获取内容类型 ID。
Content Type ID
不确定这是否比通过图表更容易,但这至少是另一种选择。