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

Written by MMMan on. Posted in Development, PowerShell, SharePoint

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 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 = 'me@mytenant.onmicrosoft.com'
   $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

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.

Incoming search terms:

  • Office Web Apps 2013 ExcelWorkbookSizeMax view aspx

Trackback from your site.

Comments (3)

  • Marlou

    |

    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 :)

    Reply

  • Rob Pearmain

    |

    Excellent Post, once I removed the   from the script it ran fine

    Reply

  • amin

    |

    I ran this script successfully, but i receive the error yet :((

    Reply

Leave a comment