Freigeben über


How to find all managed properties of a document

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

  • Anonymous
    January 01, 2003
    Hey Matt,did the integration, see for yourself http://melcher.it/s/1MDo a search, switch to primary results, click on the link "show all properties" below a hit and you see all properties in one go.CheersMax

  • Anonymous
    December 10, 2013
    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".

  • Anonymous
    December 11, 2013
    @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 :)

  • Anonymous
    December 12, 2013
    Amazing article...I like this.Getting the exact information with wonderful details..Keep sharing.. Follow our Site also:- http://investormart.co.in/

  • Anonymous
    March 12, 2014
    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

  • Anonymous
    January 25, 2016
    The comment has been removed

  • Anonymous
    February 23, 2016
    Attempting to use the POST method to overcome URL length when pasting all of my managed properties in! But get a 400 error "The search request cannot be empty". It isn't empty? Any advice greatly appreciated.