Skip to main content

Posts

Showing posts from February, 2020

Access Denied Error on Save Site as Template in SharePoint Online

To fix this problem, we need to enable custom scripts. Here is how to fix the access denied error on Save Site as Template. Login to SharePoint Online Admin Center Click on Settings from the left navigation >> Scroll down to "Custom Script" section Set "Allow users to run custom script on personal site" and "Allow users to run custom script on self-service created sites" options. Click on "OK" to save your changes. However, this change may take up to 24 Hours to reflect. To enable scripting on a particular site collection immediately, use this PowerShell script in SharePoint Online Management Shell. #Config Parameters $AdminSiteURL="https://crescent-admin.sharepoint.com" $SiteURL="https://crescent.sharepoint.com" #Get Credentials to connect $Cred = Get-Credential #Connect to SharePoint Online Tenant Admin Connect-SPOService -URL $AdminSiteURL -Credential $Cred #Disable DenyAddAndCustomizePages Flag ...

Get Active Features in Site Collection using Powershell

#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Variables $SiteURL="SiteCollection URL" #Setup Credentials to connect $Cred= Get-Credential $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Credentials #Get Site Collection Features $SiteCollFeatures = $Ctx.Site.Features $Ctx.Load($SiteCollFeatures) $Ctx.ExecuteQuery()          #Loop through each feature and get feature data Write-host "Site Collection Features:" ForEach($Feature in $SiteCollFeatures) {     $Feature.Retrieve("DisplayName")     $Ctx.L...

Deactivate a Feature in SharePoint Online

SharePoint Online PowerShell to Disable Feature #Load SharePoint Online CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"   #Function to Disable Feature in SharePoint Online Function Disable-SPOFeature {      param ($SiteCollURL,$UserName,$Password,$FeatureGuid)     Try      {              #Setup the context         $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteCollURL)         $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $Password)         $Ctx.Credentials = $Credentials         $Site=$Ctx.Site   ...