Responsive Ads Here

Friday, May 1, 2015

Enabling the Developer Site Collection Feature in SharePoint On-premises / Online

In SharePoint 2013 we have a new site template called Developer Site Template, It is a site template which is used extensively for App development and you can only deploy apps for SharePoint to a Developer Site.

Developers can build, test and publish their apps here. Here you can deploy apps for SharePoint from Visual Studio 2013 to the developer site and you don't need to create an App Catalogue site since the developer site template by default creates an App Catalogue library. The developer template is available under the collaboration site template.

In one of the project, I got a scenario where I need to enable the developer site collection feature for a existing site collection it may be team site or publishing site. There isn't a button in the site collection features to let you enable this. 

If you were on premises environment, you'd just run the below command to enable the feature.

Enable-SPFeature e374875e-06b6-11e0-b0fa-57f5dfd72085 –url http://sp.contoso.com

But we can't do the same thing in SharePoint on-line site as the power shell commands doesn't expose the ability to turn features On and Off.

For this I have found a nice tool SharePoint Client Browser. It has an extremely useful feature to open up Power Shell with CSOM already loaded.

Find the step by step process to enable the feature mentioned below.

1. Click on SharePoint Client browser or run with admin privileges you can find Tenants and site collections. You can add by right click on any one of option. I am adding my site collection by giving user details. 



  
 2. One the authentication has been done, it will show the site collection like below image.

  



 3.  Right click on the site collection, it will show the option as Open Power Shell with CSOM.

    




Click on that it will open the power shell window as shown below.




It will ask the password again. Once you give the password, it will authenticate and show the sample code snippet also like below.




In the above screen grab,  we are able to see the sample code which will display the current site title and URL.



In the above screen grab,  I am loading the site and getting the feature id and adding the feature to the site. Find the complete snippet mentioned below.

$ctx.Load($ctx.Site);
$ctx.ExecuteQuery();
$guid = [System.Guid]"e374875e-06b6-11e0-b0fa-57f5dfd72085"
$ctx.Site.Features.Add($guid,$true,[Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$ctx.ExecuteQuery();

For more details go through the below mentioned URL's.

http://blogs.msdn.com/b/kaevans/archive/2013/10/05/enabling-the-developer-site-collection-feature-in-sharepoint-online.aspx

https://mysharepointsolution.wordpress.com/2015/01/06/publish-app-to-non-developer-site-collection/

 Hope this post will helpful.

No comments:

Post a Comment