question

GlennMaxwell-2309 avatar image
0 Votes"
GlennMaxwell-2309 asked sadomovalex answered

OneDrive Access

Hi All

One of my user lets say user1 has the left the company and his user account is in disabled state. i have a requirement to provide access for few folders of user1's onedrive to user2.
Lets say below are the folders in user1's onedrive. how do i provide access to these folders to user2 from powershell.

Test1 A
Test2 B

If i use the below syntax i can provide access to complete OneDrive but i am not sure how to provide access to few folders. experts guide me. in the below i am taking contoso as an example.

 Set-SPOUser -Site https://contoso-my.sharepoint.com/personal/user1_contoso_com -LoginName user2@contoso.com -IsSiteCollectionAdmin $true




office-sharepoint-onlineoffice-onedrive-client-itprooffice-sharepoint-server-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YiLu-MSFT avatar image
0 Votes"
YiLu-MSFT answered

Hi @GlennMaxwell-2309
You could tyr "Set-PnPFolderPermission" to grant permission for user in folder, for example:

 Set-PnPFolderPermission -List 'Shared Documents' -Identity 'Shared Documents\Folder' -User 'user@contoso.com' -AddRole 'Contribute'

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

michev avatar image
0 Votes"
michev answered

You cannot use PowerShell to provide access to specific folders/files only. The cmdlet above will give access to the entire content of the user's OneDrive. If that's not what you want, grant permissions to your admin user, open the OneDrive and then use the Share functionality against the folders in questions. If you want to achieve this programmatically, use CSOM or the Graph API.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

sadomovalex avatar image
0 Votes"
sadomovalex answered

check the following solution suggested by Microsoft: Give another employee access to OneDrive and Outlook data.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.