Jan 28 2021 02:04 AM
Hi all,
I am trying to use the HCWP to fetch some content from outside the site collection where I have placed the HCWP.
For this purpose I am using a custom query in order to get content from a specific list, this does however not work and no content is shown.
This will most like be caused by me having no idea how to properly make use of KQL.
I am using this query:
Path: https://****.sharepoint.com/sites/*****/<listname>
I found that in another thread that seems to be dead, so I decided open up a new discussion about it.
Does anyone have any idea how to accomplish what I am trying to do, or if it is even possible?
Jan 28 2021 02:17 AM
@miclarsen1 Hello,
Are the sites connected through a Hub site? By connecting sites, you allow data to be fetched between site collections (AKA sites).
Yours sincerely,
Aref Halmstrand
Jan 28 2021 02:52 AM
Using path in custom query still works. You can either use Path or ListID. Follow below steps:
Path:"https://tenant.sharepoint.com/sites/siteName/lists/listName"
OR you can use GUID of your list like:
ListID:aa28e6df-50b3-42a3-9b3f-6f25e2dcc220
You can get the GUID of list from list settings.
Documentation: Use the Highlighted content web part
Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Jan 28 2021 05:46 AM
Hi @ganeshsanap ,
Ok that seems to have done the trick.
There is however one more thing.
Now that content is being fetched by the webpart, two items are shown in the webpart, but there is only one item in the list.
As you can see here, there are two items being shown. The one with the red crossovers is the actual item in the list, but the other one "IT-IT Status", is actually just a link to the list itself and I really dont understand why it is present here.
My guess is that it has something to do with content types, but I can't say for certain.
Jan 28 2021 05:52 AM
Solution
Yes, that is the link to list itself. You can filter it out using below query so that HCWP will only show the list items:
Path:"https://tenant.sharepoint.com/sites/siteName/lists/listName" contentclass:STS_ListItem
Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Jan 28 2021 06:19 AM
Jan 28 2021 05:52 AM
Solution
Yes, that is the link to list itself. You can filter it out using below query so that HCWP will only show the list items:
Path:"https://tenant.sharepoint.com/sites/siteName/lists/listName" contentclass:STS_ListItem
Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.