_spBodyOnLoadFunctionNames.push('MyLinksMenu.init'); not getting added

Feb 13, 2013 at 2:07 PM
Edited Feb 13, 2013 at 2:13 PM
I have followed all the instructions properly to deploy the WSP given in the site.

I deployed it in DEV using VS2010 as well as WSP package and it works like a charm.

Then I went a head and deployed it in Test and found the My Link in the landing page missing.

I verified everthing:

1) The features are deployed at Web Application level and are activated.
2) The feature is active at site collection level.

3) All the folder structures have been created.
4) The files are present.
5) The .Js file is present.
6) Config file has been modified.
7) Profile is running ( No errors reported during activation).

What I found after some research is after the page load in DEV environment there is the Javascript code which is present that does the trick. (frow View Source)
But in the Test environment that is not the case. The Javascript as in DEV:
<script src="http://devia2010/_layouts/MyLinksMenu/MyLinksMenu.js?rev=2" type="text/javascript"> </script> <script type="text/javascript">
var MyLinksMenu = MyLinksMenu || {};MyLinksMenu.rootSiteText = "$Resources:MyLinks_RootSite;";MyLinksMenu.addToMyLinksText = "$Resources:MyLinks_AddToMyLinks;";MyLinksMenu.manageMyLinksText = "$Resources:MyLinks_ManageMyLinks;";document.onreadystatechange=fnRemoveAllStatus; function fnRemoveAllStatus(){removeAllStatus(true)};var __SafeRunFunctionLoadedScripts = new Array();function SafeRunFunction(fnc, script,
is missing in test

I doubt that _spBodyOnLoadFunctionNames is not working.
Please let me know what could be the case and why does it work in DEV and not TEST or UAT.

Needless to say I deployed it in UAT hoping that my TEST env may not be stable for some reason.

Need to hear desparetely as I am struck on this for sometime.
My business is on my neck why I am taking so much time on this small thing.

Feb 13, 2013 at 2:55 PM

[SharePointPermission(SecurityAction.Demand, ObjectModel = true)] <---------------> Failure Point 1
    protected override void CreateChildControls()

        if (this.Visible)      <-------------------> Failure Point 2
                                                           string scriptGuid = "acc6930b-56c5-4ae0-ae12-ddba66a9dd82";
            string scriptKey = scriptGuid + "/MyLinksMenu.js";
            string languageScriptKey = scriptGuid + "/Language.js";

            if (!Page.ClientScript.IsClientScriptIncludeRegistered(scriptKey))  <----------------------------> Failure Point 3
                Page.ClientScript.RegisterClientScriptInclude(scriptKey, WebUrl + "/_layouts/API.MyLinksMenu/MyLinksMenu.js?rev=2");

            //This is needed to pass our JavaScript code the localized text needed for the dialogs
            if (!Page.ClientScript.IsClientScriptBlockRegistered(languageScriptKey))
Which is the most likely point.
Why the .Js file not getting added.

Feb 13, 2013 at 3:05 PM
Hi Sambit,

When an error occurs within a GlobalSiteLink delegate control (which is what the My Links Menu is using to insert itself into the page), SharePoint will hide the error and not render the control. I'm guessing that's what's happening in your case. I think your best bet is to look through the ULS logs for an error message containing the text "MyLinksMenu", "GlobalSiteLink", or "DelegateControl". If you're able to locate the error message it should shed some more light on the problem.

Feb 13, 2013 at 3:15 PM
Never mind, it looks like you found the problem. :)

Did you change the control so it's no longer deployed to the GAC? If so, it seems to be a problem with code access security. I haven't work with that much in SharePoint so I can't be much help in that area.