Deploying App in SharePoint Online - Sideloading of apps is not enabled on this site.

Its the era of Office 365 and cloud  now. On a fine day, you learned to develop app. The app is developed in Visual Studio and you are planning to deploy in your SharePoint Online site.

  • You created the developer's site
  • Developed the App
  • Then tried to deploy the App.....


Boommm!!! 

Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.

Now What??? Then comes the PowerShell scripts for your rescue.....


Execute the following PowerShell scripts. 


#CODE STARTS HERE
$programFiles = [environment]::getfolderpath("programfiles")
add-type -Path $programFiles'\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll'
Write-Host 'Ready to enable Sideloading'
$siteurl = Read-Host 'SiteUrl'
$username = Read-Host "UserName"
$password = Read-Host -AsSecureString 'Password'
$outfilepath = $siteurl -replace ':', '_' -replace '/', '_'
try
{
    [Microsoft.SharePoint.Client.ClientContext]$cc = New-Object Microsoft.SharePoint.Client.ClientContext($siteurl)
    [Microsoft.SharePoint.Client.SharePointOnlineCredentials]$spocreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    $cc.Credentials = $spocreds
    $site = $cc.Site;

    $sideLoadingGuid = new-object System.Guid "AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D"
    $site.Features.Add($sideLoadingGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);
     
    $cc.ExecuteQuery();
     
    Write-Host -ForegroundColor Green 'SideLoading feature enabled on site' $siteurl
    #Activate the Developer Site feature
}
catch
    Write-Host -ForegroundColor Red 'Error encountered when trying to enable SideLoading feature' $siteurl, ':' $Error[0].ToString();
}

#CODE ENDS HERE


Give the Site URL, Administrator Username & Password. And then it says, "Sideloading feature is enabled on site".

Comments

Popular posts from this blog

Authenticating SharePoint with Multi Factor Authentication using PnP PowerShell

Get the total hours in HH:MM from 2 different time spans.