简体   繁体   English

如何在 Microsoft Graph 中转义 Sharepoint 列名称?

[英]How do I escape a Sharepoint column name in Microsoft Graph?

I'm performing the following request to update the value of "ExampleColumn#" for a Sharepoint Online item:我正在执行以下请求以更新 Sharepoint Online 项目的“ExampleColumn#”值:

PATCH https://graph.microsoft.com/v1.0/sites/{site_id}/lists/{list_id}/items/{item_id}补丁https://graph.microsoft.com/v1.0/sites/{site_id}/lists/{list_id}/items/{item_id}

With the following request body:使用以下请求正文:

{
    "fields":{
        "ExampleColumn#": 1
    }
}

Returns a 400 bad request error, with the following message:返回 400 bad request 错误,并带有以下消息:

"message": "A metadata reference property was found in a JSON Light request payload. Metadata reference properties are only supported in responses" "message": "在 JSON Light 请求负载中发现元数据参考属性。元数据参考属性仅在响应中受支持"

As I believe Odata requires the "#" symbol to be escaped, I've tried using percent-encoding which I couldn't get to work.由于我认为 Odata 需要转义“#”符号,因此我尝试使用无法开始工作的百分比编码。

Request Body:请求正文:

{
    "fields":{
        "ExampleColumn%23": 1
    }
}

Response:回复:

"message": "Field 'ExampleColumn%23' is not recognized" "message": "无法识别字段 'ExampleColumn%23'"

What should I be doing differently in my request body?我应该在我的请求正文中做些什么不同的事情?

@Zak, @扎克,

Please make sure the field in the request body is the correct internal name of that column.请确保请求正文中的字段是该列的正确内部名称。 I am able to update a column value in my SPO list via the below request:我可以通过以下请求更新我的 SPO 列表中的列值:

在此处输入图片说明

You can get the field internal name through its setting page:您可以通过其设置页面获取字段内部名称:

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用图形 API 插入 SharePoint 列表中的用户列? - How do I insert into a user column in a SharePoint list using Graph API? 如何使用Microsoft Graph API通过自定义列值查找SharePoint文档 - How to find SharePoint documents by custom column value using Microsoft Graph API 如何通过 Microsoft Graph API 检索.msg(Outlook 项目)contentBytes? - How do I retrieve .msg (Outlook Item) contentBytes via the Microsoft Graph API? 请求所有用户时,如何从 Microsoft Graph API 获取比默认属性更多的属性? - How do I get more than the default attributes from the Microsoft Graph API when requesting all users? 如何在 powershell 字符串中转义“引号”? - How do I escape “Quotes” in a powershell string? Microsoft Graph API 过滤器 SharePoint 按用户创建的列表项 - Microsoft Graph API Filter SharePoint List Items By CreatedBy User 无法通过 Microsoft Graph API 检索 Sharepoint 列表的项目计数 - Unable to retrieve item count for Sharepoint List through Microsoft Graph API Microsoft Graph API - 检查用户是否拥有 SharePoint 许可证 - Microsoft Graph API - Check if user has a SharePoint license 如何使用SharePoint Online的SharePoint REST API访问默认的SharePoint图像库? - How do I access the default SharePoint image library by using the SharePoint REST API for SharePoint Online? 内部列名称引用在Sharepoint中不起作用 - Internal column name reference not working in Sharepoint
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM