Good Afternoon
I have go about creating a scheduled task to only sync documents with a specific path alias and it seems to work well with one exception. It appears that along with syncing the content it also sync's the pageTemplate used by that document - which is not what I want.
Would I be able to modify the following code so that it syncs only the new documents and not the templates that they use?
Many thanks in advance.
Regards
Thomas Diggins-Barnes
public string Execute(CMS.Scheduler.TaskInfo ti)
{
string result = string.Empty;
string debug = "Starting";
eventCode = "SYNCALLOBJECTS";
string CurrentInfo = "Tasks.SynchronizationCanceled";
try
{
siteId = 1;
serverId = 1;
// Get the tasks
string where = "TaskType NOT IN (N'ADDTOSITE', N'REMOVEFROMSITE') AND ((TaskNodeAliasPath LIKE '/Edition/Print/%') or (TaskNodeAliasPath = '/ARCHIVE') or (TaskNodeAliasPath LIKE '/ARCHIVE/%') or (TaskNodeAliasPath LIKE '/Opinion/%'))"; ;
int limitless = -1;
DataSet ds = CMS.Scheduler.TaskInfoProvider.ExecuteQuery("CMS.Root.SelectSyncTasks", null, where, "TaskID", limitless, "TaskID, TaskTitle", limitless, limitless, ref limitless);
result = StagingHelper.RunSynchronization(ds, 1, true, 1, AddLog);
// Log possible error
if (!string.IsNullOrEmpty(result))
{
CurrentInfo = "Editorial Sync Failed";
}
else
{
CurrentInfo = "Editorial Sync Successful";
}
}
catch (ThreadAbortException ex)
{
string state = ValidationHelper.GetString(ex.ExceptionState, string.Empty);
if (state == CMSThread.ABORT_REASON_STOP)
{
CurrentInfo = "Tasks.CanceledSync";
}
else
{
CurrentInfo = "Editorial Sync Failed";
}
}
catch (Exception ex)
{
CurrentInfo = "Editorial Sync Failed" + ": " + ex.Message;
}
finally
{
// Finalize log context
//FinalizeContext();
}
return CurrentInfo;
}