3

When I read a component's WebDavUrl via PageData using the Core Service its returning "null"?

var page = (PageData)client.Read("tcm:71-122971-64", new ReadOptions());                
Console.WriteLine(page.ComponentPresentations[0].Component.WebDavUrl);

Is there a different way to get to the WebDavUrl?

6

WebDavUrls of linked items are not read unless you are reading it with correct LoadFlags, like:

var page = (PageData)client.Read("tcm:71-122971-64", new ReadOptions{LoadFlags = LoadFlags.WebDavUrls});  
| improve this answer | |
  • Just spotted that when you answered! Gotta wait 10 minutes before I can accept though! – Neil Apr 28 '14 at 9:11
  • Intrigued - what's wrong with the use of "as" when casting then Dominic? – Neil Apr 28 '14 at 13:26
  • 1
    To me, a cast is always preferred over using the as keyword, since the latter will not throw an exception when the cast is invalid. But if you will always check if your object returned is not null, then you can just as well use the as keyword. – Bart Koopman Apr 28 '14 at 13:32
  • 1
  • I see Bart and David have already provided good input. For the full discussion - rants and all... see meta.tridion.stackexchange.com/q/168/129 :-) – Dominic Cronin Apr 29 '14 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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