4

I have added users to a Office 365 group but I can't see which users are in which group using the Sharepoint API. When I query currentuser?$expand=Groups it's empty but when I ask the roleassignments on a object/list I get my defined groups as Security Groups.

Example for the group Developers:

<entry>
      <id>https://promissiebv.sharepoint.com/_api/Web/RoleAssignments/GetByPrincipalId(15)</id>
      <category term="SP.RoleAssignment" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
      <link rel="edit" href="Web/RoleAssignments/GetByPrincipalId(15)" />
      <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Member" type="application/atom+xml;type=entry" title="Member" href="Web/RoleAssignments/GetByPrincipalId(15)/Member">
         <m:inline>
            <entry>
               <id>https://promissiebv.sharepoint.com/_api/Web/RoleAssignments/GetByPrincipalId(15)/Member</id>
               <category term="SP.User" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
               <link rel="edit" href="Web/RoleAssignments/GetByPrincipalId(15)/Member" />
               <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Groups" type="application/atom+xml;type=feed" title="Groups" href="Web/RoleAssignments/GetByPrincipalId(15)/Member/Groups" />
               <title />
               <updated>2016-06-24T10:08:27Z</updated>
               <author>
                  <name />
               </author>
               <content type="application/xml">
                  <m:properties>
                     <d:Id m:type="Edm.Int32">15</d:Id>
                     <d:IsHiddenInUI m:type="Edm.Boolean">false</d:IsHiddenInUI>
                     <d:LoginName>c:0o.c|federateddirectoryclaimprovider|907f7cf0-03e4-444f-b6fd-481a6d76e428</d:LoginName>
                     <d:Title>Developers</d:Title>
                     <d:PrincipalType m:type="Edm.Int32">4</d:PrincipalType>
                     <d:Email>[email protected]</d:Email>
                     <d:IsShareByEmailGuestUser m:type="Edm.Boolean">false</d:IsShareByEmailGuestUser>
                     <d:IsSiteAdmin m:type="Edm.Boolean">false</d:IsSiteAdmin>
                     <d:UserId m:null="true" />
                  </m:properties>
               </content>
            </entry>

How to know which Sharepoint user has access to which Security Group?

Thanks

1 Answer 1

1

You can use RoleAssignments to get all users in all groups. Your post inspired me to figure it out.

../api/web/RoleAssignments/Groups?$expand=Users

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.