El Blanco's Office 2007 Blog

Monday, December 10, 2007

A Bug with CustomAction in the Actions Menu

UPDATE 06-05-08: Check out a posting by The Kid who describes how to get around this issue using a web control instead of the UrlAction element.

UPDATE 12-12-07: I downloaded and installed SP1 for MOSS today, and this problem is still occurring, so it looks as if this wasn't fixed as part of SP1 - I'm still hoping someone will chime in with a brilliant workaround, but I'm not holding my breath :)

I've just found a very irritating bug when using CustomAction elements to extend the UI in MOSS, specifically when extending the Actions menu of a list although I haven't yet tried this with other menus such as the upload menu or settings menu . . .

I've got a custom action with the following definition:

Title="Do something new">

Now, as one would expect, an item is added to the Actions menu on document libraries (and only document libraries, because I've set the RegistrationType and RegistrationId attributes !). If I now navigate to this list, click on the Actions menu, and select my new item it works as expected – brilliant. Behind the scenes SharePoint is doing a little bit if clever trickery and replacing "{ListId}" with the actual GUID of the list in question – great. So the actual URL is something along the lines of:


Now, drop a web part representing the same document library onto your site in SharePoint and configure it to have a toolbar type of "Full Toolbar" so that you get all the nice menus on there too such as the Actions menu where we've added our new menu item. Now click on the new menu item from this menu – disaster !! Unfortunately, for some reason that I can only think is a bug in the product, when you select this new Actions menu item from the web part on your site, SharePoint doesn't replace "{ListId}" with the list's GUID – it just simply leaves it as "{ListId}" which is of no use to anyone !! So your actual URL would be:


Has anyone come up with away around this or know anything about whether this will be fixed in SP1 or not – because this is causing me a headache !!!


  • We already ran into this issue. We spoke with a MS consultant they suggested that we submit a support request. In the meantime the only workaround we found is to implement a custom action class and check if the current list is available in the SPContext. If it isn't then set the action to hidden. The net effect is the action is visible inside the list but hidden in webpart views on the list.

    Hope this helps.

    By Anonymous Anonymous, at 12:08 pm  

  • Anonymous,

    Do you have any code that shows how to do this ? If so can you please give an example - can you email it to blog@blancoworld.co.uk.

    I'll update my post with this information when it's provided.


    By Blogger Chris White, at 12:13 pm  

  • The real way to fix it of course is to install this solution and activate it on your web app


    By Blogger Stephen K, at 9:38 pm  

  • I had similar issue. I fixed it using a Javascript hack. Check it here


    By Blogger Sheetal Jain, at 4:51 pm  

Post a Comment

<< Home