How to migrate selected folder and files permission from OneDrive to Sharepoint Online?

Copper Contributor

We are migrating all the permission of selected contents(files and folders) from the OneDrive to SharePoint Online, if number of files are less than 100, script migrate it's in half an hour, however, if the count of files more than 5000 then it will takes around 10 hours, which is effecting the performance of migration.

Kindly find below the portion of code for getting the permissions.

 

#$fileUrl -NewFolder/logo.png
$file = Get-PnPFile -Url $fileUrl -AsListItem
Get-PnPProperty -ClientObject $file -Property RoleAssignments
$members = Get-PnPProperty -ClientObject $roleAssignments -Property RoleDefinitionBindings, Member
$member = $roleAssignments.Member
#list of users
$Users = Get-PnPProperty -ErrorAction SilentlyContinue -ClientObject $member -Property Users
#Return Accesstype
$accessType = $roleAssignments.RoleDefinitionBindings.Name;

               

Hence, we are decide to use workflow in the PowerShell script, as shown in the below link:

https://gist.github.com/jamiekt/f586e47cb96b93dacbe5

 

But this link doesn't fulfil our requirement.

 

Kindly let us any suitable solution in the PowerShell to meet our requirement

0 Replies