This is an example of how to preview content that has not been published in a 3-tier environment.
In this use case you will need to request an authentication token for a admin level user in order to view content that has not been published.
string UserName = "UserName";
string Password = "Password";
var _userManager = new Ektron.Cms.Framework.User.UserManager();
string authToken = _userManager.Authenticate(UserName, Password);//Authenticate user in 3 tier
var _contentManager = new Ektron.Cms.Framework.Content.ContentManager();
_contentManager.RequestInformation.AuthenticationToken = authToken; //Pass user token in into contentManager
_contentManager.RequestInformation.PreviewMode = true; //Use this method to view content items that have not been published
var _contentCriteria = new Ektron.Cms.Content.ContentCriteria();
_contentCriteria.AddFilter(Ektron.Cms.Common.ContentProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, 76); //Filter by content ID
var getlist = _contentManager.GetList(_contentCriteria);
* Note - this was tested in a 9.1 SP1 environment!
Please sign in to leave a comment.