Forum Discussion
HCWP - Custom query from selected site
- Jan 28, 2021
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_ListItemPlease 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.
Using path in custom query still works. You can either use Path or ListID. Follow below steps:
- Edit HCWP and Select Custom query.
- In Source dropdown, choose Select sites.
- Select the site you want to target by searching or entering URL
- In Query text (KQL) add query like given below and click Apply.
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.
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.
- ganeshsanapJan 28, 2021MVP
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_ListItemPlease 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.
- miclarsen1Jan 28, 2021Brass Contributor