question

RajD-9527 avatar image
0 Votes"
RajD-9527 asked RajD-9527 commented

Publish power bi reports using C# ReportingService2010

Hi

I am working on publishing .rdl & .pbix report files to SSRS report server 2019 using the code below. Publish of .rdl files works fine but .pbix reports error.

Code:

 private void PublishReports()
     {
         ReportService2010.ReportingService2010 rs = new ReportService2010.ReportingService2010();
         rs.Url = "https://MyReportServer/ReportServer/reportservice2010.asmx";
         rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
         string strItemType = "Report";
         string strName = "Test.pbix";
         Byte[] definition = null;
         ReportService2010.Warning[] warnings = null;
    
         try
         {
             string strServerPath = @"C:\Temp\Test.pbix";
             FileStream stream = File.OpenRead(strServerPath);
             definition = new Byte[stream.Length];
             stream.Read(definition, 0, (int)stream.Length);
             stream.Close();
         }
    
         catch (IOException e)
         {
             MessageBox.Show(e.Message);
         }
    
         try
         {
             string parent = "/";
             ReportService2010.CatalogItem report = rs.CreateCatalogItem(strItemType, strName, parent,true, definition, null, out warnings);
    
             if (warnings != null)
             {
                 foreach (ReportService2010.Warning warning in warnings)
                 {
                     MessageBox.Show(warning.Message);
                 }
             }
    
             else               
  MessageBox.Show("Report: {0} created successfully " + " with no warnings", strName);
         }
    
         catch (SoapException e)
         {
             MessageBox.Show(e.Detail.InnerXml.ToString());
         }
    
     }

Error:

The operation you are attempting on item '/Reports/Test' is not allowed for this item type. ---> Microsoft.ReportingServices.Diagnostics.Utilities.WrongItemTypeException: The operation you are attempting on item '/Reports/Test' is not allowed for this item type.


Can I use ReportingServices2010.asmx to publish both .rdl & .pbix reports? Please guide me.

Thank you

dotnet-csharpsql-server-reporting-services
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RajD-9527 , Since this thread is related to Power BI, I recommend that you could ask a question in PBI_Comm_Forums.


0 Votes 0 ·
OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered

Can I use ReportingServices2010.asmx to publish both .rdl & .pbix reports? Please guide me.

No, that's not possible. The RS 2010 API was first introduced with SSRS 2008 R2, long before Power BI and is so not aware of it or able to handle Power BI reports.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RajD-9527 avatar image
0 Votes"
RajD-9527 answered RajD-9527 commented

Hi @OlafHelper-2800 Thanks very much for your response. Is there a service available that would publish both the .rdl & .pbix reports?

Regards

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.