This is a weird one - I have a feature, that when activated loops over a list of other features and activates them - using "Force" :
site.Features.Add(currentFeatureID, true);
This works fine on most sites, but in Document Center sites, where the document ID feature is already activated document sets in the site suddenly show the web parts on the welcome page twice. I debugged it, and it turns out that this happens when the document ID feature is the culprit. However, this doesn't happen if I activate the ID feature using powershell.
My only solution at the moment is to check if the feature is already activated before activating it. This stopped the problem, but doesn't explain it.
Sharepoint Tips And Tricks is Ishai Sagi's sharepoint information blog. It specializes in Microsoft SharePoint technologies, including web parts, development, configuration, customization, and best practices for the use of Microsoft SharePoint Server and Windows SharePoint Services. It also provides some related Office Information, including VSTO and VSTA and other office application development tips.
Monday, May 20, 2013
Activating the Document ID feature by code causes document sets welcome pages to show each web part twice
Sunday, May 19, 2013
Finding if a site column exists in a site, by ID
Scenario - you have an ID of a site column (SPField belonging to SPWeb)and you want to find out if there is a field by that ID in the collection.
Problem: if you try something like:
web.Fields[fieldID] == null
The result is an exception if the field doesnt exist. What a shame.
The solution is to use the Contains method of the Fields collection:
web.Fields.Contains(fieldID)
*Thanks Ofer Gal for pointing this out.
Problem: if you try something like:
web.Fields[fieldID] == null
The result is an exception if the field doesnt exist. What a shame.
The solution is to use the Contains method of the Fields collection:
web.Fields.Contains(fieldID)
*Thanks Ofer Gal for pointing this out.
Subscribe to:
Posts (Atom)