Skip to main content
Community site session details

Community site session details

Session Id : OXE5iNPICN4hdGMOR7yI8E
Power Automate - Building Flows
Answered

Get list of owners in all the sites/subsites in a site collection and have it save as a csv

Like (0) ShareShare
ReportReport
Posted on 10 Apr 2023 15:27:02 by

Hello,

 

I have been trying to create a manual flow to populate a csv with the site names and the owners of those sites/subsites in a site collection.

 

It seems to grab the data but it doesn't format as expected. The flow is configured as such;

DWTKBrook_0-1681140379419.png

 

DWTKBrook_1-1681140379422.png

 

It does create the .csv however it's not in a way that can read it. I was expect column A for site name and Column B for site owner. But instead I get the following;

DWTKBrook_2-1681140379617.png

 

How can i format the output so that each itteration is on a new line and it only grabs the site URL and/or name and the owners names?

 

Is this possuble?

 

I appreciate any help you can provide.

 

Thank you,

DWTKBrook

  • Community Power Platform Member Profile Picture
    on 02 May 2023 at 06:44:12
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hello @v-zhoqian-msft ,

     

    l will take a look at that.

     

    Thak you

  • v-zhoqian-msft Profile Picture
    Microsoft Employee on 27 Apr 2023 at 02:15:42
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hi @Anonymous ,

     

    I think the problem is with the website. Even when all site groups were get before, there is no owner in the title column of the output. This is different from what I tested. Perhaps you should extract items that contain "owner" in the OwnerTitle column.

    vzhoqianmsft_0-1682561650557.png

     

     

     

     

  • Community Power Platform Member Profile Picture
    on 26 Apr 2023 at 19:38:49
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    @v-zhoqian-msft   - Just wondering if here was any other thoughts on this. The solution provided did not work. Not sure who marked it as a solution. This would undoubtedly confuse anyone else with this issue and attempt the solution provided.

  • Community Power Platform Member Profile Picture
    on 20 Apr 2023 at 14:39:14
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hello @v-zhoqian-msft , I apologize for the delay, I was away for a week. I tried your suggestion and while it had no errors, it didn't provide me with the owners of the sites, below is the output of the request. 

    DWTKBrook_0-1682001382950.png

    It provided the site title and URL both not the site owners(s).

    Thank you,

  • Verified answer
    v-zhoqian-msft Profile Picture
    Microsoft Employee on 13 Apr 2023 at 09:21:14
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hi @Anonymous ,

     

    You could try the following formula:

    _api/web/webs/?$select=title,ServerRelativeURL&$SiteGroups/?$filter=substringof('Owner',Title)

     

     

    Best Regards,

    Community Support Team _ habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    on 12 Apr 2023 at 13:21:33
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hello @v-zhoqian-msft ,

     

    I looked into your suggestion, and thank you, it looked promising however, no joy. 

    Using the uri;

    _api/web/webs/?$select=title,ServerRelativeURL&$expand=SiteGroups/?$filter=substringof('Owner',Title)

    I receive the following error

    DWTKBrook_0-1681304531446.png

    I don't know what it doesn't like about the uri though.

     

    I also tried adding the filter in the headers as well but that didn't work at all. I tried substituting 'substringof' with 'contains', same error.

     

    It's completely baffling,

    DWTKent

  • v-zhoqian-msft Profile Picture
    Microsoft Employee on 12 Apr 2023 at 07:54:55
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hi @Anonymous ,

     

    You could try adding filter function in uri.

    Maybe this link will be useful:

    SharePoint Online REST APIs (Part V): SharePoint Groups – SharePointCass

     

     

     

    Best Regards,

    Community Support Team _ habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    on 11 Apr 2023 at 12:48:41
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hello @v-zhoqian-msft, thank you for your suggestion I will look into that however, I believe the SiteGroups Column (Image of csv below) is the issue, I make this call in the uri of the send HTTP request,

     

    _api/web/webs/?$select=title,ServerRelativeURL&$expand=SiteGroups/Users

     

     

    CSV

    DWTKBrook_1-1681217639752.png

     

    The other 2 columns are perfect.

     

    I want to just expand the owners groups of each site rather than all groups.

     

    Cheers!

  • v-zhoqian-msft Profile Picture
    Microsoft Employee on 11 Apr 2023 at 07:47:36
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    Hi @Anonymous ,

     

    I cannot see the content of the .csv file in the picture clearly. Maybe you could use the "custom" mode of "Create csv table", which can format each field.

    vzhoqianmsft_0-1681199226402.png

     

     

     

    Best Regards,

    Community Support Team _ habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    on 10 Apr 2023 at 17:26:11
    Re: Get list of owners in all the sites/subsites in a site collection and have it save as a csv

    I actually made a couple changes that make the output more organized but I I'm still pulling all site groups when I just want the owners of each site. I can't seem to find a way to get that and then save it into an excel.

     

    DWTKBrook_0-1681147494908.png

    How can i just get the owners group memberships and then export to csv if possible?

     

    Cheers!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete