Enabling SideLoading in SharePoint Online for NON-DEVELOPER SITE



Note1: By default this feature is enabled in “Developer Site”. So if your site is created with “Developer Site” template don’t read below (This is for the non-developer site)

Note2: Enabling this feature is not recommended for Production Site. 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


Pre-requisites

-          Install Windows PowerShell from Windows Management Framework (I have installed Windows Management Framework 3.0) – (https://www.microsoft.com/en-us/download/details.aspx?id=34595 )

-          Then install “SharePoint Online Management Shell” (http://www.microsoft.com/en-us/download/details.aspx?id=35588 )

 Steps
-          Execute PowerShell script in any desktop which not required to be SharePoint Server (Of course that’s the purpose of SharePoint Online)

-          Make sure you enable “ExecutionPolicy” in the client desktop where your PowerShell is going to 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”
-      PowerShell script is mentioned below and also attached in the article
 
 
######################### Code Starts ########################
$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 'Site Url'
$username = Read-Host "User Name"
$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 ########################
-          Screenshot for reference only
 
 
-          Now you all ready to deploy your apps into the SharePoint Online Site

Comments

  1. sharepoint is a web based collaborative platform.it is basically an intranet and content management system.you can get more information at sharepoint online training.Read More At sharepoint online course

    ReplyDelete
  2. Highly informative article. This site has lots of information and it is useful for us. Thanks for sharing .Best MicroNutrients Company in India

    ReplyDelete

Post a Comment

Popular posts from this blog

Run Powershell script on Remote Computer/Server

Power BI Refresh Issue: unable to convert the value '' from the source data type 'VT_BSTR' to the expected data type 'VT_I8.

SPDActivities - DP.SharePoint.Workflow - Workflow failed to run