public System.IO.Stream GetReleaseTaskAttachmentContent() { string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name; // Get a release client instance VssConnection connection = Context.Connection; ReleaseHttpClient releaseClient = connection.GetClient <ReleaseHttpClient>(); WebApiRelease release = releaseClient.GetReleaseAsync(project: projectName, releaseId: this._newlyCreatedRelease).Result; // Get release task attachments ReleaseEnvironment environment = release.Environments.FirstOrDefault(); DeploymentAttempt deployStep = environment.DeploySteps.First(); Guid planId = deployStep.ReleaseDeployPhases.First().RunPlanId.Value; List <ReleaseTaskAttachment> releaseTaskAttachment = releaseClient.GetReleaseTaskAttachmentsAsync(project: projectName, releaseId: release.Id, environmentId: environment.Id, attemptId: deployStep.Attempt, planId: planId, type: "myattachmenttype").Result; ReleaseTaskAttachment firstReleaseTaskAttachment = releaseTaskAttachment.First(); Guid timelineId = firstReleaseTaskAttachment.TimelineId; Guid recordId = firstReleaseTaskAttachment.RecordId; string attachmentType = firstReleaseTaskAttachment.Type; string attachmentName = firstReleaseTaskAttachment.Name; System.IO.Stream attachmentData = releaseClient.GetReleaseTaskAttachmentContentAsync(project: projectName, releaseId: release.Id, environmentId: environment.Id, attemptId: deployStep.Attempt, planId: planId, timelineId: timelineId, recordId: recordId, type: attachmentType, name: attachmentName).Result; Context.Log("{0} {1}", attachmentName.PadLeft(6), attachmentType); return(attachmentData); }