#StackBounty: #sharepoint-online #pnp-powershell #pnp-provision Issue while deploying the modern site SharePoint Starter Kit v2

Bounty: 50

I am having issue running the starter kit 2 available here

Below is the error i am getting

enter image description here

Below are the steps i followed from the article

Install-Module -Name "SharePointPnPPowerShellOnline" -RequiredVersion 3.20.2004.0
 Connect-PnPOnline -Url https://tenant-admin.sharepoint.com/  -PnPO365ManagementShell
Connect-PnPOnline -Url https://tenant.sharepoint.com

Change to the provisioning folder found in this solution’s root and execute the following command

 Apply-PnPTenantTemplate -Path .starterkit.pnp


Get this bounty!!!

#StackBounty: #sharepoint-online #page-layout #pnp-powershell #pnp #enterprise-wiki Can i update the enterprise wiki pages' content…

Bounty: 50

I have migrated an old enterprise wiki site collection 2013 to SharePoint online. I did not create the source site collection, and i found that the wiki pages are associated with the built-in Enterprise Wiki Page content type and the built-in EnterpriseWiki.aspx page layout. And those 2 built components were customized by adding new site columns to them. As i know that modifying the built-in components (Content type and the Page layout) are not recommended, because the modification might get overridden by Microsoft if they apply an update. so i create a new content type which mimic the built-in one and i create a new layout which mimic the the built-in one.

But i am not sure if i can write a PnP script to update the enterprise wiki pages’s Content type and Page layout without affecting the wiki pages’ metadata (mainly the modified date and modified by)?


Get this bounty!!!

#StackBounty: #sharepoint-online #page-layout #pnp-powershell #pnp #enterprise-wiki Can i update the enterprise wiki pages' content…

Bounty: 50

I have migrated an old enterprise wiki site collection 2013 to SharePoint online. I did not create the source site collection, and i found that the wiki pages are associated with the built-in Enterprise Wiki Page content type and the built-in EnterpriseWiki.aspx page layout. And those 2 built components were customized by adding new site columns to them. As i know that modifying the built-in components (Content type and the Page layout) are not recommended, because the modification might get overridden by Microsoft if they apply an update. so i create a new content type which mimic the built-in one and i create a new layout which mimic the the built-in one.

But i am not sure if i can write a PnP script to update the enterprise wiki pages’s Content type and Page layout without affecting the wiki pages’ metadata (mainly the modified date and modified by)?


Get this bounty!!!

#StackBounty: #sharepoint-online #powershell #pnp-powershell Batch update via PNP Powershell

Bounty: 300

I have data from a CSV that will be imported and added to column values for each of these items. I can loop over CSV, get the items, and set the values (Set-PNPListItem) – but the sequential operations take quite way too long.

Google-fu may be weak on this subject as I’m not finding much info, and I can’t imagine this isn’t an issue for others.

Is there a way to batch or queue up requests with the PNP CMDLETS? If not how are those of you that are doing it handling this?


Get this bounty!!!

#StackBounty: #sharepoint-online #powershell #permissions #pnp-powershell #subfolders How to copy the folder structure and permissions …

Bounty: 50

I have a document libray with structure like given below: FolderA->Subfolder1->item1
Subfolder2–>item2
They have folder level permissions . now i want to create the same folder structure and permissions with different Folder Parent name for example:

Once we copy the folder structure should be FOLDER B–>Subfolder1->item1
Subfolder2–>item2

This is for sharepointonline CSOM powershell.

I was able to copy the folder structure but unable to get permissions is anything missing

       Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll" 
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Taxonomy.dll"

Function Copy-SPOFolder([String]$SiteURL, [String]$SourceFolderURL, [String]$TargetFolderURL)
{
    $Host.Runspace.ThreadOptions = "ReuseThread"
    Try{
        #Copy the Folder
        $MoveCopyOpt = New-Object Microsoft.SharePoint.Client.MoveCopyOptions
        [Microsoft.SharePoint.Client.MoveCopyUtil]::CopyFolder($ctx, $SourceFolderURL, $TargetFolderURL, $MoveCopyOpt)
        $ctx.ExecuteQuery()
        Write-host -f Green "Folder Copied Successfully!" }
    Catch {
        write-host -f Red "Error Copying the Folder!" $_.Exception.Message
    }
}
function Connect-SPO()
{
    param ([Parameter(Mandatory=$true,Position=1)][string]$Username,[Parameter(Mandatory=$true,Position=2)][string]$Url,[Parameter(Mandatory=$true,Position=3)]$AdminPassword)
    $global:ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
    $ctx.Load($ctx.Web)
    $ctx.ExecuteQuery()
}
#Function to Get Folder Permissions
Function Get-SPOFolderPermission([String]$SiteURL, [String]$FolderRelativeURL)
{
    $Host.Runspace.ThreadOptions = "ReuseThread"
    Try{


        #Get the Folder
        $Folder = $ctx.Web.GetFolderByServerRelativeUrl($FolderRelativeURL)
        $ctx.Load($Folder)
        $ctx.ExecuteQuery()

        #Get permissions assigned to the Folder
        $RoleAssignments = $Folder.ListItemAllFields.RoleAssignments
        $ctx.Load($RoleAssignments)
        $ctx.ExecuteQuery()

        #Loop through each permission assigned and extract details
        $PermissionCollection = @()
        Foreach($RoleAssignment in $RoleAssignments)
        {
            $ctx.Load($RoleAssignment.Member)
            $ctx.executeQuery()

            #Get the User Type
            $PermissionType = $RoleAssignment.Member.PrincipalType

            #Get the Permission Levels assigned
            $ctx.Load($RoleAssignment.RoleDefinitionBindings)
            $ctx.ExecuteQuery()


                    $PermissionLevels = ($RoleAssignment.RoleDefinitionBindings | Select -ExpandProperty Name) -join ","
                    #Get the User/Group Name
                     $Name = $RoleAssignment.Member.Title # $RoleAssignment.Member.LoginName

                        #Add the Data to Object
                        $Permissions = New-Object PSObject
                        $Permissions | Add-Member NoteProperty Name($Name)
                        $Permissions | Add-Member NoteProperty Type($PermissionType)
                        $Permissions | Add-Member NoteProperty PermissionLevels($PermissionLevels)
                        $PermissionCollection += $Permissions

        }
        Return $PermissionCollection
    }
    Catch {
        write-host -f Red "Error Getting Folder Permissions!" $_.Exception.Message
    }
}
#variables

$admin="santosh.sandy@micrososft.sharepoint.com"
$pass= ConvertTo-SecureString "TSDTD" -AsPlainText -Force
$SiteURL="https://sandy.sharepoint.com/sites/hgs_demo/"
$LibraryName="FolderTest";
$SrcFolderName="RootLibrary"
$NewFolderName="RootLibrary1"
$global:ctx
Try {
    Connect-SPO -Username $admin -Url $SiteURL -AdminPassword $pass
    $Library=$ctx.Web.Lists.GetByTitle($LibraryName);
    $Folders = $Library.RootFolder.Folders
    $ctx.Load($Library);
    $ctx.Load($Folders)
    $ctx.ExecuteQuery()        
    #Get existing folder names
    $FolderNames = $Folders | Select -ExpandProperty Name 
    if($FolderNames -contains $NewFolderName)
    {
        write-host "Folder Exists Already!" -ForegroundColor Yellow
    }
    else{


        $SourceFolderURL= $SiteURL + $LibraryName +"/" + $SrcFolderName
        $TargetFolderURL= $SiteURL + $LibraryName +"/" + $NewFolderName 
        Copy-SPOFolder $SiteURL $SourceFolderURL $TargetFolderURL
        $ctx.Load($Library);
        $ctx.Load($Folders)
        $ctx.ExecuteQuery()
        $FolderNames = $Folders | Select -ExpandProperty Name 
        if($FolderNames -contains $NewFolderName)
        {
            $FolderRelativeURL= "/sites/hgs_demo/"+ $LibraryName +"/" + $NewFolderName
            # write-host "Folder Exists Already!" -ForegroundColor Yellow
            $cFolder = $ctx.Web.GetFolderByServerRelativeUrl($FolderRelativeURL)
            $ctx.Load($cFolder)
            $ctx.ExecuteQuery()

            #Break Permission inheritence - Remove all existing list permissions & keep Item level permissions
            $cFolder.ListItemAllFields.BreakRoleInheritance($False,$True)
            $ctx.ExecuteQuery()
            Write-host -f Yellow "Folder's Permission inheritance broken..."
            $copyfolderRetaltiveurl= "/sites/hgs_demo/"+ $LibraryName +"/" + $SrcFolderName
            $PermissionCopy=  Get-SPOFolderPermission $SiteURL $copyfolderRetaltiveurl
            foreach($Permission in $PermissionCopy)
          {

           Write-Host $Permission.Name +".." $Permission.Type +"..." $Permission.PermissionLevels

           if($Permission.Type -eq "User")
           {
             $UserAccount =$Permission.Name
           }
           else{

           $GroupName = $Permission.Name

           }
            #Get the SharePoint Group & User
            $Group =$ctx.Web.SiteGroups.GetByName($GroupName)
            $User = $ctx.Web.EnsureUser($UserAccount)
            $ctx.load($Group)
            $ctx.load($User)
            $ctx.ExecuteQuery()

            #Grant permission
    #Get the role required
    $Role = $ctx.Web.RoleDefinitions.GetByName($Permission.PermissionLevels)
    $RoleDB = New-Object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($ctx)
    $RoleDB.Add($Role)

    #Assign permissions
    $GroupPermissions = $cFolder.ListItemAllFields.RoleAssignments.Add($Group,$RoleDB)
    $UserPermissions = $cFolder.ListItemAllFields.RoleAssignments.Add($User,$RoleDB)
    $cFolder.Update()
    $ctx.ExecuteQuery()

    Write-host "Permission Granted Successfully!" -ForegroundColor Green 

          }#end of for each loop     
        }
    }
}
Catch {
    write-host -f Red "Error Granting permission to  Folder!" $_.Exception.Message
}


Get this bounty!!!

#StackBounty: #sharepoint-online #development #powershell #sharepoint-on-prem #pnp-powershell Migrating the Rating for our discussion b…

Bounty: 50

I have a team site inside our sharepoint farm 2013. and the team site contain a Discussion board list which have rating enabled. now using a third party tool named share-gate i migrated the team site to a classic online team site, where everything have been migrated correctly, except the rating for the discussion board list items. so the migrated discussion board list will have the discussion board items and their replies migrated well, but the number of likes will be = 0.
i contacted the third party company and they mentioned that currently migrating the rating is not available. but in our case i need the rating info,because we use the rating as a formal way to confirm that someone read the discussion board list.

so my question,what are the approaches to migrate the rating in my case? for example can I write a power-shell script which read the rating for the discussion board list items and update the migrated items? both environments (on-premises & on-line ) are based on the same Active directory.
Thanks


Get this bounty!!!

#StackBounty: #sharepoint-online #permissions #migration #administration #pnp-powershell How i can verify that our migrated "Contr…

Bounty: 50

I did a migration from SharePoint on-premises 2013 to SharePoint online, using a third party tool, as follow:-

  1. The source on-premises site collection is a team site that have publishing features enabled and have 2 levels of sub sites. Also the build-in “Contribute” permission, have the “Manage Alerts – Manage alerts for all users of the Web site.” permission unchecked as follow:-
    enter image description here

  2. To start the migration, I created a new online classic team site collection inside our office 365 and I migrated the on-premises site collection to it. And everything went fine. But today I were verifying the migrated online site, and I were comparing the permissions granted to the built-in permission levels, and I have noted that the migrated “Contribute” permission has the “Manage Alerts – Manage alerts for all users of the Web site.” permission checked as follow:-
    enter image description here

so now i know that i can uncheck the “Manage Alerts – Manage alerts for all users of the Web site.”, and have the permission check-boxes mimic the on-premises ones. but my question is how i can be sure that the migrated “Contribute” permission level is 100% identical to any “Contribute” permission level inside a brand new online site collection. for example can i do this:-

  1. create a new online classic team site collection >> which will have a built-in “Contribute” permission level >> run a PnP script to get all the permission it has.
  2. then run the same PnP script on the migrated site, and compare the 2 results.

now i know that i can access the Contribute permission level from the UI (as i did when i noticed the problem), but as i know that the UI permission check-boxes are not the lowest level permission, where a checkbox can have 2 or more lower level permissions underneath it.
So my question is how i can get these lower level permissions for the “Contribute” permission level, to compare them inside the migrated site and inside a band new online site?
Thanks.


Get this bounty!!!