Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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; } }
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)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |