如何使用 Graph API for Sharepoint select 带空格的列名

How to select column names with spaces using Graph API for Sharepoint

我有这样的查询 $"https://graph.microsoft.com/v1.0/{_config.SubBaseUrl}/items?expand=fields(select =id,标题,MFG_Name,制造商部件号)"

如何 select 带有空格的列名称,如“制造商零件号”,这样我就不会收到无效路径错误?

将字段名称中的空格替换为_x0020_

https://graph.microsoft.com/v1.0/{_config.SubBaseUrl}/items?expand=fields(select=id,Title,MFG_Name,Manufacturer_x0020_Part_x0020_Number)

另一种选择是使用 expand 而不使用 select 调用查询,并检查带有空格的列的格式。 Sometimes Graph API returns column's name without spaces.

https://graph.microsoft.com/v1.0/{_config.SubBaseUrl}/items?expand=fields

因此 Manufacturer Part Number api 可能 return ManufacturerPartNumber.