Forum Discussion
Need PNP Search results webpart to display metadata column that I added in a SharePoint library
I have an issue trying to get a SharePoint Doc Library metadata column to show up in PNP Search results webpart. Here are the details:
I have a SharePoint Site where I am just leveraging the default document Library "Documents".
In this Library, there are the default columns "Name", "Modified" etc. I have also created a new Metadata column called "Document type" that holds values "Test" and "Production" as choice values.
I have created two folders in this Lib called "Test Docs" and "Production Docs"
I have configured the library settings such that when user uploads document into "Test docs" folder, the column "document type" automatically gets tagged with the value "test". Similarly when a doc is uploaded to the "Production docs" folder, this column gets tagged with value "Production". See example image below:
- I have then setup PnP Search webparts in a page in this Site. The PnP Search results webpart in this page refers to the "Documents" library above, and to return the results based on the "PnP search box" search.
I am having trouble getting the PnP search results webpart to display the metadata column which I created in the library "Document type".
I need "document type" displayed in the PNP Search results webpart, as I need to restrict user access based on the tag value of the document in this column. So 2 things I am trying to achieve here :
1. Get the "document type" metadata column to appear in PNP Search results webpart, but I am unable to add this column to the PnP search results webpart view. I cant see this column in the list of columns when I edit this webpart (Please advice if I should do some mapping of that document type column to get it to show in the webpart view):Please advice.
2. Once the column is displayed in the PnP search results view, I need to setup the following restriction.
- When a user of country A logs in, they should be able to only see the documents tagged as "Test" in the document type column. Same way if a user of country B logs in, they should only see the documents they are supposed to see (for eg "Production" tagged docs).- I have then setup PnP Search webparts in a page in this Site. The PnP Search results webpart in this page refers to the "Documents" library above, and to return the results based on the "PnP search box" search.
1 Reply
Hello vassp1980
1. map your column to a managed property, here are more informations:
In PnP add the property in page 1 under selected property and use it for more configurations.
2. Set permission on your documents, a search is secuirty trimmed, a user can only see document, he has access.
2.b. Or use a UserProfile property and show documents, when the property will be match with the metadata from the document.
Best, Dave