Forum Discussion

Zhuolil's avatar
Zhuolil
Copper Contributor
Oct 25, 2022

Adding Share Button to PnP Search Result web part custom layout

Hi, I have a PnP search result web part that has a HTML/Handlebar custom result layout that was modified from the slider template. Is there any way I could add a Share Button that triggers the typical file sharing pop up in Sharepoint?

 

I am able to add a Share button to adaptive cards in gallery view in Sharepoint lists using the following code and have it working in a document library web part: 

 
{
"elmType": "button",
"txtContent": "Share",
"attributes": {
"class": "ms-bgColor-themeDark ms-bgColor-themeDarker--hover"
},
"style": {
"border-radius": "16px",
"border": "transparent",
"color": "white",
"cursor": "pointer",
"padding": "4px 12px",
"margin-right": "4px",
"opacity": "0.85",
"font-size": "14px"
},
"customRowAction": {
"action": "share"
}
}

 

But I couldn't figure out how to do that on HTML/Handlebar custom result layout in PnP search result... I have been search though mountains of pages but couldn't find any answer. Unfortunately for that particular part of the page, a search feature is required so I have to use PnP Search

Could anyone help with this? Thanks a ton in advance!

No RepliesBe the first to reply

Resources