Copyright ©
Mindbreeze GmbH, A-4020 Linz, 2020.
All rights reserved. All hardware and software names are trade names and/or trademarks of their respective owners.
These documents are strictly confidential. The delivery and presentation of these documents alone does not justify any rights whatsoever to our software, our services and service performance results or other protected rights. The disclosure, publication or reproduction hereof is not permitted.
For reasons of easier legibility, gender differentiation has been dispensed with. In terms of equal treatment, appropriate terms apply to both sexes.
This document describes the integration of Mindbreeze InSpire search applications in Microsoft SharePoint Online.
The descriptions and instructions contained in this document are based on Microsoft SharePoint Online.
Search applications are stored as text documents in Microsoft SharePoint and embedded in pages with the “Content Editor” Web Part. Thus, a search application can be used on multiple pages and still remain easy to maintain.
Copy the snippet from the Mindbreeze InSpire Designer into a text document. Click here for more information: Development of Search Apps.
Upload the document to a document library:
Important Note:
The “Application” object in (searchapp.txt) must include the query parameters “K” of Microsoft SharePoint online:
<script>
Mindbreeze.require(["client/application"], function(Application) {
window.appmb = new Application({ queryURLParameter: "k" });
});
</script>
Copy the address of the document to the clipboard:
Note: The above link is the URL of the document preview page.
Change the URL to the following and copy it:
https://<your-tenant>.sharepoint.com/sites/<your-site>/Shared%20Documents/searchapp.txt
Note: Replace the brackets with your tenant name and site name. Copy the adjusted URL in a new bowser tab and make sure that it is working.
Navigate to “Site Contents” > “Site Pages“:
Create a new “Web Part Page”:
Choose a name and design. Create the page:
Add a new “Content Editor” Web Part:
Note: The “Content Editor” web part is not supported for modern pages (or Sites) according to Microsoft’s official documentation.
To create a classic site, please refer to the following link:
https://docs.microsoft.com/en-us/sharepoint/create-site-collection#create-a-classic-site
Edit the Web Part settings:
Insert the address (adjusted URL) of the text document in “Content Link”, then click “Apply”:
Click “Stop Editing” to finish editing a page: Click
To redirect the search results to a modern site, you will need to add and configure a script editor web part. Please follow these steps:
Important changes needed:
First, include the query parameters of Microsoft SharePoint Online in the Application object (in the code snippet) and export them to the window object. This can be done by adding the highlighted code below:
<script>Mindbreeze.require(["client/application"], function(Application) {
window.appmb = new Application({
rootEL: document.getElementById("mb-custom-searchapp-wrapper"),
queryURLParameter: "k"
});
});
</script>
Additionally, listen to the Microsoft’s search box with “OnSubmitSearch” and redirect the search queries as shown below:
<script>Mindbreeze.require(["client/application"], function(Application) {
window.appmb = new Application({
rootEl: document.getElementById("mysearchapp"),
queryURLParameter: "k"
});
});
window.O365Shell.Search.OnSubmitSearch(function(query) {
window.appmb.setUnparsedUserQuery(query);
});
</script>
Finally, to resolve the CSS conflicts between SharePoint Online and Mindbreeze, you have to point the <link> found at the top of the search app snippet to the minimal-prefixed-adapted.css:
<link href="https://<your-inspire>/apps/designer/../css/v2/minimal-prefixed-adapted.css" rel="stylesheet">
Click on the gear icon “Site Contents”
Click on “Site Settings”
Go to the search section, then click on the “Search Settings” link.
Then we will get into the “Search Settings” configuration page.
Under “Which search results page should queries be sent to?”:
Click on the OK button – then wait for a minute to get the changes affected.
Now, search for something in the top search box and hit enter – you should be redirected to the configured results page.
For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts. In this case, when you open https://{mytenant}.sharepoint.com in a browser, a script from your appliance’s web server is loaded. This script then initiates XHR requests to your appliance, which is not allowed by the CORS policies by default. To allow requests from your SharePoint tenant to your appliance, you need to add your SharePoint tenant in the allowed origins of the CORS settings of your appliance. Configure the following in the Mindbreeze Management Center:
Configuration > Client Services > Advanced Settings
You can find further information in Documentation – Mindbreeze InSpire – CORS Header.
Please note that changing the “Allowed Origins Pattern” option manually will overwrite the default values, see also Documentation – Mindbreeze InSpire – Default values.