Forum Discussion
How to get POWER BI Import Error Programmatically
Hi Anonymous ,
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)