I forgot to mention that it works to create a "fr" version of the page, if there is already a "en" version. Tried the other way around and it didn't work.
To create a page in a certain language you add the cultureinfo as a parameter to GetDefault.
contentRepository.GetDefault<StartPage>(eventContainer, new CultureInfo(language));
Btw, the UrlSegement is automatically set to pagename when saved. (If it's empty..)
Thanks! Actually just found it by myself also. :)
I'm using a multi-site solution and one of the sites is in "en", "fr" and "nl". I can create a page under my designated parent on "en" but not on "fr" or "nl" even though the parent has at least a "fr" version.
I get this exception when I try to save the new page:
"ContentReference was not set to a valid value
Parameter name: contentLink
Actual value was ContentReference.EmptyReference."
I'm using EPiServer CMS 22.214.171.124 and this is the breakdown of the code that I'm using.
I've removed some code that fills in some more fields but I guess this is the more important part of the code.
Anyone that have had a similar problem?