I have this code which works in a farm solution, but not in a sandbox solution.
Is it possible to do this with a sandbox solution?
The table in this link http://msdn.microsoft.com/en-us/library/ff798382.aspx doesnt give (me) the answer.
public class Feature1EventReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPSite siteCollection = properties.Feature.Parent as SPSite;
if (siteCollection != null)
{
SPWeb topLevelSite = siteCollection.RootWeb;
ActivateSharePointServerPublishingInfrastructureFeature(topLevelSite);
}
}
private static void ActivateSharePointServerPublishingInfrastructureFeature(SPWeb topLevelSite)
{
// activating the Sharepoint Server publishing Infrastructure feature at the site collection
string pubFeatureID = "F6924D36-2FA8-4f0b-B16D-06B7250180FA";
Guid PublishingInfraFeatureID = new Guid(pubFeatureID);
topLevelSite.Features.Add(PublishingInfraFeatureID, true, SPFeatureDefinitionScope.Site);
}
}
