private static async void BotOnCallbackQueryReceived(object sender, CallbackQueryEventArgs callbackQueryEventArgs) { string TCMUri = callbackQueryEventArgs.CallbackQuery.Data; if (TCMUri != null) { var client = new SessionAwareCoreServiceClient("wsHttp_201603"); client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("srv-cmtask", "srv_tridion_cm", "global"); var instruction = new UnPublishInstructionData() { ResolveInstruction = new ResolveInstructionData() }; var pt = client.UnPublish(new[] { TCMUri }, instruction, new[] { "purp1" }, null, new ReadOptions()); await Bot.AnswerCallbackQueryAsync(callbackQueryEventArgs.CallbackQuery.Id, $"Sucessfully unpublished {callbackQueryEventArgs.CallbackQuery.Data}", cacheTime : 0); } else { await Bot.AnswerCallbackQueryAsync(callbackQueryEventArgs.CallbackQuery.Id, $"Nothing", cacheTime : 0); } }
public string UnPublishItems(PublishUnPublishInfoData IDs) { try { var unPubInstruction = new UnPublishInstructionData() { ResolveInstruction = new ResolveInstructionData() { IncludeChildPublications = false, Purpose = ResolvePurpose.UnPublish, }, RollbackOnFailure = true }; PublishTransactionData[] result = null; var tfilter = new TargetTypesFilterData(); var allPublicationTargets = Client.GetSystemWideList(tfilter); if (allPublicationTargets == null) { throw new ArgumentNullException(nameof(allPublicationTargets)); } foreach (var tcmID in IDs.IDs) { var target = allPublicationTargets.Where(x => x.Title == tcmID.Target).Select(x => x.Id).ToList(); if (target.Any()) { result = Client.UnPublish(new[] { tcmID.Id }, unPubInstruction, new[] { target[0] }, PublishPriority.Normal, null); if (result == null) { throw new ArgumentNullException(nameof(result)); } } } return("Items send for Unpublish"); } catch (Exception ex) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public static void UnPublish(this IdentifiableObjectData objectData, string[] purpose, PublishPriority prio = PublishPriority.Low, DateTime?StartAt = null) { var unPubInst = new UnPublishInstructionData() { ResolveInstruction = new ResolveInstructionData() { IncludeChildPublications = false, Purpose = ResolvePurpose.UnPublish, StructureResolveOption = StructureResolveOption.OnlyItems }, RollbackOnFailure = false }; if (StartAt.HasValue) { unPubInst.StartAt = StartAt; } Wrapper.Instance.UnPublish(new string[] { objectData.Id.ToString() }, unPubInst, purpose, PublishPriority.Low, new ReadOptions()); }
public void UnPublish(string[] ids, UnPublishInstructionData instruction, string[] targets, PublishPriority priority) { this.Client.UnPublish(ids, instruction, targets, priority, new ReadOptions()); }
public void Unpublish(string[] itemIds, string targetId) { ResolveInstructionData resolveInstruction = new ResolveInstructionData { IncludeComponentLinks = true, Purpose = ResolvePurpose.UnPublish, IncludeChildPublications = true }; UnPublishInstructionData unPublishInstruction = new UnPublishInstructionData { StartAt = DateTime.Now, ResolveInstruction = resolveInstruction, }; _client.UnPublishAsync(itemIds, unPublishInstruction, new []{targetId}, PublishPriority.Normal, null); }