Sharing Folder in SharePoint library with an Office 365 Group?

Copper Contributor

What I need to do seems simple enough, but I cannot find the appropriate cmdlet and syntax to do it.

 

I have a Document Library in a SharePoint Team Site (NOT  group-connected, but I don't think that matters). In that library, there are ~35 folders. These folders correspond to ~35 Office 365 Groups (technically "Teams", but each is still a unified-group under the hood). I want to 'share' (read-only) each of those folders with the corresponding unified-group. So, in natural language:

 

Share -Folder 'College of Engineering' -unified-group 'CollegeOfEngineering@<tenant>.onmicrosoft.com' -Access 'Read"

 

I've explored the Set-PnPListItemPermissions, but it doesn't seem to allow the specification of a folder to share, nor does it allow the shared-to party to be an O365 Group (there is a -Group parameter, but it refers to a SharePoint group object).

 

In any case, I could chug through this process manually in probably an hour, but would likely slip up at some point and give edit permissions instead of read/view. Also, as we're in the process of migrate a couple hundred SP2010 sites, many of which have similar permissions needs, figuring this out now is going to save a lot of time down the road. 

 

I already have a script that I'm using to create those ~35 folders, so if there would be a way to set the permissions when the folder is created, that would be ideal.

1 Reply

@ChadVKealey 

Set-PnPListItemPermissions cmd is work for your case and you need to use -User O365group@contoso.com 

 

Set-PnPListItemPermission -List Documents -Identity 4 -User O365group@contoso.com -AddRole 'Contribute'

Note: Identity 4 is folder ID and O365group@contoso.com is group email id