Question

I'm working on customizing the context menu [(...)-menu] of a document library. In line 5 of my code I'm trying to give a link to my new inserted entry of context menu, but the code seems wrong and doesn't work. I would be thankful, if someone of you knows the right code for linking.

<script language="javascript">
        function Custom_AddDocLibMenuItems(m, ctx)
        {
          var strDisplayText = "Say Hello World!";
          var strAction = strDisplayText.link("MY LINK");
          var strImagePath = "";

          // Add our new menu item
          CAMOpt(m, strDisplayText, strAction, strImagePath, strDisplayText.link);

          // add a separator to the menu
          CAMSep(m);

          // false means that the standard menu items should also be rendered
          return true;
        }
        </script>

Additional question: Does somebody know, how to add new items to this code? What kind of "tag" they need?

Thank you very much in advance.

Était-ce utile?

La solution

There are two ways to add this functionality. You can use Custom Action if you don't want to conditionally add the menu, so the menu will appear always for all users, as seen here

If you want to conditionally add the item, then you would use code similar to the one you posted. In this case, the 3rd parameter should point to a JavaScript function. See this post

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top