Office 365 Small Business “Sideloading of apps is not enabled on this site”

I began working on a new Office 365 site I had just created, and wanted to use Visual Studio to add an app to the site (using the Visual Studio deployment mechanism).  Unfortunately, I ran into the following error when I tried to run a “deploy” of the app.

“Sideloading of apps is not enabled on this site”

After a bit of pain sifting through the Google on the Internet box, I came across the following forum post on MSDN, http://social.msdn.microsoft.com/Forums/en-US/appsforsharepoint/thread/f30dcfa5-5047-4bd5-9f02-9feb7e935eec/.  In that post, there’s a perfect little section of PowerShell that allows you to specify your Office 365 site and credentials, and will then enable the feature for you.

Below is a copy of the code you’ll need to put into a “.ps1” file on your local machine.  Note you’ll also need a copy of the “Microsoft.SharePoint.Client.dll” somewhere – so you can run this script from another SharePoint server, alternatively, you can get the SharePoint Online Management Shell (local install on your dev machine) which is exactly where the code below will expect to find the file, or if you have a copy of the DLL on your machine locally, that works too, just change the path to the file in the code.

[code language=”powershell”]
#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 ‘To enable SharePoint app sideLoading, enter Site Url, username and password’

$siteurl = Read-Host ‘Site Url’
$username = Read-Host "User Name"
$password = Read-Host -AsSecureString ‘Password’

if ($siteurl -eq ”)
{
$siteurl = ‘https://mytenant.sharepoint.com/sites/mysite’
$username = ‘[email protected]
$password = ConvertTo-SecureString -String ‘mypassword!’ -AsPlainText -Force
}
$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<br>&nbsp;&nbsp;&nbsp;&nbsp; Write-Host -ForegroundColor Yellow ‘SideLoading feature is not enabled on the site:’ $siteurl
$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
[/code]

When run, my output looked similar to the following.

PS C:\Windows\system32> C:\scripts\EnableDevOnO365.ps1
To enable SharePoint app sideLoading, enter Site Url, username and password
Site Url: ****
User Name: ****
Password: ****
SideLoading feature is not enabled on the site:
https://MyPubilcSite.sharepoint.com

DefinitionId       :
Context            : Microsoft.SharePoint.Client.ClientContext
Tag                :
Path               : Microsoft.SharePoint.Client.ObjectPathMethod
ObjectVersion      :
ServerObjectIsNull :
TypedObject        : Microsoft.SharePoint.Client.Feature

SideLoading feature enabled on site https://MyPubilcSite.sharepoint.com

This script nicely enabled the necessary feature for me, and then I was able to deploy my solution to my Office 365 site.

4 responses to “Office 365 Small Business “Sideloading of apps is not enabled on this site”

  1. Thanks for the script! It worked very well but I got one errormessage about line 24 ”   &nbsp”. I guess something went wrong while making the blog post 🙂

  2. Can you confirm that this is no longer possible? Tried it on a standard Team Site, as Global Admin, getting access is denied.
    Can create a Developer site and do the work that way, but it seems like this door has been unilaterally shut.
    Posted on TechNet too. /Forums/office/en-US/1865fc0d-940d-465f-a750-1f3eac233e75/sideloading-in-sharepoint-online-still-possible?forum=sharepointadmin

Comments are closed.