用于将用户添加到组的REST API - 获得401未经授权的错误 [英] REST API to add user to a group - getting 401 unauthorized error
问题描述
POST网址:
https://dev.XXX.com/sites/ABC/_api/web/sitegroups (7)/ users
https://dev.XXX.com/sites/ABC/_api/web/sitegroups(7)/users
包含帖子正文:
{'__ metadata':{'type':'SP.User'},'LoginName ':'我:0#.w | asiapac \\ xxx'}
{'__metadata': { 'type': 'SP.User' }, 'LoginName':'i:0#.w|asiapac\\xxx'}
电话会议成功,我回201我添加自己的帐户(xxx),但如果我尝试通过将xxx更改为yyy来添加其他ID,则会返回
the call is success and I get 201 back if I add myself account (xxx), however if I try to add some other ID by changing xxx to yyy, it returns
{
  ; "错误":{
  " code":" -2147024891,System.UnauthorizedAccessException",
  "message":{
    "lang":"en-US","
    "value":"拒绝访问"。您无权执行此操作或访问此资源。"
  }¥b $ b } b $ b}
{
"error": {
"code": "-2147024891, System.UnauthorizedAccessException",
"message": {
"lang": "en-US",
"value": "Access denied. You do not have permission to perform this action or access this resource."
}
}
}
但奇怪的是,用户实际上是在我成功添加的时候从浏览器中查看群组成员。我很困惑。
but the weird thing is, the user is actually was added successfully in the group when I look at the group members from the browser. I am confused.
我是网站所有者,网站所有者。
I am the group owner, site owner.
推荐答案
也许是格式您的REST API调用不正确,您可以发布您的代码吗?
Maybe the format of your REST API call is not properly correct, can you post your code ?
亲切的问候,
这篇关于用于将用户添加到组的REST API - 获得401未经授权的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!