This article helps in retrieving the Checked Out documents of the current user from the entire Site collection using a Content Search web part in SharePoint 2013.
Please use the following procedure to retrieve the documents using the content Editor Web part.
- Before adding the content editor web part to the page, we need to do some pre-configuration.
- We need to add a metadata property with the name “CheckOutuser” to retrieve the Checked our documents.
- To add a metadata property at the Farm level then go to Central Admin then click Manage service applications under Application Management then select Search Service Application then click Search Schema under Queries and Results.
To add a metadata property at the Farm level in SharePoint 365 go to SharePoint Admin Center then click Search in the left Navigation then click Manage Search Schema.
- You will be redirected to the managed properties page. Click New Managed Property.
- Provide the Property Name as “CheckOutUser”, provide any description, select the Type as Text, Check Searchable, Queryable and Retrievable.
- Under Mappings to crawled properties select Include content from all crawl properties and then click on Add a mapping.
- After clicking on Add a mapping you will get a Crawled property Selection dialog. Under Search for a crawled property name, enter the text “check” and click on find.
The result will be displayed in the following tab. Select “ows_CheckoutUser” and click OK.
- Once the Property is Mapped click on the OK button. A new a metadata property will have been created with the name CheckOutuser. After creating this metadata property a full crawl is required.
- Now navigate to the page where you need to add the Content Search web part. Edit the page click on Add a Web part, under the categories tab in the web part gallery select Content Rollup and then select Content Search and click on Add.
- Once the Web part is added to the page, edit the web part, you will get a Content Search property window. Click on Change Query.
- A Query Building Dialog will be displayed. Click on Switch to Quick Mode.
- In Switch Mode select the Documents (System) in Select a Query property and select Current Site Collection to retrieve documents from the entire site collection. To retrieve only from the Current Site then choose Current site and Don't restrict results by app will retrieve from the entire web application level.
- Once setting the Restrict by app click on Switch to Advance Mode. In advanced mode under property filter select show all Managed properties then all managed properties will be displayed. Select the created metadata property “CheckOutUser” from the list. And set the query as “CheckOutUser contains Name of the user who runs the query”.
- Once the query is formed click on Test Query to get the result in the Search Results Preview.
- The document that is checked out by me is displayed in the preceding preview. Click on OK then save the web part, you can customize your web part based on your requirements from the web part properties.
- the retrieving of Checked Out documents from the Site collection level using a Content Search web part is done.