cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

Finding the owner of a SharePoint site

Hi everyone,

I've got a Flow that I'm developing for a customer to allow them to use an approval process for News posts on their new SharePoint intranet.  The Flow works fine, filtering to check if a new page is a News Post or a standard page and starting an approval process for News only. 

The approvers are hard coded in and I would like to have it set to query the site for its owners and use the resultant list for the approvers.  Amazingly, the Graph API doesn't doesnt support this.  I have seen posts on the internet where people suggest using the drive property of the site which does expose the owner but in testing it doesnt seem to return a result for every site I've tried it on.

The SharePoint REST API does expose the owner property as documented here

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj246231(v%3doffice.15)

So I've built this test Flow

Site Owner Flow.png

 

Which works, but only returns a single user when I know my site has 2 owners.  Has someone got a better way to find a list of site owners in SharePoint?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @AndyTuke1,

 

Try using below endpoint to get the Site Members from Members group:

_api/Web/SiteGroups/GetByName('SiteName Members')/users

To get the specific property for user, you can add $select query as given below:

_api/Web/SiteGroups/GetByName('SiteName Members')/users?$select=Email,Id

You can get the following user properties using this endpoint:

  1. Email
  2. Groups
  3. Id
  4. IsHiddenInUI
  5. IsSiteAdmin
  6. LoginName
  7. PrincipalType
  8. Title
  9. UserId

You can find everything related to Users, groups, and roles using REST API in the below article(Must visit, this is a very helpful article): Users, groups, and roles using REST API.

 

For example, my site name is "Ice Cream", the uri should be:

Screenshot 2020-10-09 101658.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

Hi @AndyTuke1,

 

Try using below endpoint to get the Site Members from Members group:

_api/Web/SiteGroups/GetByName('SiteName Members')/users

To get the specific property for user, you can add $select query as given below:

_api/Web/SiteGroups/GetByName('SiteName Members')/users?$select=Email,Id

You can get the following user properties using this endpoint:

  1. Email
  2. Groups
  3. Id
  4. IsHiddenInUI
  5. IsSiteAdmin
  6. LoginName
  7. PrincipalType
  8. Title
  9. UserId

You can find everything related to Users, groups, and roles using REST API in the below article(Must visit, this is a very helpful article): Users, groups, and roles using REST API.

 

For example, my site name is "Ice Cream", the uri should be:

Screenshot 2020-10-09 101658.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thats great, works perfectly.

 

One thing, the documentation is lacking a bit and some of the pages for the REST API are marked s "This page is no longer being updated".  Is this because all the functionality is being moved to the GRAPH API, which requires a premium Power Automate licence? 

You used the GetByName but I can't find any document for the API listing what else can be used, the only reference to GetByName is in an example

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (8,342)