How to change ownership of files and folders in Onedrive for Business?

14,458

What you are trying to do will be extremely difficult to implement and maintain. Users have full access to their OneDrive and move or change that structure at any time. Also be aware that new users you create should not have a "Share with Everyone" folder - Microsoft stopped created that folder a few months ago for new users.

If a document is in that folder, or shared with anyone - it's exposed thru Delve and is searchable for those that have access. So you can click on the "Shared with Me" and get access to these document and even refine from there. You can also just arbitrarily search for these document if you know part of the name or content. I would advise against using folders in the fashion you intent - instead their use should be limited to breaking up collection to avoid view limits or attached per-defined metadata to file collections.

That being said to do this locally you would need to sync to each users folder, make the changes and sync back. You can use something like this:

#Get ACL of file before you change it (includes owner)
$objFile = Get-Acl C:\TestFile.txt
#Set file back to original permissions after you alter it
Set-Acl -aclobject $objFile -path C:\TestFile.txt

If that doesn't work you can use the takeown command Single File takeown /f c:\TestFile.txt Entire directory takeown /f c:\Directory /r

That's a pretty clunky way to do it as you have to sync back all the changes. But if you want to do it directly in O365 you need create a custom script that leverage the REST API or find a 3rd party tool (I'm not sure of any that provide this particular functionality, but there are plenty that handle the file migration aspect of it) .

Another alternative - is to deploy a SharePoint Team site or take advantage of O365 Groups. These provide a central location for sharing information. Groups in particular are handy as they create distribution lists for sharing discussions and create a shared library for storing associated content.

Office 365 is a very powerful platform - however to get the most out of it, there is a slight paradigm shift in how you manage objects.

Share:
14,458

Related videos on Youtube

dragz
Author by

dragz

Updated on September 18, 2022

Comments

  • dragz
    dragz over 1 year

    Do anyone know?

    I have finally figured out how to copy file trees but now I want to set the ownership back to the original creator of the files.

    (I'm trying to convince my fellow board members of a small local youth sports club to move all the documents regarding running the club away from scattered number of private laptops into Office365. I find the Shared folders concept in Onedrive for Business hard to comprehend...)

    • Jesus Shelby
      Jesus Shelby over 8 years
      You are setting these locally or trying to set these in the service itself? What problem are you actually trying to solve?
    • dragz
      dragz over 8 years
      Users are creating their documents in their Shared with everyone folder and I'm trying to collect these documents into a common folder structure. Something along these lines UserA has this in her shared folder /dirX/document1 UserB has this in his shared folder /dirY/document2 I would like to collect the information in a common folder structure keeping the original ownership. Something like this /dirY/document2 /dirY/dirX/document1 So that everyone that looks into /dirY will see the subfolder dirX and seeing who has created the documents. Thanks for the response.
    • dragz
      dragz over 8 years
      Augh, the formatting got screwed up. Hope you get my meaning.
    • dragz
      dragz over 8 years
      Also, I had to do the file structure copying locally. I could not figure out how to do it on the web interface.
  • dragz
    dragz over 8 years
    Thanks for sharing your insights. This is very useful information, I think the teamsite option seems to be the way to go. Again, thanks, and happy holidays!