简体   繁体   English

使用 Microsoft Graph API 更新与内容类型关联的 SharePoint 字段

[英]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.

相关问题 如何使用microsoft graph api获取sharepoint中的列(字段) - How to get columns(fields) in sharepoint using microsoft graph api 使用 Microsoft Graph API 下载 Sharepoint 文件未显示内容属性 - Downloading Sharepoint File using Microsoft Graph API not showing content attribute 如何使用 sharepoint API 或 Microsoft Graph 从 sharepoint 站点上的文件夹请求文件内容? - How to request file content from a folder on a sharepoint site using sharepoint API or Microsoft Graph? Microsoft Graph API 上 Sharepoint 搜索查询的可用字段 - Available Fields for Sharepoint Search Query on Microsoft Graph API 如何使用 Microsoft Graph API 和 Graph Client 添加 SharePoint 选项卡? - How to add a SharePoint tab using Microsoft Graph API and Graph Client? 如何使用 Microsoft Graph API 更新 SharePoint 列表中人员或组列的值? - How do I update the value of Person or Group columns in SharePoint lists using the Microsoft Graph API? Microsoft Graph API C# - 如何更新 Sharepoint 中的“CreatedBy”或“ModifiedBy”? - Microsoft Graph API C# - How to update "CreatedBy" or "ModifiedBy" in Sharepoint? 使用图 api 访问 Sharepoint 站点内容 - Acessing Sharepoint sites content using graph api Microsoft Graph API - 如何按网站类型过滤 SharePoint 网站? - Microsoft Graph API - How to Filter SharePoint sites by Site Type? Microsoft Graph API SharePoint搜索 - Microsoft Graph API SharePoint search
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM