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); }