/// <summary> /// Attempt to remove a tag from a set of workbooks /// </summary> /// <param name="onlineLogin"></param> /// <param name="contentSet"></param> /// <param name="removeTag"></param> private void Execute_DeleteTagFromWorkbooks( TableauServerSignIn onlineLogin, ICollection <SiteWorkbook> contentSet, string removeTag) { if (string.IsNullOrWhiteSpace(removeTag)) { throw new ArgumentException("Tag to remove is blank"); } //Nothing to do? if (contentSet == null) { return; } var onlineUrls = _onlineUrls; _statusLog.AddStatusHeader("Deleting tag '" + removeTag + "' from " + contentSet.Count.ToString() + " workbooks"); //Make the delete tag request for each workbook foreach (var contentItem in contentSet) { try { var tagDelete = new SendDeleteWorkbookTag(onlineUrls, onlineLogin, contentItem.Id, removeTag); tagDelete.ExecuteRequest(); } catch (Exception exDeleteTag) { _statusLog.AddError( "Error attempting to delete tag from workbook " + contentItem.Id + "/" + removeTag + ", " + exDeleteTag.Message); } }//end: foreach }
/// <summary> /// Attempt to remove a tag from a set of workbooks /// </summary> /// <param name="onlineLogin"></param> /// <param name="contentSet"></param> /// <param name="removeTag"></param> private void Execute_DeleteTagFromWorkbooks( TableauServerSignIn onlineLogin, ICollection<SiteWorkbook> contentSet, string removeTag) { if(string.IsNullOrWhiteSpace(removeTag)) { throw new ArgumentException("Tag to remove is blank"); } //Nothing to do? if(contentSet == null) { return; } var onlineUrls = _onlineUrls; _statusLog.AddStatusHeader("Deleting tag '" + removeTag + "' from " + contentSet.Count.ToString() + " workbooks"); //Make the delete tag request for each workbook foreach(var contentItem in contentSet) { try { var tagDelete = new SendDeleteWorkbookTag(onlineUrls, onlineLogin, contentItem.Id, removeTag); tagDelete.ExecuteRequest(); } catch(Exception exDeleteTag) { _statusLog.AddError( "Error attempting to delete tag from workbook " + contentItem.Id + "/" + removeTag + ", " + exDeleteTag.Message); } }//end: foreach }