Blogger

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

    Recent items

Login

Thursday, 17 October 2013 17:45

My first Office365 App

Today, I started to develop and deploy my first App for SharePoint online into Office 365.

After the creation of some test files, it would be the time to deploy the app and Visual Studio shows me the first error:

"Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site."

After some searches on google, I understand that I need to enable an hidden feature if I want to use the development site. I need to download and install the "SharePoint Online Management Shell".

I've installed it, i've run and I've received another error (now from the SharePoint online powershell):

"Import-Module : Could not load type 'Microsoft.SharePoint.Administration.SiteHealth.SiteHealthStatusType' from assembly 'Microsoft.SharePoint.Client, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'."

At this point, google does not help me.

The solution is to NOT use the SharePoint online shell directly but from the SharePoint 2013 Management Shell and use this script:

Show/Hidden bash code

View source
 
 
 
#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'
 
 $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
 
 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
 
 
 

 

 

Published in SharePoint