Blog written by:
There are often times when working with SharePoint where you need to find specific content, text or even HTML code throughout the site. Most of the time you rely heavily on either a manual check or search to find what you need. Both of these options can be time consuming and often not return the content you are looking for.
Within the Essential SharePoint Toolkit, you can utilize the “Item Query” feature to find any type of text or content easily. Within one of the pages in the On-premises SharePoint site, a page has been created that contains a SharePoint Script Editor web part with the following code:
This code simply draws a square with a button and text field allowing you to change the color of the square.
If you wanted to find all instances of this code then you would have to manually check page by page. However, with the toolkit you can run crafted queries that will search all content for this. To create this query, open the Essential SharePoint Toolkit and click the SharePoint button on the top navigation.
Next select the Content button from the top navigation, then expand the Discover, menu and select Item Query.
UPDATE: (v22.214.171.124 and later) You can now also select one or more sites from the Home Page Dashboard to perform a Query against them.
From the Item Query window, set the Job Name, and then select the Site URL to Scan.
Next ensure the Credentials are set that match the SharePoint connection that you selected. The bulk of the configuration is then completed within the Query Options section of the Item Query window.
Selecting the first dropdown allows you to set to either Include or Exclude specific queries. The second dropdown allows you to choose how you want to find this data you are searching for by using various properties and the file content itself.
Once you have selected to Include or Exclude, and then the property to search within, you can then determine the comparison from the dropdown.
As with any query in the toolkit you can then also add Inclusion Rules, Email options and Export option. For this simply leave these as the default, so the results are returned within the tool itself. Now Save the job, and then select the Schedule Job button to set the job to run immediately.
Once you have scheduled the job, you will then be taken to the schedule grid where the newly created job is now listed.
Right click on the job and select the Run Now option which will cause the newly created job to run.
Once the job is completed the Job Status will display Complete. Now you can right click, select the View Reports item and then select the Item Query Report.
If needed right clicking on the entry will allow you to go direct to the item itself. In this instance, it will take you to the properties for the page, not the page itself.
You can then take your results and export them to Excel/CSV/SharePoint.
Using the Item Query option, you can be very specific and granular when searching over the content. It is a very powerful feature of the SharePoint Essentials Toolkit.
Latest posts by Liam Cleary - SharePoint MVP (see all)
- How to Cleanup SharePoint User Permissions - July 25, 2017
- How to use Item Query to search for specific text in the SharePoint Essentials Toolkit - July 11, 2017
- SharePoint Essentials Toolkit Review - July 11, 2017