コード例 #1
0
        public AttachmentReference UploadBinaryFile()
        {
            // Full path to the binary file to upload as an attachment
            string filePath = ClientSampleHelpers.GetSampleBinaryFile();

            VssConnection connection = Context.Connection;
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>();

            Console.WriteLine("Attempting upload of: {0}", filePath);

            AttachmentReference attachment = workItemTrackingClient.CreateAttachmentAsync(@filePath).Result;

            Console.WriteLine("Attachment created");
            Console.WriteLine(" ID    : {0}", attachment.Id);
            Console.WriteLine(" URL   : {0}", attachment.Url);

            return(attachment);
        }