web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Item not found when trying to retrieve the report from SSRS

(0) ShareShare
ReportReport
Posted on by

Hi,

I am a junior dynamics developer and I am trying to retrieve a report from SSRS in a C# plugin.

I used ReportExecution2005.asmx as a web reference to generate the classes necessary for this task.

I pass the credentials, report path and the server URL through a json using Unsecure Config.

The problem is that I receive the following error:

System.Web.Services.Protocols.SoapException: The item '/reports_crm365/report/testv9_MSCRM/ContactList' cannot be found. ---> Microsoft.ReportingServices.Diagnostics.Utilities.ItemNotFoundException: The item '/reports_crm365/report/testv9_MSCRM/ContactList' cannot be found.

The error occurs when I am trying to load report using the LoadReport method of the ReportExecutionService class.

I am really sure that the report path is correct. My security roles in SSRS are the following: 

Browser, Publisher, Publisher for Microsoft CRM, Report Builder

This is the code of my getReport method, where ReportAttachment is a class where I deserialize the JSON from unsecure config:

public static class ReportTools
    {
        public static byte[] GetReport(ReportAttachment reportInfos)
        {
            byte[] report = null;
            string encoding;
            string mimeType;
            string extension;
            Warning[] warnings = null;
            string[] streamIDs = null;
            string historyId = null;
            string debug = "";
            string reportPath = reportInfos.reportPath;
            string reportServerUrl = reportInfos.reportServer;
            string reportConnectionUser = reportInfos.ssrsUser;
            string password = reportInfos.ssrsPass;
            string reportConnectionDomain = reportInfos.domainName;

            if (string.IsNullOrEmpty(reportServerUrl) || string.IsNullOrEmpty(reportPath)
            || string.IsNullOrEmpty(reportConnectionUser) || string.IsNullOrEmpty(password)
            || string.IsNullOrEmpty(reportConnectionDomain)) return report;

            try
            {
                NetworkCredential credentials = new NetworkCredential(reportConnectionUser, password, reportConnectionDomain);
                ReportExecutionService reportExecutionService = new ReportExecutionService();
                reportExecutionService.PreAuthenticate = true;
                reportExecutionService.Credentials =  credentials;
                reportExecutionService.Url = reportServerUrl;

                ExecutionHeader execHeader = new ExecutionHeader();
                reportExecutionService.ExecutionHeaderValue = execHeader;
                
                ExecutionInfo execInfo = new ExecutionInfo();
                execInfo = reportExecutionService.LoadReport(reportPath, historyId);
                string sessionId = reportExecutionService.ExecutionHeaderValue.ExecutionID;
                
                report = reportExecutionService.Render("PDF",
                    @"False",
                    out extension,
                    out encoding,
                    out mimeType,
                    out warnings,
                    out streamIDs);
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException("THE RAPORT COULD NOT BE RETRIEVED " ex.Message);
            }
            return report;
        }
    }

I have the same question (0)
  • Muhammad Shahzad Shafique Profile Picture
    2,373 Most Valuable Professional on at

    You need to verify if the path is correct and the if credentials used by web service are valid for this report.

  • ASG Profile Picture
    on at

    I also tried with testv9_MSCRM/ContactList as being the report path. The result is the same.

  • ASG Profile Picture
    on at

    My report's data source takes from a 9.0 on premise instance. I logged in on that data source using the user guid as username and organization guid as password.

    I added this code snip to my method before the execution of the LoadReport method:

                   DataSourceCredentials datasetCredential = new DataSourceCredentials();

                   datasetCredential.DataSourceName = "D365OnPremV2";

                   datasetCredential.UserName = "userGuid";

                   datasetCredential.Password = "orgGuid";

                   DataSourceCredentials[] credentials2 = new DataSourceCredentials[1];

                   credentials2[0] = datasetCredential;

                   reportExecutionService.SetExecutionCredentials(credentials2);

    But with no success.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans