The new In-Place record declaration functionality in SharePoint 2010 is a nice feature, but once you use it in a farm for a while, sooner or later users will need to find items that have been declared records. Out of the box, there’s no way to do that. Taking a look at my previous post on how SharePoint handles records under the covers gives you what you need to expose those records, and an easy way to do that is using SharePoint search. (FAST would be similar to below, but these steps are for SharePoint Search.)
This wouldn’t normally involve an entire “search center” within SharePoint, so I’ll be creating a simple web part page and walk through the configuration necessary to enable searching on declared records.
Create a managed property
As we learned in part 1 of this series, there are two properties that are used by SharePoint when an item is declared a record. The field _vti_ItemHoldRecordStatus looks promising, but it is hidden. Unless someone teaches me how to create a crawled property on a hidden field, we can’t use that. The other option is _vti_ItemDeclaredRecord, which is the timestamp of when the item was declared. Luckily, it is cleared out when the item is undeclared, and it is not hidden. Which means we can use it to create a scope to narrow down our records!
- Open up Central Administration and go to Application Management, Manage Service Applications
- Click on your search service application to manage it
- In the left nav, click on Metadata Properties
- In the top of the list, click Crawled Properties
- Do a search for itemdeclaredrecord. If you find a property with the name ows__vti_itemdeclaredrecord, move on to the next step. If not, go declare a record in your farm and kick off a full crawl.
- In the top of the list, click on Managed Properties
- Click New Managed Property
- Name the property “ItemDeclaredRecordDate”
- Type of Date/Time
- Add a mapping to the ows__vti_itemdeclaredrecord crawled property
- Check Available for use in Scopes
- Click OK
- Kick off a full crawl
Create search page
Now we need to create the page users will access to search for items declared as records, based on the property we created above.
- Navigate to a site where you want to provide this functionality and create a new page (any layout will do as long as it allows web parts )
- Edit the page and add two web parts (you can add more to your desire and needs):
- Search Box
- Search Core Results
- Edit the Search Box web part
- Under the Miscellaneous section, set the Target search results page property to be the URL of the page you are on (or a different results page if you’re creating a separate results page)
- Edit the Search Core Results web part
- Under the Results Query Options section, set the Append Text to Query value to ItemDeclaredRecordDate>”1/1/1900″
- Save & Exit
All done. You now have a page that should only return declared records in the search results!