A question I received a couple of days ago was if it would be possible to display the share action on a page like the action in the context menu of that page.
Solution
The solution for this is really simple, all you need to do is creating a hyperlink on the page layout and use a JavaScript function call in the href attribute for the click event.
|
|
The function behind this call looks like this:
|
|
This function doesn’t require a lot of code. You’ll just need to be sure that the DisplaySharingDialog function is available, and pass through the following parameters:
- The current URL of the site;
- The list ID of the current page;
- The item ID of the current page. As you can see in the code, these things can be resolved from the _spPageContextInfo object.