通过Sharepoint批量发送HTTP请求连接器插入用户

huangapple go评论48阅读模式
英文:

Insert User through Sharepoint batch send HTTP Request Connector

问题

我需要使用SP连接器 - 发送HTTP请求将项目插入SharePoint。
我发送的主体内容是:"User": { "Key": "i:0#.f|membership|@{first(body('Get_by_mail')?['value'])['Email']}" },
尽管它已成功创建,但SharePoint显示该字段没有数值。您知道可能出了什么问题吗?

英文:

I need to insert items into sharepoint by using SP connector - Send HTTP Request
I send body : "User": {
"Key": "i:0#.f|membership|@{first(body('Get_by_mail')?['value'])['Email']}"
},

Despite it having successfully created, the sharepoint shows the field without value. Do you have any idea what could be going on?

答案1

得分: 1

在我这边复制后,我能够使用以下 JSON 在发送 HTTP 请求时使其工作。

{    
    "__metadata": { "type": "SP.Data.<YOUR_LIST_NAME>ListItem" },    
    "Title": "ccc",    
    "UserId": 6
}  

UserId 是在我的 Sharepoint 中表示列的关键字,该列名为 User。请注意,如果在您的 Sharepoint 中列名为 Person,则确保将关键字值设置为 PersonId。

结果:

通过Sharepoint批量发送HTTP请求连接器插入用户

英文:

After reproducing from my end, I could able to make this work using the below JSON in the body while sending the HTTP request.

{    
&quot;__metadata&quot;: { &quot;type&quot;: &quot;SP.Data.&lt;YOUR_LIST_NAME&gt;ListItem&quot; },    
&quot;Title&quot;: &quot;ccc&quot;,    
&quot;UserId&quot;: 6
}  

UserId is the key which represents the column in my Sharepoint which is named as User. Consider if Person is the column in your Sharepoint then make sure you set the key value as PersonId.

通过Sharepoint批量发送HTTP请求连接器插入用户

Results:

通过Sharepoint批量发送HTTP请求连接器插入用户

答案2

得分: 1

如果你看你的JSON:

"User": 
{ 
    "Key": "i:0#.f|membership|@{first(body('Get_by_mail')?['value'])[&#39;Email&#39;]}"
}

你会注意到你只是发送了一个键到一个键值对目标。项目插入是因为提供了一个Key,但它不显示任何内容,因为你没有提供一个将要显示的Value。尝试使用以下JSON代替:

"User": 
{ 
    "Key": "i:0#.f|membership|@{first(body('Get_by_mail')?['value'])['Email']}",
    "Value": "i:0#.f|membership|@{first(body('Get_by_mail')?['value'])['Email']}"
}
英文:

If you look at your JSON:

&quot;User&quot;: 
{ 
    &quot;Key&quot;: &quot;i:0#.f|membership|@{first(body(&#39;Get_by_mail&#39;)?[&#39;value&#39;])[&#39;Email&#39;]}&quot;
}

you'll notice that you're sending just a key to a key/value pair target. The item inserts because a Key is provided, but it doesn't display anything because you did not provide a Value that would be displayed. Try the following JSON instead:

    &quot;User&quot;: 
{ 
    &quot;Key&quot;: &quot;i:0#.f|membership|@{first(body(&#39;Get_by_mail&#39;)?[&#39;value&#39;])[&#39;Email&#39;]}&quot;,
    &quot;Value&quot;: &quot;i:0#.f|membership|@{first(body(&#39;Get_by_mail&#39;)?[&#39;value&#39;])[&#39;Email&#39;]}&quot;
}

huangapple
  • 本文由 发表于 2023年2月13日 22:51:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75437486.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定