使用Microsoft Graph API将用户添加到MS团队的团队中后,无法在SharePoint中找到用户
我们使用MS Graph API向团队添加了一个用户
POST https://graph.microsoft.com/v1.0/teams/<team-id>/members
Content-type: application/json
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["member"],
"[email protected]": "https://graph.microsoft.com/v1.0/users('<user-id>')"
}
,然后我们想将此用户添加到连接到团队的SharePoint中的站点组。我们想使用这些站点组来控制上传文件的访问。 不幸的是,MS Graph API无法支持此操作。因此,我们必须使用SharePoint REST API。 首先,我们必须在SharePoint中找到用户。
https://<my-domain>.sharepoint.com/sites/<site-id>/_api/Web/SiteUsers?$filter=Email eq '<user-email>'
但是此呼叫返回一个空列表。
我们可以使用SharePoint Admin工具手动添加用户:https:// my-domain&gt; .sharepoint.com/sites/sites/site-d; site-id; site-id&gt;/_layouts/15/people.aspx?asspx?membormegroupd =&lt; sitegroup-id&gt;
SharePoint可以看到这个新用户,但是REST API不能。
一天后,用户出现在网站列表中:
https://<my-domain>.sharepoint.com/sites/<site-id>/_api/web/SiteUsers
是否有更快的方法将用户添加到团队并将此用户添加到SharePoint SiteGroup中?
We added a user to a team using MS Graph API
POST https://graph.microsoft.com/v1.0/teams/<team-id>/members
Content-type: application/json
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["member"],
"[email protected]": "https://graph.microsoft.com/v1.0/users('<user-id>')"
}
Then we wanted to add this user to a SiteGroup in SharePoint connected to the team. We want to use these SiteGroups to control access of uploaded files.
Unfortunately MS Graph API cannot support this operation. Thus we have to use SharePoint REST API.
First of all we have to find the user in SharePoint.
https://<my-domain>.sharepoint.com/sites/<site-id>/_api/Web/SiteUsers?$filter=Email eq '<user-email>'
But this call returns an empty list.
We can add the user manually using SharePoint admin tool: https://<my-domain>.sharepoint.com/sites/<site-id>/_layouts/15/people.aspx?MembershipGroupId=<SiteGroup-id>
The Sharepoint can see this new user but the REST API cannot.
One day later the user appeared in the list of SiteUsers:
https://<my-domain>.sharepoint.com/sites/<site-id>/_api/web/SiteUsers
Is there a faster way to add user to a team and also add this user to a SharePoint SiteGroup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论