Enabling SideLoading in SharePoint Online for Non-Developer Site

Note 1: By default this feature is enabled in “Developer Site”. So if your site has been created with the “Developer Site” template then do not use this article since this is for non-developer sites.

Note 2: Enabling this feature is not recommended for production sites. Sideloading apps is insecure. The main reason for blocking sideloading by default on non-developer sites is the risk that faulty apps pose to their host web/host site collection. Apps have the potential to destroy data and make sites or, given enough permissions, can even make site collections unusable. Therefore, apps should only be sideloaded in dev/test environments and never in production.

(Referenece: Apps for Office and SharePoint blog)

Pre-requisites

  • Install Windows PowerShell from Windows Management Framework (I installed the Windows Management Framework 3.0).

  • Then install “SharePoint Online Management Shell” Link.

Procedure

  • Execute a PowerShell script in any desktop not requiring a SharePoint Server (of course that’s the purpose of SharePoint Online).

  • Be sure you enable “ExecutionPolicy” in the client desktop where your PowerShell will be executed.

  • Open “SharePoint Online Management Shell” with “Run as Administrator” and execute Set-ExecutionPolicy RemoteSigned

     
    Screenshot for reference only,



  • Now execute the PowerShell from “SharePoint Online Management Shell”.

  • The PowerShell script is provided here and also attached to the article.

    Code
    1. $programFiles = [environment]::getfolderpath("programfiles")  
    2. add - type - Path $programFiles '\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll'  
    3. Write - Host 'Ready to enable Sideloading'  
    4. $siteurl = Read - Host 'Site Url'  
    5. $username = Read - Host "User Name"  
    6. $password = Read - Host - AsSecureString 'Password'  
    7.   
    8. $outfilepath = $siteurl - replace ':''_' - replace '/''_'  
    9.   
    10. try {  
    11.     [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)  
    12.     $cc.Credentials = $spocreds  
    13.     $site = $cc.Site;  
    14.   
    15.     $sideLoadingGuid = new - object System.Guid "AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D"  
    16.     $site.Features.Add($sideLoadingGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);  
    17.   
    18.     $cc.ExecuteQuery();  
    19.   
    20.     Write - Host - ForegroundColor Green 'SideLoading feature enabled on site'  
    21.     $siteurl#Activate the Developer Site feature  
    22. catch {  
    23.     Write - Host - ForegroundColor Red 'Error encountered when trying to enable SideLoading feature'  
    24.     $siteurl, ':'  
    25.     $Error[0].ToString();  
    26. }  
  • Screenshot for reference only.

    Screenshot for reference

    Screenshot

    Now you are all ready to deploy your apps into the SharePoint Online Site.