static void Main(string[] args) { try { reportConflicts = (args.Length == 1 && args[0].Length > 0 && args[0].ToUpperInvariant().Substring(1) == "REPORTCONFLICTS"); var traverser = new CmsTraverser(); traverser.TraversingPlaceholder += new CmsEventHandler(traverser_TraversingPlaceholder); traverser.TraverseSite(PublishingMode.Unpublished, false); SortResourcesToMove(); var body = BuildEmailHtml(); if (!String.IsNullOrEmpty(body)) { SendEmail(body); } } catch (Exception ex) { ExceptionManager.Publish(ex); throw; } }
public string SetExpiryDate(string channelPath, string months, bool includeSubchannels, bool updateExpiredPages) { this.newExpiry = (String.IsNullOrEmpty(months)) ? CmsUtilities.NeverExpires : DateTime.Now.AddMonths(Convert.ToInt32(months)); string retval = String.Empty; // get the current cms application context string channelGuid = null; this.updateExpired = updateExpiredPages; using (CmsApplicationContext cac = CmsUtilities.GetAdminContext(PublishingMode.Published)) { // we need to authenticate against a cms mode and MUST do this before using searches to get he current channel Channel currentChannel = CmsUtilities.ParseChannelUrl(channelPath, cac); if (currentChannel == null) { retval = "Channel not found"; } else { channelGuid = currentChannel.Guid; } } if (channelGuid != null) { try { if (includeSubchannels) { CmsTraverser traverser = new CmsTraverser(); traverser.TraversingChannel += new CmsEventHandler(traverser_TraversingChannel); traverser.TraverseChannel(PublishingMode.Update, true, new Guid(channelGuid)); } else { ExtendChannel(newExpiry, new Guid(channelGuid)); } retval = "Channel posting expiry dates have been delayed until " + newExpiry; } catch (Exception ex) { retval = ex.Message; } } return(retval); }