I'm trying to retrieve the webdav url of a component using Anguilla but i see the value to be retrieved as undefined. As suggested by Nuno i'm using

var x = frames[0].$models.getItem(“tcm:1-123”)

Not only this function but rest all are also resulting as undefined.enter image description here

I'm using the below code in the js file as suggested in stackoverflow question https://stackoverflow.com/questions/14082844/getting-the-webdavurl-from-tridion-anguilla-in-the-list-view

    Extensions.CopyUri.prototype._execute = function CopyUri$_execute(selection) {
    selectedItem = selection.getItems()[0];
   // prompt("Copy the Item ID using Ctrl/Cmd + C:", selection.getItems()[0]);

var item = $models.getItem(selectedItem),
    webDavUrl = item.getWebDavUrl();

if (!webDavUrl) {
    // WebDavUrl for cached item hasn't been loaded yet, so lets load it.
    $evt.addEventHandler(item, "loadwebdavurl", function (event) {
        webDavUrl = item.getWebDavUrl(); // also could do event.source.getWebDavUrl()
prompt("Webdav Url is ",webDavUrl);

1 Answer 1

var item = window.top.frames[0].Tridion.getApplicationWindow().$models.getItem("tcm:1-123");


1\ you should use application window context to get an access to you repository.

var appWindow = window.top.Tridion && window || (function (i, win) { while (!(win = window.top[i++].Tridion)) { }; return win && win.getApplicationWindow();})(0);

2\ shortcuts should also be used in this context

appWindow.$evt.addEventHandler(item, "loadwebdavurl", function (event) { console.log(item.getWebDavUrl()) });

3\ and then load item

  • Thanks Beardcore..The above solution worked while debugging on chrome console but still i have issues when i put the code in the js file. I'm getting undefined.
    – Sam
    Feb 18, 2015 at 11:29
  • I can assume that you execute item.getWebDavUrl(); right after load. But load request is done asynchronously, you should track it with $evt.addEventHandler(item, "loadwebdavurl", onLoadcallback); Feb 18, 2015 at 11:36
  • I updated with latest source code where i'm loading the events
    – Sam
    Feb 18, 2015 at 11:58
  • This doesn't seem to work for me. item.getWebDavUrl() returns undefined. With item.loadWebDavUrl() and $evt.addEventHandler(item, "loadwebdavurl", function (event) {webDavUrl = item.getWebDavUrl();}); also returns undefined. Any idea what to do? Mar 30, 2022 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.