I'm looking for a way to publish files to my users. The business case is for instance the publishing of salary slips from a third party application. You would want to place these documents in a secure and foremost personal location: OneDrive seems to be a likely candidate for that.

So I went out to see whether it's possible to somehow push files into the OneDrive folder of a user, but this does not seem to be the case. All of the samples I found directly user the "current user" as an endpoint, never someone else.

What we also do not want of course is to have access to all of the files a user stores in their OneDrive location. This is about pushing files to them, not reading anything that is already in there.

I found these articles, but those do not answer the question; How to upload List Template to user's OneDrive using powershell? Access user's OneDrive data using REST API

The only solution I could think of is that the users creates a folder themselves, shares it with a service account so that we can use that service account to send files to this location. Can be done with the right steps, but heavily depends on the user in this case.

Another possible solution would be to create a library or folder somewhere per user, with permissions for only that specific user and publish the files there. Almost what we want, but preferably everything should be in OneDrive.

So I was wondering whether anyone has ever faced similar requirements and might have thought of some other solution?

1 Answer 1

  1. Have you tried connecting to SharePoint online using "SharePoint Online Administrator" Account? You can then use your scripts to create folder, upload file etc. Obviously, it is a big risk.

  2. You may configure to make one service account as secondary administrator to mysites and use this account to access "OneDrive".

  • An admin account can access all of the personal OneDrives? Ok didn't know that. But indeed I don't know whether I'm comfortable giving a service account full admin permissions.
    – Jasper
    Apr 3, 2017 at 20:02

Your Answer

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

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