none
Assign "Share" functionality to a custom button RRS feed

  • Question

  • I want to assign the OOTB "Share" functionality of SharePoint 2013 to a custom button. How to achieve it.

    VJ

    Saturday, January 18, 2014 6:56 PM

Answers

  • The clientTemplates.js has code that displays the Sharing Dialog. This dialog is implemented in the Sharing.js. Both of these js files are in the layouts directory. If you have the Sharing.js file loaded on your page, then your code could possibly call this code with using the root url, list name, and list id.

    function DisplaySharingDialogForListItem(renderCtx, listItemID) {
        EnsureScriptFunc("sharing.js", "DisplaySharingDialog", function() {
            if (typeof listItemID === "undefined") {
                var listItem = renderCtx.CurrentItem;
    
                listItemID = listItem.ID;
            }
            DisplaySharingDialog(renderCtx.HttpRoot, renderCtx.listName, listItemID);
        });
    }


    Blog | SharePoint Field Notes Dev Tools | SPFastDeploy | SPRemoteAPIExplorer

    Sunday, January 19, 2014 5:26 AM

All replies

  • check the below post you can change the share button by changing the PromotedActions Delegate Control and add your own button with your custom functionality  

    http://zimmergren.net/technical/sp-2013-some-new-delegatecontrol-additions-to-the-sharepoint-2013-master-pages


    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

    Saturday, January 18, 2014 8:49 PM
  • I am not looking to edit the PromotedActions delegate control. I am creating a custom delegate control (contains button). Now, I want to assign the "Share" functionality to that button in custom delegate control.

    VJ

    Sunday, January 19, 2014 5:04 AM
  • The clientTemplates.js has code that displays the Sharing Dialog. This dialog is implemented in the Sharing.js. Both of these js files are in the layouts directory. If you have the Sharing.js file loaded on your page, then your code could possibly call this code with using the root url, list name, and list id.

    function DisplaySharingDialogForListItem(renderCtx, listItemID) {
        EnsureScriptFunc("sharing.js", "DisplaySharingDialog", function() {
            if (typeof listItemID === "undefined") {
                var listItem = renderCtx.CurrentItem;
    
                listItemID = listItem.ID;
            }
            DisplaySharingDialog(renderCtx.HttpRoot, renderCtx.listName, listItemID);
        });
    }


    Blog | SharePoint Field Notes Dev Tools | SPFastDeploy | SPRemoteAPIExplorer

    Sunday, January 19, 2014 5:26 AM