Categories
Automation Classification Data Intranets

Easy Route to Hybrid Search in Sharepoint

Bringing content from applications that aren’t indexed by Sharepoint search can be expensive, complex, and fraught with unknown variables. Follow this guidance to quickly populate your index with such external content without having to go down the Graph/Cognitive Search route…

This post will clearly show you the steps to accomplish this:

  1. On a Sharepoint site, create a custom list with columns for title, ID, description, URL, and optionally enterprise keywords
  2. Populate the list with items from your external app
  3. Optionally, set up an automation to add/edit/delete items from the list when they change in the external app
  4. Add a script to your list item view which redirects to the URL column

In the guidance that follows, we’ll create list items which should appear in search results as in the image above…

Create a custom list

Head to, or create a Sharepoint site that promotes your external app; this is an important step as the site will appear under each item’s title in the search results – in our example ‘Our Projects’.

Populate the custom list with at least the following columns:

  • Title
  • ID
  • Description
  • Calculated ‘URL’ column based on the ID
  • Enterprise keywords

Populate your list

Switch to ‘edit in data view’, and paste in values from your external app – you should be able to populate these from a CSV file. Pause while Sharepoint indexes your list, and check to see if the results are coming through in search results as you expected.

They ought to be; problem is, clicking on the results will take you to the list item, not the item in the external application. Do check the URL; make sure this is the place you want people to be going when they click on item. We’ll sort that out as the last step in the guidance; before that, you may want to set up a flow to populate the list with new items…

Update your list on the fly

There are a variety of ways to use Power Automate to keep your list synchronised with your external application. First step is to set up a trigger or schedule so that if something gets added then:

…then ‘create item in Sharepoint list‘:

You might want to set up parallel actions to ensure when something gets modified or deleted in the application, your respective list items also get modified/deleted.

If you’ve not too many items in the list, an easy kludge is to first delete all items in the list, then re-populate it – on say a weekly basis.

Set up a redirect

The previous steps should be relatively easy to accomplish; the next one, though a doddle to do, was tricky for us to write the right code – it uses an obscure javascript feature that allows you to call a function when an image is loaded.

Then ‘Return to classic Sharepoint’ (the link is at bottom-left), and edit the list item view:

Add a script web part to the bottom of it, ‘edit snippet’ and paste the following code into it:

<script>
function Redirection()
{
window.location.href = document.querySelector('table.ms-formtable tr:nth-child(4) td:nth-child(4)').textContent;
}
</script>
<img onload="Redirection();" src="https://example/URL-to-a-1px-image.png" width="0" height="0" />

If your URL column is the fourth, then all you need to change there is the URL to the image. Suggest either uploading a tiny 1px image, or linking to a small image that will already be in the user’s cache – perhaps from your intranet homepage.

Save, then click on one of the items from your search results – it ought to take you to directly to your external application.

Be careful when editing that snippet – you’ll need to disable Javascript in your browser if you want to edit it in future.

Leave a Reply

Your email address will not be published. Required fields are marked *