Access to one drive

Glenn Maxwell 11,941 Reputation points
2023-04-28T04:26:13.1266667+00:00

Hi All

One of my user left the organization, lets say User1. i want to provide users1s one drive access to user2. Using the below syntax i am able to provide access but is there a way just to provide read access.

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

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,969 questions
OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,297 questions
0 comments No comments
{count} votes

Accepted answer
  1. Emily Du-MSFT 48,176 Reputation points Microsoft Vendor
    2023-05-03T00:30:16.4666667+00:00

    After running the PowerShell, whether the user2 has read access to OneDrive?

    Here is my test result for your reference.

    1

    User's image


    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.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Emily Du-MSFT 48,176 Reputation points Microsoft Vendor
    2023-04-28T09:54:07.27+00:00

    First, use IsSiteCollectionAdmin $false to remove full control permission.

    Then, to grant a user read permission for OneDrive site collection, you could run following PowerShell.

    #Parameters
    $SiteURL = "https://mydomain-my.sharepoint.com/personal/user1_mydomain_com"
    $UserAccount = "user2@mydomain.com"
    $PermissionLevel = "Read"
     
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Interactive   
     
    #grant access to sharepoint online site with powershell
    Set-PnPWebPermission -User $UserAccount -AddRole $PermissionLevel
    

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.