SharePoint serendipity is the effect by which one accidentally discovers something fortunate, especially while looking for something else entirely. In this case, it is the occassional musings, observations, and Ouija board readings about the phabulously

Finding Which Crawled Property Data Types Match a Managed Property Data Type in SharePoint 2010

Finding Which Crawled Property Data Types Match a Managed Property Data Type in SharePoint 2010

  • Comments 1
  • Likes

Not sure how often this will come up, but it was something that took me a while to track down so I thought I'd share here.  Suppose you are working with a ManagedProperty in SharePoint search, and you want to look at mapping it to a crawled property.  Now a managed property usually just has one of about 5 basic data types:  Text, Integer, Decimal, DateTime or YesNo.  That ManagedType property of a ManagedProperty doesn't have a corresponding "thing" on a CrawledProperty though.  Fortunately, there is a helper function.  The Schema class as a static method called IsMappable.  You pass to it a ManagedDataType, which a ManagedProperty uses, and a VariantType, which a CrawledProperty uses.  The net is a list of CrawledProperty items with a compatible data type for a ManagedProperty.  Here's a quick little LINQ snippet I wrote to retrieve a list of CrawledProperty items that could be used with a ManagedProperty:

//look for all crawled properties that match the data type of our mapped property

props = from CrawledProperty cp in c.GetAllCrawledProperties
where Schema.IsMappable(DataType, cp.VariantType)
select cp;


The fabulous formatting effects are free courtesy of this awesome blog software we have here.  In this case, "c" represents a Category, which I also got from the Schema class - mySchemaInstance.AllCategories.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment