If you have News Posts or News Links in your HubSite and you want to show them in your Associated Site, we have got you covered!
In this article, you will find a step-by-step guide on how to connect ShortPoint Design Elements with your Hub Site News so that you can share the news of your Hub Site on your associated sites.
So, let’s start.
Step 1: Determine the Department ID property
Either in your Hub Site or in your Associated site, open the Developer Tools Console.
In the Chrome browser, you can do this by simply pressing the F12 key.
Alternatively, you can click the right mouse button anywhere on the page and perform these two steps:
1. Select Inspect from the drop-down list.
2. The Developers Tools panel will appear. Inside the Developer Tools, switch to the Console tab and type: _spPageContextInfo.hubSiteId
Your Department ID will now appear below the command. It contains numbers and letters divided by dashes in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (for example, 98b9e3b0-ae82-4fa7-abd4-4e87defb95be).
Copy and paste the Department ID into a text editor and save for later.
Step 2: Prepare the REST API URL
The REST API URL is given below, but before we use it we must make two changes.
The Department ID you have copied in Step 1 should be pasted twice into the URL (replace parts highlighted with blue).
https://tenantname.sharepoint.com/_api/search/query ?querytext='IsDocument:True AND PromotedState:2 AND (DepartmentId:{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} OR DepartmentId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)' &rowlimit=10
Additionally, please substitute the part highlighted in red with your tenant name. Here is an example of what we have used in our case:
https://myawesomecompany.sharepoint.com/_api/search/query ?querytext='IsDocument:True AND PromotedState:2 AND (DepartmentId:{98b9e3b0-ae82-4fa7-abd4-4e87defb95be} OR DepartmentId: 98b9e3b0-ae82-4fa7-abd4-4e87defb95be)' &rowlimit=10
Congratulations. Your REST API URL is now ready.
Step 3: Insert a ShortPoint Element
From the ShortPoint Page Builder, select Simple Lists element and press Insert.
Step 4: Connect
Open the Simple Lists settings by pressing the cog wheel.
Switch to the Connect tab and choose Rest API:
Paste the Rest API URL as created in Step 2 and click Connect.
The Connect button will turn to red Disconnect button if you follow all the steps correctly as shown in the picture.
Step 5: Map the fields
Switch to the Items tab and use the chain icon buttons at the right end of the fields to connect the items.
Choose the necessary columns from the drop down and press Preview to check how your result will look like and/or Update to save the changes.
Result
After you save the page, you will see the connected Simple Lists:
Related articles: