Try our conversational search powered by Generative AI!

When saving several pages from code, how to set default wokring page in cms 7.19



we are saving pages from code but when looking in cms we can´t see the latest saved version

how do we set the latest saved version to default ?



Apr 14, 2015 15:49

theres is a option in online center named "Setting the primary draft", but how to set it in code behind?

Apr 14, 2015 16:44

IContentVersionRepository has a method SetCommonDraft.

Apr 14, 2015 17:05

Thanks Per!

this is what i had to do:

producLink is my contentreference

var versionRepo = ServiceLocator.Current.GetInstance<IContentVersionRepository>();

var latestVersion = versionRepo.List(productLink).Last().ContentLink;

// get the last item in array


//set the last item as default

don't forget to use SaveAction.ForceCurrentVersion when saving

Apr 15, 2015 13:02
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.