Last active
October 14, 2022 09:14
-
-
Save kasuken/01690b8f00753929bc33 to your computer and use it in GitHub Desktop.
Enable sideloading in SharePoint Online
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$programFiles = [environment]::getfolderpath("programfiles") | |
add-type -Path $programFiles'\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll' | |
Write-Host 'Insert information for Site' | |
$siteurl = Read-Host "Site Url" | |
$username = Read-Host "User Name" | |
$password = Read-Host -AsSecureString "Password" | |
try | |
{ | |
[Microsoft.SharePoint.Client.ClientContext]$ClientContext = New-Object Microsoft.SharePoint.Client.ClientContext($siteurl) | |
$ClientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password) | |
$site = $ClientContext.Site; | |
$sideLoadingGuid = new-object System.Guid "AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D" | |
$site.Features.Add($sideLoadingGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None); | |
$ClientContext.ExecuteQuery(); | |
Write-Host -ForegroundColor Green 'SideLoading feature enabled :)' | |
} | |
catch | |
{ | |
Write-Host -ForegroundColor Red 'Error ' $siteurl, ':' $Error[0].ToString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$siteurl = Read-Host "Site Url" | |
Connect-PnPOnline -Url $siteurl | |
Set-PnPAppSideLoading -On | |
Disconnect-PnPOnline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment