Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

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});  
share|improve this answer
    
Just spotted that when you answered! Gotta wait 10 minutes before I can accept though! –  Neil Apr 28 at 9:11
    
Intrigued - what's wrong with the use of "as" when casting then Dominic? –  Neil Apr 28 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 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 at 7:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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