views:

643

answers:

0

Hi

I want to call a function written in C# from within ssrs 2008 report. Following is a close representation of the actual C# function to be called

public void GetAttachment(string serverName)
{
   TeamFoundationServer tfsServer = new TeamFoundationServer(serverName);
   tfsServer.Authenticate();
   WorkItemStore workItemStore = new WorkItemStore(tfsServer);
   WorkItem workItem = workItemStore.GetWorkItem(16);
   if (workItem != null)
   {
      System.Net.WebClient request = new System.Net.WebClient();
      request.Credentials = System.Net.CredentialCache.DefaultCredentials;
      foreach (Attachment attachment in workItem.Attachments)
      {
         //Console.WriteLine("Attachment: '" + attachment.Name + "' (" + attachment.Length.ToString() + " bytes)");
         request.DownloadFile(attachment.Uri, Path.Combine(@"C:\Attachments", attachment.Name));
      }
   }
}

The intended purpose of the above function is to download file attachments and display them in the SSRS 2008 report. So how can i add references to the TFS assemblies and be able to call the above function to fetch attachments and display them in the SSRS 2008 report?

Pls. suggest.

Update: The article mentioned in the comments helped me figure out how to call C# code from ssrs 2008 report. Now the question is if I am able to write the files to a temporary folder on the server, how can i display the files in ssrs report in a similar way as show in the below snapshot:

alt text

Thanks