none
User Custom Actions not working in Version 2016

    Question

  • Hi Experts,

    this Issue is about SharePoint-Online 2016.

    I deployed some ScriptLink through User Custom Actions (Web) and a link to Location Microsoft.SharePoint.SiteSettings.

    None of these are working. From the Development-Tools in Edge i can see that the Script-Files are not loaded.

    If I Change the UI to Classical View everything is working as expected.

    Am I missing some new Rules in 2016?

    Hope you can Help, Best Regards, Ronny

    Tuesday, July 26, 2016 6:40 AM

All replies

  • Hi Ronny,

    Could you please share how you deploy the ScriptLink for us to reproduce this issue?

    And as a workaround for now, you can add the JS reference in master page.

    https://blogs.msdn.microsoft.com/nishantranacrm/2013/12/10/referencing-sp-js-inside-the-custom-master-page-in-sharepoint-2013/

    Best Regards,

    Victoria 


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, July 28, 2016 9:51 AM
    Moderator
  • Hi Victoria,

    sorry about my late Response. These are busy times :)

    Custom Actions are Installed over SSOM, CSOM & JSOM (depends on Product and Platform).

    Please note that this is working in Production (SP2013 On-Premise & SP 2013 Online) since two years!

    During our Tests on SP 2016 to identify if we might have a Migration issue we run into mentioned Problem.

    Here is one (JSOM) Code snippet to install a css-link as UCA to a Web:

    var caClientContext = SP.ClientContext.get_current();
    var oWebsite = caClientContext.get_web();
    var collUserCustomAction = oWebsite.get_userCustomActions();
    var oUserCustomAction = collUserCustomAction.add();
    var oUserCA3 = collUserCustomAction.add();
    oUserCA3.set_location('ScriptLink');
    oUserCA3.set_sequence(10120);
    oUserCA3.set_title('CompanyAccordionCssLink');
    oUserCA3.set_description('This has link-Reference to Root-Web Style Library SP2013Accordion.css.');
    var scriptBlock = "var headID=document.getElementsByTagName('head')[0];";
    scriptBlock += "var newScript=document.createElement('link');";
    scriptBlock += "newScript.type='text/css';";
    scriptBlock += "newScript.rel='stylesheet';";
    
    var webServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl;
    if (webServerRelativeUrl === "/") {
    	// No sub site, just root.
    	scriptBlock += "newScript.href='" + _spPageContextInfo.webServerRelativeUrl + "Style Library/Company CSS/SP2013Accordion.css';";
    }
    else {
    	// the subsite has no trailing end of /.
    	scriptBlock += "newScript.href='" + _spPageContextInfo.webServerRelativeUrl + "/Style Library/Company CSS/SP2013Accordion.css';";
    }
    
    scriptBlock += "headID.appendChild(newScript);";
    oUserCA3.set_scriptBlock(scriptBlock);
    oUserCA3.update();
    
    caClientContext.executeQueryAsync(
    function () {
    	alert("CompanyAccordionCssLink has been successfully added.");
    },
    function (sender, args) {
    	alert("Request to add User Custom Action CompanyAccordionCssLink to Web failed. " + '\n' + args.get_message() + '\n' + args.get_stackTrace());
    });
    Please note that none of the UCA will be loaded (Remeber: Production-Code working in 2013)

    Due to the Major changes in 2016 (e.g sidenavbox => <nav>-TAG) it seems that the guys in Redmond changed API and Interface?

    Please involve somebody with Knowledge on this.

    With Best Regards, Ronny

    Wednesday, August 17, 2016 6:18 PM
  • Any News?
    Tuesday, August 23, 2016 2:24 PM
  • Hi Victoria,

    did you found some time to look into it?

    Best Regards, Ronny

    Friday, September 2, 2016 10:56 AM