I am working with SharePoint 2010 and ECMAScript.
I have added a customaction to the context menu of a document inside a document library.
how is it possible to retrieve the full path url of the document using ecmascript?
i was trying something like this (but it fails if im in a subsite or site collection)
my custom action:
<UrlAction Url="javascript:OpenDialog('Miopiaggo/shoot.aspx?id=' + '{SiteUrl}' + document.getElementById({ItemId}).firstChild.getAttribute('href'),'shooter');"/>
and my opendialog function is:
function OpenDialog(dialogPage,dialogTitle) {
var options = SP.UI.$create_DialogOptions();
options.url = SP.Utilities.Utility.getLayoutsPageUrl(dialogPage);
options.url += "?Source=" + document.URL;
options.title = dialogTitle;
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
SP.UI.ModalDialog.showModalDialog(options);
}
The problem, the querystring that is supposed to get me the full path of the document url is not good, its messed up with duplicates when i am in a subsite or site collection.
Try the solution presented on Jan Tielens blog posting about USING THE CURRENT PAGE URL IN THE URLACTION OF A SHAREPOINT FEATURE.
Hope that helps.