Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I'm getting error when trying to get PowerBI report:
using Microsoft.PowerBI.Api.V2;
using Microsoft.PowerBI.Api.V2.Models;
// ...
UserPasswordCredential userCredential = new UserPasswordCredential(Username, Password);
AuthenticationContext ctx = new AuthenticationContext(AuthorityUrl);
Task<AuthenticationResult> task = ctx.AcquireTokenAsync(ResourceUrl, ApplicationId, userCredential);
AuthenticationResult authResult = task.Result;
if (authResult != null)
{
TokenCredentials credentials = new TokenCredentials(authResult.AccessToken, "Bearer");
using (PowerBIClient powerBIClient = new PowerBIClient(new Uri(ApiUrl), credentials))
{
// ...
}
}
Error:
System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.
at System.Collections.Generic.List`1.Add(T item)
at Microsoft.PowerBI.Api.V2.PowerBIClient.Initialize()
at Microsoft.PowerBI.Api.V2.PowerBIClient..ctor(Uri baseUri, ServiceClientCredentials credentials, DelegatingHandler[] handlers)
It works on SharePoint 2013. After upgrade to SharePoint 2016 started getting this issue. Parameters to connect and get PowerBI report are the same in both cases.
I found one solution with trying different versions of Newtonsoft.Json library, but it didn't help
I have found that:
On machine where it works with SharePoint 2013 - it works only if opened from different machine. When opened on the same server where it is deployed, it is the same issue.
Hi @bartp ,
What kind of embedding method are you choosing to use in Sharepoint 2016, publish to web?
As far as I know, the classic SharePoint Server is not supported with embedding to SharePoint Online.
For reference: Known issues and limitations
According to your screenshot, I think there should be something wrong in authentication. I think you can try to delete the cache , then get the embed code and bear token and try again.
Here is a solved post with similar problem like yours, I hope it could help you solve your problem.
For reference: Embed Power BI report on SharePoint on-prem page, SP List as data source & repeatable deployment...
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
15 | |
4 | |
3 | |
3 | |
2 |