Search Guys

Everything search, including product commentary and guidance, search strategies and general technical guidance

How to find all managed properties of a document

How to find all managed properties of a document

  • Comments 5
  • Likes

When working with SharePoint search it is often helpful to figure out all of the managed properties that are populated for a given set of documents. With SharePoint 2013 on premise, you can use the Content Enrichment Web Service (CEWS) and its debug mode to get at (almost) all of the managed properties for a document as it is being indexed.  This requires a bit of setup to get the web service in place and then you need to feed your documents in to be indexed.  But what if you are interested in items already indexed? Or what if you are working with SharePoint Online where you don't have the CEWS?

SharePoint 2013 has a managed property called "ManagedProperties" that can be used instead. The ManagedProperties managed property is populated with the names of all the managed properties that have values for that document. The only trick is that this managed property is not retrievable, it can only be used as a refiner. 

You could add this refiner to your search center, but I have found it much more useful to explore using the SharePoint 2013 Search Query Tool and PowerShell.

To get started, download and fire up the Search Query Tool. Authenticate with you site and set up a query that returns the document(s) you are interested in.  Open a PowerShell window.

In the Query block of the Search Query Tool application configure the Refiners to be

managedproperties(filter=600/0/*)

and re-run your query. On the Refinement Results tab you should now see the managedproperties refiner that will have a big list of refinements. For example:

clip_image001

Scrolling through this list can often be helpful in itself, but sometimes it is nice to be able to see the values of all these managed properties and hand cutting-and-pasting can be quite cumbersome. The following technique can be used to make things much easier.

Go to the Raw tab and at the bottom you will see a big bunch of JSON like:

clip_image002

Select and copy all of the JSON. Now open PowerShell:

$obj = $obj = ConvertFrom-Json (Get-Clipboard)
$r = $obj.d.query.PrimaryQueryResult.RefinementResults.Refiners.results | `
         ? { $_.name -eq 'managedproperties' }
$names = $r.Entries.results | % { $_.RefinementName } | sort
$names -join "," | Out-Clipboard

And now you can paste the list of mps separated by commas. Go back to the Search Query Tool and paste the list into the Select Properties box and run your search again. On the Primary Results tab you'll now see all of the (retrievable) managed properties. (Note: some managed properties still won't have values because they have been configured to be non-retrievable.)

clip_image003

Comments
  • Great article - I already love this.

    IMHO the search query tool should be extended to cover that functionality! I will try that over the hollidays...

    Cheers & thanks for sharing!

    Max

    p.s. The page title is missing a "get".

  • @MaxMelcher Yes, it'd be nice to have this wrapped up in the tool itself although I'm not sure how it would fit in.  Oh and I fixed the title :)

  • Amazing article...I like this.Getting the exact information with wonderful details..Keep sharing..

    Follow our Site also:- http://investormart.co.in/

  • Hey Matt, did the integration, see for yourself http://melcher.it/s/1M Do a search, switch to primary results, click on the link "show all properties" below a hit and you see all properties in one go. Cheers Max

  • If you are doing this on SharePoint Online (and perhaps on-prem in the future), the feature has been sort of removed....but it's fixable if you read my post: http://techmikael.blogspot.no/2014/03/debugging-managed-properties-using.html

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