posts
#connection details $clientId = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" $invocation = (Get-Variable MyInvocation).Value $directorypath = Split-Path $invocation.MyCommand.Path $csvPath = $directorypath + "\TeamsChannelsExport.csv" # CSV should have a column 'SiteUrl' # Read sites from CSV $sites = Import-Csv -Path $csvPath #$TenantName = "contoso" #$adminSiteURL = "https://$TenantName-Admin.SharePoint.com" #Connect-PnPOnline -Url $adminSiteURL -ClientId $clientId function Add-ChannelNavigationLink { param( [string]$teamName, [string]$channelName, [string]$hubSiteUrl, [string]$channelSiteURL, [string]$teamSiteUrl, [string]$navParent ) Log-Message "Adding site to hub navigation - $($channelSiteURL)" "Info" if($hubSiteUrl) { try { # if(!
posts
The cmdlet Set-PnPListItem has different UpdateTypes: SystemUpdate, UpdateOverwriteVersion. Read more Set-PnPListItem
if($newAuthor) { try { if($item.FieldValues["Author"].email.ToLower() -eq $author.ToLower()){ Set-PnPListItem -List $list ` -Identity $item.Id ` -Values @{ "Author" = $newAuthor } ` -UpdateType SystemUpdate Log-Message "Setting Author to: $newAuthor for: $fileUrl" "Success" } } catch { Log-Message "Failed to update author $newAuthor on $fileUrl" "Error" } } if($newEditor) { try { if($item.FieldValues["Editor"].email.ToLower() -ne $newEditor.ToLower()){ # "Modified" = $item.FieldValues["Modified"] # "Author" = $item.
posts
In case of throttling ot large volume of request processing, there might be time out issues, throttling issues, etc.. skipping the setting application
$clientId = "xxxxxx" #Read-Host "Please enter the Entra Id registration:" # Connection String Variables, including client specific ID and Tenant $TenantUrl = "https://contoso.sharepoint.com" $TenantName = "contoso" function Invoke-With-Retry { param ( [scriptblock]$Operation, [string]$ErrorMessage, [string]$SuccessMessage, [int]$MaxRetries = 5, [int]$RetryDelay = 5 ) $attempt = 0 while ($attempt -lt $MaxRetries) { try { & $Operation Log-Message $SuccessMessage "Success" return } catch { $attempt++ if ($attempt -ge $MaxRetries) { Log-Message "$ErrorMessage.