コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="workItem"></param>
        /// <param name="index"></param>
        /// <param name="downloadedFileName"></param>
        /// <returns></returns>
        public static FileInfo DownloadAttachment(this TrackerService.WorkItem workItem, int index, string password, string downloadedFileName)
        {
            TrackerService.Attachment attachment = API.ExtractAttachment(workItem)[index];
            WebClient webClient = new WebClient();

            webClient.Credentials = new NetworkCredential(API.Connection.UserName, password);
            webClient.DownloadFile(attachment.url, downloadedFileName);
            return(new FileInfo(downloadedFileName));
        }
コード例 #2
0
 /// <summary>
 ///     Creates an attachment.
 /// </summary>
 /// <param name="workItem">The WorkItem to upload the attachment to.</param>
 /// <param name="title">The title for the attachment.</param>
 /// <param name="filePath">Full qualified filepath of the file to upload.</param>
 public static void CreateAttachment(TrackerService.WorkItem workItem, string title, string filePath)
 {
     TrackerService.Attachment newWorkItem = new TrackerService.Attachment();
     byte[] content = File.ReadAllBytes(filePath);
     Connection.Tracker.createAttachment(workItem.uri, filePath, title, content);
 }