how to Get attachments from Shared steps in TFS RRS feed

  • Question

  • How to download attachments in shared steps from TFS using C#. here is somepart of code i have written.. attachment is not coming up. Let me know if anyone knows

    foreach (WorkItem item in witCollection) //witCollection is collection of shared steps.


    if(item.Attachments.Count > 0)

    AttachmentCollection atcoll =((Microsoft.TeamFoundation.WorkItemTracking.Client.AttachmentCollection)(item.Attachments)) as AttachmentCollection;

      foreach (var attachment in atcoll )

    Wednesday, October 3, 2018 3:53 AM

All replies

  • Hi,

    You are doing it wrong. You are looping through Test Case work item however you need to loop through ISharedTestStepResult collection and then fetch attachments if available.

    See below couple of threads - 

    Thread 1

    Thread 2

    Also you can go through my blog posts.

    Vivek Bansod
    Blog | MSDN | LinkedIn

    • Edited by Vivek Bansod Wednesday, October 3, 2018 10:53 AM
    Wednesday, October 3, 2018 10:53 AM
  • Questions related to TFS should be posted on Stack Overflow. The TFS team has moved their support there.

    As a starting point though feel free to take a look at the code I wrote to migrate from TFS to VSTS. LePastis added support for migrating attachments as well. That code demos how you can get attachments from work items.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, October 3, 2018 2:09 PM