繁体   English   中英

使用 HTTP 请求将用户插入 SharePoint 组

[英]Insert user into SharePoint group with HTTP request

我正在使用 HTTP 请求连接器将用户插入 SharePoint。 在所有透明度中,这是使用 MS Flow/Power Automate。

我有 URL 从 SharePoint 组读取用户。

https:// MYCOMPANY .sharepoint.com/sites/planning-test/_api/web/SiteGroups/GetById(37)/Users

我的header构造为:

{
  "accept": "application/json;odata=verbose",
  "content-type": "application/json;odata=verbose"
}

请求正文构造为:

{
'_metadata':{'type':'SP.User'},
‘LoginName’:’i:0#.f|membership|dducolon@starbucks.com’
}

这给了我一个状态 output 代码“ 400

我得到一个详细的错误,上面写着:

JSON 无效。 属性名称“”无效。 属性名称不能为空。 clientRequestId:f6aec2b4-822d-4a6e-90e9-f4aa0162d182 serviceRequestId:b499689f-e0a8-0000-6122-5f43f6ec0327

有谁知道为什么我会收到一个错误,说我的属性是空白的?

MS Flow 中“向 SharePoint 发送 HTTP 请求”的图像

试试这个身体:

{       
              '__metadata': {
                // Type that you are modifying.
                'type': 'SP.User'
            },
                'LoginName': 'i:0#.f|membership|dducolon@starbucks.com'
            }

你的引用是错误的,元数据之前应该有两个 _ 。

看起来在正文的第二行,单引号是反引号,而不是预期的 ' 引号。 这来自 PowerAutomate UI 中的复制粘贴。

就我而言,由于额外的括号,我得到了完全相同的错误:

{
    "__metadata": {
        "type": "SP.Data.TestListListItem"
    },
    
   {
        "Title": "dddd",
        "AnotherColumn": "xxxx"
   }
}

请注意,不应有括号括住列名及其值。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM