I have found this blog Adding a Blog to an Existing Site
I would like to know if there is something similar for SP in cloud (O365)?
I tried to add but Feature with Id ‘0d1c50f7-0309-431c-adfb-b777d5473a65’ is not installed in this farm, and cannot be added to this scope.
That is true even the blog site template doesn’t have feature for blog. Since I have created team site and now they are asking for blogs (created as subsite) but would like to know if and how this could be added to the existing team site. This could be posible only on prem.
It’s actually scoped to Web:
<?xml version=”1.0″ encoding=”utf-8″?>
<Feature Id=”0D1C50F7-0309-431c-ADFB-B777D5473A65″
Title=”$Resources:core,blogContentFeatureTitle;”
Description=”$Resources:core,blogContentFeatureDesc;”
Version=”15.0.0.0″
ImageUrl=””
Scope=”Web”
Hidden=”TRUE”
DefaultResourceFile=”core”
xmlns=”http://schemas.microsoft.com/sharepoint/”>
<ElementManifests>
<ElementManifest Location=”Elements.xml” />
</ElementManifests>
</Feature>
That said, I do not see this feature at all on my blog on my O365 My Site.
There is no farm scope in O365, only web and site.
This is why I was asking what is the way of doing this in cloud.
The code to to this is listed in the comments section of that blog post.
function ActivateWebFeature(web) {
var guid = new SP.Guid(‘{0d1c50f7-0309-431c-adfb-b777d5473a65}’);
var featDefinition = web.get_features().add(guid, true, SP.FeatureDefinitionScope.farm);
}
var context = new SP.ClientContext.get_current();
var web = context.get_web();
//Activate Features
ActivateWebFeature(web);
context.load(web);
context.executeQueryAsync(
function () {
window.console && console.info(“Featured activated for Web: ” + web.get_serverRelativeUrl());
},
function (sender, args) {
window.console && console.info(‘Error: ‘ + args.get_message() + ‘\n’ + args.get_stackTrace());
}
);