copy files

Iron Contributor

Hi experts

one of my user has left the company and i can see his account disabled in active directory.

Now his boss asks me to copy all the users file from one drive and hand over to him. how do i achieve this.

14 Replies

Best way is to give access to the OneDrive location and let them download the stuff they need.

How to connect PowerShell to Office 365

You must download and install SharePoint Online Management Shell
https://www.microsoft.com/en-us/download/details.aspx?id=35588
Run Sharepoint Online Management Shell
Run as admin

How to grant admin access to OneDrive account

To add access to Site collection
Connect-SPOService -Url https://teanant-admin.sharepoint.com -credential username@domain.org
Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/targerusername_domain_org -LoginName username@domain.org -IsSiteCollectionAdmin $true

You can also add yourself as ODFB owner using the user interface: https://www.petri.com/4-ways-add-secondary-administrator-onedrive-business
Yeah but he disabled the user aka it moves to deleted, don't think you can use UI at that point!

Hi experts

I can see this user under deleted users.

Home-Users-Deleted users.

Is there any way to recover data of this user, i read earlier that contents will be preserved for one month

Yes follow the posts we put to assign site collection admin to yourself or the person needing permission to the OneDrive site. You have at least 30 days to do so unless you have preservation turned way up then you have longer.

Connect-SPOService -Url https://teanant-admin.sharepoint.com -credential username@domain.org

 

is username@domain.org is deleted users account?

 

Set-SPOUser -Site https://tenant-my.sharepoint.com/personal/targerusername_domain_org -LoginName
username@domain.org -IsSiteCollectionAdmin $true

 

is username@domain.org is deleted users account?

The first part is connecting to your tenant and that is your admin login. The 2nd part is the user you want to add to the site as a site collection admin. So either you or the person wanting access to the files account.

Hi i would prefer my name to the 2nd part , i.e i will add my name to the site as a site collection admin.

After that how do i need to access the users files as i want to copy them and share to their manager

Just paste the site url into browser and then you can download them and you may even be able to sync them. You might be able to paste the library url into explorer and view it but not sure I’ll test here in s but.

You can use PowerShell to achive this (for deleted SPO sites).

 

Set-sposite -Identity https://DOMAIN-my.sharepoint.com/personal/bas_wijdenes_domain_com -Owner "Roger.roger@baswijdenes.com

 

The owner will now be able to open the onedrive with the link already provided.

 

If you need more help, let me know.

i am getting the below error, i have installed sharepoing management shell, i am getting below error

 

PS C:\Windows\system32> Connect-SPOService -Url https://teanant-admin.sharepoint
.com -credential myuser@mydomain.com
Connect-SPOService : Could not connect to SharePoint Online.
At line:1 char:1
+ Connect-SPOService -Url https://teanant-admin.sharepoint.com -credential
myuser ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : NotSpecified: (:) [Connect-SPOService], InvalidO
perationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Onlin
e.SharePoint.PowerShell.ConnectSPOService

 

even i tried both but i could not connect

Connect-SPOService -Url https://mydomain-my.sharepoint.com -credential myuser@mydomain.com
Connect-SPOService -Url https://mydomain-admin..sharepoint.com -credential myuser@mydomain.com

Hi i am able to connect to shell using my credentials myuser@mydomain.com

PS C:\Windows\system32> Connect-SPOService -Url https://mydomain-admin.sharepoint.com

lets say deleted user is rogerfederer his domain account is roger.federer in AD and email id was roger.federer@mydomain.com

next should i proceed with  which syntax 

Set-SPOUser -Site https://mydomain-my.sharepoint.com/personal/roger_federer_mydomain.com -loginName roger.federer@mydomain.com  -IsSiteCollectionAdmin $true

or

Set-SPOUser -Site https://mydomain-my.sharepoint.com/personal/roger.federer_mydomain.com -loginName roger.federer@mydomain.com  -IsSiteCollectionAdmin $true

 

once its done can i access his file by the rul

 

https://mydomain-my.sharepoint.com/personal/roger_federer_mydomain_com/_layouts/15/onedrive.aspx

 

 

probably roger.federer_domain_com but just try both you won't hurt anything trying and you'll know when you get it cause you wont' get an error.

Also the -loginname is YOUR login or who you want to give access (make the site collection admin) not that user.

thanks alot will try and update you

 

Set-SPOUser -Site https://mydomain-my.sharepoint.com/personal/roger.federer_mydomain.com -loginName myuser@mydomain.com  -IsSiteCollectionAdmin $true