Forum Discussion
Restore Teams site owner group (object)
- Aug 16, 2022
DanielK00 I was able to add M365 group to SharePoint group programmatically using flow:
Where 6 in first HTTP request action is SharePoint ID of M365 group from User Information List:
Uri: _api/web/getuserbyid(6)
and 3 in second HTTP request action is SharePoint group ID:
Uri: _api/web/sitegroups/GetById(3)/users
Expression for LoginName in Body of second HTTP request action:
body('Send_an_HTTP_request_to_SharePoint')['d']['LoginName']
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
DanielK00 Usually when you create a team site connected with M365 group, M365 group owners object is added to SharePoint site owners group but it is hidden.
Follow steps given in this thread to make it visible in SharePoint site owners group: Office 365 Group Owner not showing in SharePoint group
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
and thanks for your reply. I followed the steps provided in your link but unfortunately the owner object did not appear. I also tested this approach on another site where the owner object appeared as expected.
Do you have another idea?
Thank you!
- ganeshsanapAug 16, 2022MVP
DanielK00 Can you go to User Information List using below URL & check if owners group name is shown in the list?
<siteUrl>/_layouts/15/people.aspx?MembershipGroupId=0
If it is available in the list, you can click on the group name and get the SharePoint ID for it from URL (userdisp.aspx?ID=##). Then try adding it to SharePoint owners programmatically.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- DanielK00Aug 16, 2022Copper Contributor
Hi @ganeshsanap,
So after doing above mentioned steps also for the list view on people.aspx, I was abled to find the owner object:For some reason it's checkbox is somehow greyed out and also I can't add it to the site owner group with the ID listed in the account property of this object:
Compared to the member object the account property entry is extended by the _o at the end which indicates the owners but when I try to add it to the site owner group, SharePoint only recognizes the members object (although the ID with the _o extension is used):
Is there another way to add it?
Thank you!
- ganeshsanapAug 16, 2022MVP
DanielK00 I was able to add M365 group to SharePoint group programmatically using flow:
Where 6 in first HTTP request action is SharePoint ID of M365 group from User Information List:
Uri: _api/web/getuserbyid(6)
and 3 in second HTTP request action is SharePoint group ID:
Uri: _api/web/sitegroups/GetById(3)/users
Expression for LoginName in Body of second HTTP request action:
body('Send_an_HTTP_request_to_SharePoint')['d']['LoginName']
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.