private static int disableSubscription(ReportingService2005 rs, string subID) { /* Set up schedule info for any time in the past */ string scheduleXML = @"<ScheduleDefinition>" + " <StartDateTime>2010-12-31T08:00:00-08:00" + " </StartDateTime>" + "</ScheduleDefinition>"; ExtensionSettings es; string owner; string description; ActiveState activeState; string status; string eventType; string matchData = scheduleXML; //Based on if schedule is shared schedule, make it stop now string oldMatchData; ParameterValue[] parameters = null; try { owner = rs.GetSubscriptionProperties(subID, out es, out description, out activeState, out status, out eventType, out oldMatchData, out parameters); rs.SetSubscriptionProperties(subID, es, description, eventType, matchData, parameters); } catch (SoapException ex) { Console.WriteLine(ex.ToString()); } return 0; }
private static int modSubscriptionEmail(ReportingService2005 rs, List<CatalogItem> items, Dictionary<string, string> emailAddressMap) { if (items.Count == 0) { return 0; } else { CatalogItem item = items[items.Count - 1]; items.RemoveAt(items.Count - 1); //Console.WriteLine("Hitting: " + item.Path); if (rs.GetItemType(item.Path) == ItemTypeEnum.Report) { Console.WriteLine("Modifying email address for: " + item.Path); foreach (var sub in rs.ListSubscriptions(item.Path, null)) { if (sub.EventType == "TimedSubscription" && sub.IsDataDriven == false) { string subID = sub.SubscriptionID; string owner = sub.Owner; string description = sub.Description; ActiveState activeState = sub.Active; string status = sub.Status; string eventType = sub.EventType; string matchData; ParameterValue[] parameters = null; ExtensionSettings es = sub.DeliverySettings; if (sub.DeliverySettings.Extension == "Report Server FileShare") { es.ParameterValues = setPassword(es.ParameterValues); } try { rs.GetSubscriptionProperties(subID, out es, out description, out activeState, out status, out eventType, out matchData, out parameters); es = swapEmailAddresses(es, emailAddressMap, ref description); rs.SetSubscriptionProperties(sub.SubscriptionID, es, description, eventType, matchData, parameters); } catch (SoapException ex) { Console.WriteLine(ex.ToString()); } } } } else if (rs.GetItemType(item.Path) == ItemTypeEnum.Folder) { Console.WriteLine("Descending into folder: " + item.Path); items.InsertRange(0, rs.ListChildren(item.Path, false)); //disableSubscriptions(rs, new List<CatalogItem>(rs.ListChildren(item.Path, true))); //foreach (var catalogItem in rs.ListChildren(path, true)) //{ // disableSubscriptions(rs, catalogItem.Path); //} } modSubscriptionEmail(rs, items, emailAddressMap); return 0; } }
private static int disableSubscriptions(ReportingService2005 rs, List<CatalogItem> items) { /* Set up schedule info for any time in the past */ string scheduleXML = @"<ScheduleDefinition>" + " <StartDateTime>2010-12-31T08:00:00-08:00" + " </StartDateTime>" + "</ScheduleDefinition>"; if (items.Count == 0) { return 0; } else { CatalogItem item = items[items.Count -1]; items.RemoveAt(items.Count - 1); //Console.WriteLine("Hitting: " + item.Path); if (rs.GetItemType(item.Path) == ItemTypeEnum.Report) { Console.WriteLine("Disabling subscriptions for: " + item.Path); foreach (var sub in rs.ListSubscriptions(item.Path, null)) { if (sub.EventType == "TimedSubscription" && sub.IsDataDriven == false) { ExtensionSettings es = sub.DeliverySettings; if (sub.DeliverySettings.Extension == "Report Server FileShare") { es.ParameterValues = setPassword(es.ParameterValues); } string description = sub.Description; string eventType = sub.EventType; string matchData = scheduleXML;//Based on if schedule is shared schedule, make it stop now ParameterValue[] parameters = null; try { rs.SetSubscriptionProperties(sub.SubscriptionID, es, description, eventType, matchData, parameters); } catch (SoapException ex) { Console.WriteLine(ex.ToString()); } } } } else if (rs.GetItemType(item.Path) == ItemTypeEnum.Folder) { Console.WriteLine("Descending into folder: " + item.Path); items.InsertRange(0, rs.ListChildren(item.Path, false)); //disableSubscriptions(rs, new List<CatalogItem>(rs.ListChildren(item.Path, true))); //foreach (var catalogItem in rs.ListChildren(path, true)) //{ // disableSubscriptions(rs, catalogItem.Path); //} } disableSubscriptions(rs, items); return 0; } }