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 valueParameter name: contentLinkActual value was ContentReference.EmptyReference."I'm using EPiServer CMS 184.108.40.206 and this is the breakdown of the code that I'm using.
eventPage = contentRepository.GetDefault(eventContainer);
eventPage.Language = new System.Globalization.CultureInfo(language);
eventPage.ExternalURL = "/event_id/" + eventObject.event_id;
eventPage.PageName = eventObject.heading;
eventPage.URLSegment = UrlSegment.CreateUrlSegment(eventPage);
DataFactory.Instance.Save(eventPage, SaveAction.Publish, AccessLevel.NoAccess);
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?
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. :)