Discussing about Microsoft Technologies
[SPO] Sites and their IDs
OK, since I get pretty often asked: how to I get a site’s ID or now, I have a site ID, how to I get […]
Discussing about Microsoft Technologies
OK, since I get pretty often asked: how to I get a site’s ID or now, I have a site ID, how to I get […]
OK, so here are several ways to re-provision the SiteAssets library on a SharePoint online site collection: Using PnP:
|
1 2 3 4 5 6 7 8 9 |
Connect-PnPOnline -Url https://pbnet.sharepoint.com/teams/ASSETS1 ` -ClientId "dfbd77ff-be64-XXX-XXX-17a62a02fd29" ` -Tenant "pbnet.onmicrosoft.com" ` -CertificatePath "C:\SPOPNP\pnpappcert.pfx" ` -CertificatePassword (ConvertTo-SecureString "XXXXXXXXXX" -AsPlainText -Force) $Web = Get-PnPWeb $Web.Lists.EnsureSiteAssetsLibrary() Invoke-PnPQuery |
Using CSOM (no MFA):
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Add-Type -Path "C:\CSOM\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\CSOM\Microsoft.SharePoint.Client.Runtime.dll" # SharePoint site and credentials $siteUrl = "https://a830edad9050849testasset.sharepoint.com/sites/SITEASSETS1" $username = "admin@a830edad9050849testasset.onmicrosoft.com" # Get credentials $securePassword = Read-Host -Prompt "Enter your password" -AsSecureString $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword) # Connect to SharePoint $context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) $context.Credentials = $credentials # Get the list and root folder $t = $context.Web.Lists.EnsureSiteAssetsLibrary() $context.Load($t) $context.ExecuteQuery() |
Since the 3.0.x version of the PNP module, you don’t have the -UseWebLogin switch anymore when using Connect-PnPOnline. So, let’s connect using a self-signed certificate […]
If you tagged all your files/folders in a document library with a retention label/tag, here’s a quick way to remove them via PnP:
|
1 2 3 4 5 6 7 8 9 10 |
Connect-PnPOnline -Url https://mngenvmcap495437.sharepoint.com/sites/RETENTION-TEST1 -UseWebLogin $items = Get-PnPListItem -List "Documents" foreach ($item in $items) { Set-PnPListItem -Identity $item.Id -List "Documents" -ClearLabel } |
Enjoy!
OK, so the scenario goes like this: You go to a SharePoint document library, click on the ellipsis next to a file and select “Copy […]
So, here goes:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# Define the variables for your enviroment. The first one is the link to your SharePoint Admin Portal. The second one is your administrator account User Principal Name $SPAdminLink = "https://tenant-admin.sharepoint.com" $AdminUPN = "user@domain.com" # Connect to SharePoint. Replace the link with your SharePoint Admin portal # you need to have run install-module -name Microsoft.Online.SharePoint.PowerShell to have the module installed. Connect-SPOService -Url $SPAdminLink # Enable AIP Integration Set-SPOTenant -EnableAIPIntegration $true (Get-SPOTenant).EnableAIPIntegration # Enable support for PDFs. Update SP Online Module if this fails. The link is https://www.microsoft.com/en-us/download/details.aspx?id=35588 Set-SPOTenant -EnableSensitivityLabelforPDF $true (Get-SPOTenant).EnableSensitivityLabelforPDF # Connect to AAD and enable support for labels in groups. Source: https://learn.microsoft.com/en-us/microsoft-365/compliance/sensitivity-labels-teams-groups-sites?view=o365-worldwide Install-Module AzureADPreview AzureADPreview\Connect-AzureAD $grpUnifiedSetting = (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ) $Setting = $grpUnifiedSetting # Check if EnableMIPLabels is enabled. If nothing is displayed then you have no group settings. We'll enable it. $grpUnifiedSetting.Values # Enable the feature. If it fails check out this guide: https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/groups-settings-cmdlets#create-settings-at-the-directory-level $Setting["EnableMIPLabels"] = "True" # Check that now it's enabled. If it's enabled you'll get # #Name Value #---- ----- #EnableMIPLabels True $Setting.Values # Save Set-AzureADDirectorySetting -Id $grpUnifiedSetting.Id -DirectorySetting $Setting # Now we'll import ExchangeOnlineManagement and then connect the Compliance Powershell to sync the labels #You might have problems running the below part in PowerShell ISE. If you do, run them in a normal PowerShell session #Also, ensure you have the module installed with Install-Module -Name ExchangeOnlineManagement Import-Module ExchangeOnlineManagement Connect-IPPSSession -UserPrincipalName $AdminUPN Execute-AzureAdLabelSync |
Create and publish your label, then wait around 24h to have everything propagated. If you get any error with the following […]
Official article: https://learn.microsoft.com/en-us/sharepoint/allow-or-prevent-custom-script#to-allow-custom-script-on-other-sharepoint-sites So, here goes: #gathering the tenant name Write-Host “DenyAddAndCustomizePages checker and enabler/disabler” write-host “=====================================================” $tenantname = Read-Host “Enter your tenant’s name” #connecting […]
So, here goes:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameChecking #Config Parameters $AdminSiteURL = https://tenant-admin.sharepoint.com/ $EmailFrom =admin@tenant.onmicrosoft.com $EmailTo = admin2@tenant.onmicrosoft.com $Subject ="Utilities test" $SiteURL = https://tenant.sharepoint.com/sites/testsite #Setup Credentials and connect $Cred = Get-Credential Connect-SPOService -Url $AdminSiteURL -Credential $Cred #Get site info $SiteStorage = Get-SPOSite https://tenant.sharepoint.com/sites/testsite #Setup the site context for SPUtility SendEmail $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) #Setup Email $EmailProperties = New-Object Microsoft.SharePoint.Client.Utilities.EmailProperties $EmailProperties.From = $EmailTo $EmailProperties.To = [String[]] $EmailTo $EmailProperties.Subject = $Subject $EmailProperties.Body = $SiteStorage | Convertto-html [Microsoft.SharePoint.Client.Utilities.Utility]::SendEmail($Ctx,$EmailProperties) $Ctx.ExecuteQuery() |
Enjoy!
So, here goes: Remember that the UPN should always be in claims format. The script will remove the specified UPN from all SharePoint site collections […]
OK, so out the box, SharePoint online does not offer us any possibility to copy site pages from site collection A to site collection B. […]
Copyright © 2026 | PhoeNIXBird Networks