SharePoint Dragons

Nikander & Margriet on SharePoint

Monthly Archives: April 2015

Note to Self: Don’t forget to add to indexed properties

If you want to add a property to the spweb property bag, you might want to consider to ad dit to the IndexedPropertyKeys collection as well. This causes the creation of a new crawled property the First time after a full crawl has taken place. The code looks something like this:

using (var site = new SPSite(“http://thesite_coll_url”))


using (var web = site.OpenWeb())


string propKey = “lctest”;

string propValue = “lcvalue”;

                    web.AllProperties[propKey] = propValue;

if (!web.IndexedPropertyKeys.Contains(propKey))