Developer Forum »
Method WAFSession.ContentExists
9 posts

Hello

How can I check whether a given culture exists for some content? That is, I have content which exists in some lcids (1044), but not in others (1053).

I have tried to used this method in WAFSession:

public bool ContentExists(int nodeId, int lcid);

But this method returns true even if the content does not exist in the given lcid.

E.g:

bool existsInLanguage = WAFContext.Session.ContentExists(nodeId, lcid);
(the context is Edit)

So why does it return true? And if I can't use this method, which one can I use?

Guro

120 posts

Hi, use "content.IsDerived"

It will return true if the content does not have content in the selected language. (and it is therefore "Derived" from another content)

So, to check do this:

var lcid = 1044;

var content = WAFContext.Session.GetContent(1010, lcid)

var hasLanguage = ! content.IsDerived;

1