Friday, February 27, 2009

Passing list item ID from SharePoint custom context menu item

We had to add a new menu item in the SharePoint ECB menu in one of our form library. We added it using a simple javascript as specified here. We were able to see the newly added menu item in all the SharePoint list items kept in the form library.

The issue was, We had to pass the ID field of the list item as a parameter to a custom .aspx, which we were redirecting while clicking the new menu item. It was required to find, in which item the menu was clicked. After spending some time with this investigation we found its very simple and straight forward.
"currentItemID" was giving the value. We can even retrieve the list item name using "ctx.listName". Here is the code we used

1 comment:

Anonymous said...

Can item id be used in the url of a file posted on sharepoint? because a change in file name,changes the url andbreaks the link.