Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sarvesh1993
Frequent Visitor

How to get POWER BI Import Error Programmatically

I am using Power BI (Microsoft.PowerBI.Api.Models) SDK Model in our C# Application . When we Import report it returns importstate only success or failed but I need some more information in my code like Import Error if ImportState is Failed. How can I get such information.

This is the below piece of code .

When Looking at Import Model Class ,it does not have any property exposed which denotes ImportError .What is the solution to figure out ImportError if ImportState is Failed

 

Import import = await io.PostImportWithFileAsyncInGroup(GroupID, file, ImportConflictHandlerMode.Abort, cancellationToken: token);

 

 public class Import
        {
          
            public Guid Id { get; set; }
    
        
            public string Name { get; set; }
    
           
            public string ImportState { get; set; }
    
            public IList<Report> Reports { get; set; }
    
        
            public IList<Dataset> Datasets { get; set; }
    
    
            public DateTime? CreatedDateTime { get; set; }
    
            public DateTime? UpdatedDateTime { get; set; }
    }

  

3 REPLIES 3
sarvesh1993
Frequent Visitor

@Anonymous  I replied back ,can you help.

Anonymous
Not applicable

Hi  @sarvesh1993 ,

 

It seems to be related to the request information. You can add some try-catch blocks in your code to see the specific error messages. Additionally, check if your method definitions match those in the API package. If they don’t match, the request might not have been sent at all. Finally, make sure the version you are using is not too old, as it might be incompatible with the new version.

NuGet Gallery | Microsoft.PowerBI.Api 4.20.0

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

We have (4.5.0.0) Version of Microsoft.PowerBI.API  installed ,there is no change in Import Model in latest 4.20.0.0 also. Problem is in Import Model class there is no property exposed which provides me Error Info about Import . It has a property of ImportState which return status as succedded ,Publishing and Failed but I need to Know the Cause of the ImportState Failed Error.

 

Adding try catch is not helpful as it does not throw exception when Import is Failed ,it Just returns ImportState as Failed .I refered the GitHub Project also regarding this Microsoft API Model .There is no exposed property which provides us ImportError (PowerBI-CSharp/sdk/PowerBI.Api/Source/Models/Import.cs at master · microsoft/PowerBI-CSharp · GitHub)

 

Import import = await io.PostImportWithFileAsyncInGroup(WorkspaceID, file, "FILENAME" ImportConflictHandlerMode.CreateOrOverwrite, cancellationToken: token);

 

import.ImportState --> failed no exception  , (no exposed property to understand importerror)

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.