If you are deploying a solution to SharePoint Online, at some point you will likely come across the following error: Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.
So...In short, you will not be able to deploy any solution from Visual Studio to SharePoint Online/Office 365 without enabling Sideloading first. I will show you how to fix this and then explain later, so you don’t waste any time looking for the answer. After all, I believe you came here to find the fix first
2-Steps Solution:
1) Download and install SharePoint Online Management Shell
2) Execute the script below. (Note that the Sideloading Feature ID is harcoded in SharePoint, as are many other OOTB features)
#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 '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 HERE
In your SPO Management Shell enter the url of the site you want to deploy the solution, the administrator username and the password. The powershell will take care of the rest.
Now off you go. You’re ready to deploy solutions from your Visual Studio straight into Office 365. You can also get a more elaborate code in the MSDN Code Solution Repository.
by Edge Pereira
Very helpful article. I was facing the same problem with my SharePoint application development and finally grab the solutions from here.Thanks a lot.
ReplyDeleteexcellent!
DeleteThanks man... very helpful.
ReplyDeletethanks Caio.!
DeleteVery helpfulll....thanks...
ReplyDelete:)
DeleteNow this is what I call problem solving,, cool :) thanks
ReplyDeleteyeah, that's my main focus: problem solving :)
DeleteOne Shot and problem solved. Great work.
ReplyDeleteno worries. come back soon.
DeleteHi Edge Pereira ,
ReplyDeleteWhen we run the Sideload.ps1 so that Error shows
\Sideload.ps1 file cannot loaded because running scripts is disabled on this system
Please Suggrest me how e can resolve it
Thanks
Deepak Chauhan
try to:
Delete1) open poweshell as administrator
2) set-ExecutionPolicy Unrestricted
Took a while to realize that this is a powershell script
ReplyDelete