New answers tagged

1

Do not explicitly (or via using) call Dispose() on the SPSite.RootWeb property. The dispose cleanup will be handled automatically by the SharePoint and the .NET framework. For existing SharePoint customizations removal of explicit RootWeb Dispose is recommended to avoid an edge case condition where the SPContext.Current.Web has equality to the ...


1

The code is wrong. You need to use using directive only with objects that you created yourself. The code would be correct in this case: private void AddTaxonomyField(SPSite site) { using (SPWeb web = site.OpenWeb()) //need "using" because you opened the SPWeb yourself { } } This code would dispose of the web object at the end of using ...



Top 50 recent answers are included