Feb 22, 2008. Can you please tell me why you removed the using statement for 'SPWeb currentSite = SPContext.Current.Web;' as that's the way I'm working right now. Also topic related, is there a way to activate the Enterprise Site Collection Features at once instead of activating the 10-15 features which are part of the. Feb 09, 2011 Programmatically how to activate the Publishing Infrastructure feature of. Guid of the feature to activateFeature.Parent; SPWeb. May 15, 2013 Hi Paddy74, It’s a site feature, so you can activate the feature using the SPSite.Features.Add() method as your first post. There are two reasons if it. Activate the report server and Power View integration features in SharePoint. Find Report Server Central Administration Feature in the list. Click Activate. Mar 10, 2011 Anyone have a powershell command to activate the sharepoint publishing feature on all sites? I have a lot of sites to enable this on. ![]() ![]() Today, I am continuing my series of posts on how to do basic tasks in SharePoint. Sometimes there is a need to activate a feature on a site collection or site using code. There are various reasons why you want to do this, but in my case, I needed to activate multiple features on multiple sites. The SPFeatureCollection object keeps track of which features are activated on a given site or site collection (not all features available for activation). There are a number of ways to access it. You can use the Features property on a given SPWeb or SPSite object. You can also make use of the WebFeatures or SiteFeatures from SPContext.Current. To activate a feature, call the Add method and pass it the GUID of the feature. Be warned that it will throw an InvalidOperationException if the feature is already activated. As with all SharePoint collections, the only way to determine if it exists is to use the indexer and see if it throws an exception. Here is an example of activating a feature at the site level. Andreas, he removed the using block because he wasn't the owner of the object. SharePoint instantiated that particular object, SharePoint is responsible for disposing of it - if you instantiate an SPWeb using the constructor then you own it, so you dispose of it (likewise if you use SPSite.OpenWeb(url) for instance). If you dispose of SPContext.Current.Web then anything later in the page lifecycle that tries to access the object will not be able to find it and will throw an exception. Roger Lamb's 'SharePoint 2007 and WSS 3.0 Dispose Patterns by Example' blog really helped me get my head round this: You may also want to look up 'stack heap c#' - garbage collection makes it all to easy to develop in c# without understanding memory management! March 11, 2012 5:44 PM I have created a Azure web jobs to provision the site collection remotely. I have registered the app in SPO with Tenant, Taxonomy, Site Collection & Site with Full control privilege. My Azure job is creating the site collection successfully but am unable to create a Term in Term store. I am getting an error - 'Access denied. You don't have permission to access or read this resource':( I am using Term store for Custom Global Navigation for across site collections. Can you please help me on this? I have created a Azure web jobs to provision the site collection remotely. I have registered the app in SPO with Tenant, Taxonomy, Site Collection & Site with Full control privilege. My Azure job is creating the site collection successfully but am unable to create a Term in Term store. I am getting an error - 'Access denied.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
May 2018
Categories |