November Happy Hour will be moved to Thursday December 5th.

How to save PageData item as a Common Draft?

JJ
JJ
Vote:
 

Hi,

We have a custom class that extends PageData.

We are currently saving the data using IContentRepository.

How can we set the saved version as Common Draft?

Also, is Common Draft the same as Primary Draft? Documentation is not clear on that.

Thanks,

J

#251276
Mar 24, 2021 10:41
Vote:
 

Hi JJ,

Set Saved version as Common Draft as following:

...
writablePage.Name = "a new name";
 var saveAction = SaveAction.CheckIn | SaveAction.ForceNewVersion;
var newReference = _contentRepository.Save(writablePage, saveAction, EPiServer.Security.AccessLevel.NoAccess);
var repository = ServiceLocator.Current.GetInstance<IContentVersionRepository>();
repository.SetCommonDraft(newReference);
  • Primary Draft mainly refers to "what version do you want to start to see when you're editing".
  • Common draft refresh to the new version when you create the content.

 

#251347
Mar 25, 2021 10:00
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.