[英]Update SharePoint fields associated with Content Type using Microsoft Graph API
I have been searching and can't seem to find the answer.我一直在寻找,似乎无法找到答案。 I have a list in SharePoint, which is a Document Library, and I have associated a Content Type with specific fields to that Document Library.
我在 SharePoint 中有一个列表,它是一个文档库,我已将内容类型与特定字段关联到该文档库。
In SharePoint, if I view the properties of a document in the Document Library, I can view and update the values for the fields associated with the Content Type.在 SharePoint 中,如果我查看文档库中文档的属性,我可以查看和更新与内容类型关联的字段的值。 However using the Microsoft Graph API as instructed here for GET and here for UPDATE , I cannot get or update these Content Type related properties for the document, using the following.
但是,按照此处针对 GET和此处针对 UPDATE 的说明使用 Microsoft Graph API,我无法使用以下内容获取或更新文档的这些内容类型相关属性。
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}
or或者
PATCH https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}
I have all the right permissions because I am able to get and update the normal fields on the document.我拥有所有正确的权限,因为我能够获取和更新文档上的普通字段。 I am just unable to do so for fields associated with the Content Type.
对于与内容类型关联的字段,我无法这样做。
Is there a way to do this with Microsoft Graph that I'm not finding?有没有办法用 Microsoft Graph 做到这一点,但我没有找到?
You can set your Content Type fields in the Request Body您可以在请求正文中设置您的内容类型字段
{
"fields": {
"{Field Name}": "{Value}"
}
}
Just ensure you use the Internal Field name of the SP field.只要确保您使用 SP 字段的内部字段名称。 Credit to Brett McKenzie and this post Updating a SharePoint List Item's Content Type in the Microsoft Graph
归功于 Brett McKenzie 和这篇文章更新 Microsoft Graph 中的 SharePoint 列表项的内容类型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.