Try our conversational search powered by Generative AI!

How do you find unpublished pages based on criteria?


It appears that EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentVersionRepository>().LoadCommonDraft is returning published and unpublished pages based on a supplied ContentLink. How do I return only unpublished pages?

var draftRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentVersionRepository>();
            ContentVersion draftPage = draftRepository.LoadCommonDraft(contentLink:MyContentLink, language: Language.Name);

Feb 12, 2014 21:51

If the content will not have a common draft, published version will be returned. Check whether page really contains common draft. If there is no publish content - last saved version is returned.

If you want to check what you got back you should look for Status property of ContentVersion type.

Feb 12, 2014 23:43


You can use one of these:

IEnumerable<ContentVersion> List(ContentReference contentLink);
IEnumerable<ContentVersion> List(ContentReference contentLink, string languageBranch);

then filter out:

Where(v => v.Status != VersionStatus.Published)



Feb 13, 2014 5:09

Thanks. I've added a check to see if it is the Common Draft and CheckedIn.

Do I still need to make a CreateWritableClone if I want to save the page again?


if (draftPage.IsCommonDraft && draftPage.Status == VersionStatus.CheckedIn)

Feb 13, 2014 17:41

Yes, you still need to make a CreateWritableClone if you want to modify the instance.


Feb 14, 2014 1:27
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.