Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. $programFiles = [environment]::getfolderpath("programfiles")
  2. add-type -Path $programFiles'SharePoint Online Management ShellMicrosoft.Online.SharePoint.PowerShellMicrosoft.SharePoint.Client.dll'
  3. $siteurl = 'SITEURL'
  4. $username = 'USERNAME'
  5. $password = ConvertTo-SecureString -String 'PASSWORD' -AsPlainText -Force
  6. $outfilepath = $siteurl -replace ':', '_' -replace '/', '_'
  7. [Microsoft.SharePoint.Client.ClientContext]$cc = New-Object Microsoft.SharePoint.Client.ClientContext($siteurl)
  8. [Microsoft.SharePoint.Client.SharePointOnlineCredentials]$spocreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
  9. $cc.Credentials = $spocreds
  10. $sideLoadingEnabled = [Microsoft.SharePoint.Client.appcatalog]::IsAppSideloadingEnabled($cc);
  11. $cc.ExecuteQuery()
  12. if($sideLoadingEnabled.value -eq $false) {
  13. Write-Host -ForegroundColor Yellow 'SideLoading feature is not enabled on the site:' $siteurl
  14. $site = $cc.Site;
  15. $sideLoadingGuid = new-object System.Guid "AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D"
  16. $site.Features.Add($sideLoadingGuid, $false, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);
  17. $cc.ExecuteQuery();
  18. Write-Host -ForegroundColor Green 'SideLoading feature enabled on site' $siteurl
  19. }
  20. Else
  21. {
  22. Write-Host -ForegroundColor Green 'SideLoading feature is already enabled on site' $siteurl
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement