Rohan Gadiya
Rohan Gadiya

Reputation: 338

GetItemByWebDavUrl in anguilla

I'm writing an SDL Tridion Anguilla extension and need to pull a config component using a webdav url. The config also has a set of webdav urls and I need to fetch item Objects for these.

Frank - May be I ate a few words in my question.. I'm writing a CMS GUI extension and writing javascript. So is there something like $models.getItem(); which gives me the component or xml of the component?

Upvotes: 3

Views: 198

Answers (2)

Boris Ponomarenko
Boris Ponomarenko

Reputation: 1324

There is no functionality on the client to resolve items by WebDAVUrl. The only functionality we have is:

var item = $models.getItem(tcmUri);
item.getWebDavUrl();   // will return you WebDAVUrl, if it was loaded before
item.loadWebDavUrl();  // will make async call to load WebDAVUrl. "loadwebdavurl" or "loadwebdavurlfailed" will be fired on the item afterwards

Upvotes: 2

Frank van Puffelen
Frank van Puffelen

Reputation: 598847

In most Tridion Content Manager APIs you can read an item by either its TCM URI or its WebDAV URL.

So if you're using the Core Service, you can simply do:

var item = client.Read(webdavURL, null);

Then you can iterate over the fields (if you're using the Core Service this Fields helper class will come in handy) and do the same for each value in there.

If you need to have the mapping available to the client, you'll need to create a custom web service to make it available. Although not trivial at first, creating a WCF service is not as daunting as some people make it out to be. Especially not when you start with this example of a minimal WCF service for Tridion.

Upvotes: 3

Related Questions