Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:30:01+00:00 2026-06-11T03:30:01+00:00

Is there a simple approach in generating reports, either in PDF, Excel, Word or

  • 0

Is there a simple approach in generating reports, either in PDF, Excel, Word or TIFF formats using the TFS API and SSRS? I can generate the reports manually by selecting the parameters from the combo boxes using the SSRS dashboard for TFS but I would like to include an export button to my web application so that I can easily bypass Team Web Access for generating reports. Any ideas?

I have read on this post that I could use the ReportExecutionService class from SSRS, so I was wondering if this could be used from the TFS server.

I have imported the namespace using this web service reference:
http://<TFS server>/reportserver/ReportExecution2005.asmx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:30:03+00:00Added an answer on June 11, 2026 at 3:30 am

    I have found out a way to generate reports using the ReportExecutionService web service. Provided that a web service reference was added to the project already, this will generate a file with the given parameters. Here the start and end dates are provided as parameters and the report is generated using the Render() method.

    private void GenerateReport()
    {
        ReportExecutionService rs = new ReportExecutionService();
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
        rs.Url = "http://<TFS server name>/reportserver/ReportExecution2005.asmx";
    
        // Render arguments
        byte[] result = null;
        string reportPath = @"<SSRS report path>";
        string format = "PDF";
        string historyID = null;
        string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
    
        // Prepare report parameter.
        ParameterValue[] parameters = new ParameterValue[2];
        parameters[0] = new ParameterValue();
        parameters[0].Name = "StartDateParam";
        parameters[0].Value = "2012-06-01 00:00:00";
        parameters[1] = new ParameterValue();
        parameters[1].Name = "EndDateParam";
        parameters[1].Value = "2012-09-01 00:00:00";
        parameters[2] = new ParameterValue();
        parameters[2].Name = "AreaParam";
        parameters[2].Value = "[Work Item].[Area Hierarchy].[All]";
        parameters[3] = new ParameterValue();
        parameters[3].Name = "WorkItemTypeParam";
        parameters[3].Value = "[Work Item].[System_WorkItemType].&[Task]";
        parameters[4] = new ParameterValue();
        parameters[4].Name = "StateParam";
        parameters[4].Value = "[Work Item].[System_State].&[Active]";
        parameters[5] = new ParameterValue();
        parameters[5].Name = "TrendLineParam";
        parameters[5].Value = "both";
    
        DataSourceCredentials[] credentials = null;
        string showHideToggle = null;
        string encoding;
        string mimeType;
        string extension;
        Warning[] warnings = null;
        ParameterValue[] reportHistoryParameters = null;
        string[] streamIDs = null;
    
        ExecutionInfo execInfo = new ExecutionInfo();
        ExecutionHeader execHeader = new ExecutionHeader();
    
        rs.ExecutionHeaderValue = execHeader;
    
        execInfo = rs.LoadReport(reportPath, historyID);
    
        var parameters_ = rs.GetExecutionInfo().Parameters;
    
        rs.SetExecutionParameters(parameters, "en-us"); 
        String SessionId = rs.ExecutionHeaderValue.ExecutionID;
    
        Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID);
    
        try
        {
            result = rs.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
    
            execInfo = rs.GetExecutionInfo();
    
            Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime);
    
        }
        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.OuterXml);
        }
        // Write the contents of the report to an MHTML file.
        try
        {
            FileStream stream = File.Create("report.pdf", result.Length);
            Console.WriteLine("File created.");
            stream.Write(result, 0, result.Length);
            Console.WriteLine("Result written to the file.");
            stream.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    
    }
    

    By the way, the values set for the parameters are MDX queries and I haven’t found out yet how to set a specific AreaPath, so for now only I can list ‘All’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a simple approach to converting a data frame with dummies (binary coded)
i'm learning c++ api of opencv, and for a simple approach i've started with
Are there simple libraries out there (.NET and Java) that are able to validate
There is simple cipher that translates number to series of . ( ) In
There is simple JSON serialization module with name simplejson which easily serializes Python objects
Is there a simple way to insert the current time (like TIME: [2012-07-02 Mon
Is there a simple shuffle function for Scala lists? If not, whats the simplest
Is there a simple way to serialize a single-level structure as a string for
Is there a simple way, possibly with open-source command line tools in Linux, to
Is there a simple way in Symfony 1.4 to know whether a submitted form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.