web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow to deposit files ...
Power Automate
Unanswered

Flow to deposit files in other user's onedrive ?

(0) ShareShare
ReportReport
Posted on by 302

Hi,

 

I have a requirement to generate files and deposit them in the onedrive of the user for whom the file was generated. This has to be a centralized flow (comparable to a reporting service) that does it for all users at once, in other words I'm not looking for a mechanism where the user initiates the flow. Alternatively I could send the file to the user's email address, but then I'm still requiring an interaction from the user which is what I want to avoid. I just want the file to be available in the user's onedrive whenever he needs it, and update the file on regular intervals.

 

The service account running the flow will/should have full access to the OneDrive for the organisation.

 

My first question is: how can I get an URL pointing to the onedrive of a user based on the user name ? Is this possible with a standard connector or do I need to use another method (graph ?)

 

Thanks for any pointers,

Stephane

 

Categories:
  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    @bouillons ,

     

    You can use the Get user profile (V2) action to retrieve OneDrive url.

    The property you are looking for is called My Site.

     

  • bouillons Profile Picture
    302 on at

    Thanks Sundeep, with your help I've made a lot of progress. I'm generating the url of the onedrive of the user.

    Then I'm using an HTTP request to execute an EnsureUser for the new administrator

    Unfortunately, when I subsequently execute an update of the IsSiteAdmin property, the property remains false.

    I am the tenant administrator, so per the documentation this should work

    bouillons_0-1667852274774.png

     

     

  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    Try this

     

    Endpoint Uri: /_api/web/siteUsers/getByLoginName(@u)?@u='userloginName'

    Method: POST

    Body: { '__metadata':{ 'type': 'SP.User' }, 'IsSiteAdmin':'true' }

    Headers:

    • "content-type": "application/json; odata=verbose"

    • "X-HTTP-Method": "MERGE"

  • bouillons Profile Picture
    302 on at

    Thanks, what is the format of the userLoginName ?

  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    Try email first

  • bouillons Profile Picture
    302 on at

    Email doesn't work, and i:0#.f|membership|stephane.bouillon@multipharma.be doesn't work either

  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    I see you already succeeded in getting the user id = 20.

    So, in your previous HTTP action just change the body to:

    { '__metadata':{ 'type': 'SP.User' }, 'IsSiteAdmin':'true' }

  • bouillons Profile Picture
    302 on at

    Now I get the following return:

     

    {
     "status": 400,
     "message": "The property '__metadata' does not exist on type 'SP.User'. Make sure to only use property names that are defined by the type.\r\nclientRequestId: 0cd12958-2d00-4d62-aa7b-923dd437c0c3\r\nserviceRequestId: 386276a0-8045-5000-7249-e0bb8a976ca4",
     "source": "https://multipharmagroup-my.sharepoint.com/personal/multipharma_0004_multipharma_be/_api/web/getuserbyid(20)",
     "errors": [
     "-1",
     "Microsoft.SharePoint.Client.InvalidClientQueryException"
     ]
    }

     

    If I only send the { 'IsSiteAdmin':'true' } as I found in another article, my flow simply hangs and never returns.

     

    I'm suspecting this is the correct syntax, but there is an issue with the execution in power automate somehow. What I'm trying to achieve before creating the file, is setting myself as site collection owner. Since I'm the tenant administrator, this should normally work as per the documentation.

    I've tried to make myself site collection administrator manually via the OneDrive tab for the user on the O365 admin portal, and that works without issue, but I have a couple of hundred sites to update, and I'd rather not do it manually.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 430

#2
11manish Profile Picture

11manish 341 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 282

Last 30 days Overall leaderboard