Hi
I want to run a Quote report using C#, I encountered the following code:
Guid orgid, userid; WhoAmIResponse(out orgid, out userid); ReportViewer rViewer = new ReportViewer(); rViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new NetworkCredential("000000", "000000", "000000000"); rViewer.ProcessingMode = ProcessingMode.Remote; rViewer.ShowPrintButton = true; rViewer.ServerReport.ReportServerUrl = new Uri(url); rViewer.ServerReport.ReportPath = path; //CRM Report DataSourceCredentials dsc = new DataSourceCredentials(); dsc.UserId = userid.ToString(); dsc.Password = orgid.ToString(); dsc.Name = "CRM"; //"MSCRM_DataSource"; // List<DataSourceCredentials> dscs = new List<DataSourceCredentials>(); dscs.Add(dsc); rViewer.ServerReport.SetDataSourceCredentials(dscs);
But it throws an error, that When I check the Reporting service error log files, it is as below :
System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object 'p_GetCrmUserId', database 'MSCRM_CONFIG', schema 'dbo'. ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: The EXECUTE permission was denied on the object 'p_GetCrmUserId', database 'MSCRM_CONFIG', schema 'dbo'.
But, When I execute the sp in SQL server studio, it runs and returns the CRMUSER Id.
My Reporting service configuration is :
Report Server Service Account Set to "Network Service"
Current Report Server Database Credentials Set To NT Authority\NetworkService
Would you help me please ?
Regards