Hi Hannah,
Could you please clarify how you are importing the documents? Import Toolkit, API, etc.
If you are using the API, you can follow these examples to check in and publish documents:
private bool CheckIn()
{
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
// Prepare parameters
string siteName = CMSContext.CurrentSiteName;
string aliasPath = "/API-Example";
string culture = "en-us";
bool combineWithDefaultCulture = false;
string classNames = TreeProvider.ALL_CLASSNAMES;
string where = null;
string orderBy = null;
int maxRelativeLevel = -1;
bool selectOnlyPublished = false;
string columns = null;
// Get the document
TreeNode node = DocumentHelper.GetDocument(siteName, aliasPath, culture, combineWithDefaultCulture, classNames, where, orderBy, maxRelativeLevel, selectOnlyPublished, columns, tree);
if (node != null)
{
WorkflowManager workflowmanager = WorkflowManager.GetInstance(tree);
// Make sure the document uses workflow
WorkflowInfo workflow = workflowmanager.GetNodeWorkflow(node);
if (workflow != null)
{
if (node.IsCheckedOut)
{
VersionManager versionmanager = VersionManager.GetInstance(tree);
// Check in the document
versionmanager.CheckIn(node, null, null);
return true;
}
else
{
apiCheckIn.ErrorMessage = "The document hasn't been checked out.";
}
}
else
{
apiCheckIn.ErrorMessage = "The document doesn't use workflow.";
}
}
return false;
}
private bool PublishDocument()
{
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
// Prepare parameters
string siteName = CMSContext.CurrentSiteName;
string aliasPath = "/API-Example";
string culture = "en-us";
bool combineWithDefaultCulture = false;
string classNames = TreeProvider.ALL_CLASSNAMES;
string where = null;
string orderBy = null;
int maxRelativeLevel = -1;
bool selectOnlyPublished = false;
string columns = null;
// Get the document
TreeNode node = DocumentHelper.GetDocument(siteName, aliasPath, culture, combineWithDefaultCulture, classNames, where, orderBy, maxRelativeLevel, selectOnlyPublished, columns, tree);
if (node != null)
{
WorkflowManager workflowManager = WorkflowManager.GetInstance(tree);
WorkflowInfo workflow = workflowManager.GetNodeWorkflow(node);
// Check if the document uses workflow
if (workflow != null)
{
// Publish the document
workflowManager.PublishDocument(node, null);
return true;
}
else
{
apiArchiveDocument.ErrorMessage = "The document doesn't use workflow.";
}
}
return false;
}