Forum Discussion
Create Report in Embedded Power BI with GenerateTokenRequestV2
I was able to resolve the issue...
I changed my code to use the same “pbiClient.EmbedToken.GenerateToken” API call as view/edit rather than the “pbiClient.Reports.GenerateTokenForCreateInGroup” API call. My understanding was that report creation required the more specific call for creating a report in a group. However, it appears that it was the cause of the issue, and is still a v1 call.
Using the GenerateToken API instead did resolve the issue. The custom SaveAs dialog now works and allows me to save to the target workspace. I simply provide Guid.Empty for the reports portion of the GenerateTokenRequestV2 and include the Dataset and targetWorkspace.
Thanks for sharing the fix here. I am still having the same issue as your original issue.
In the UI code are you specifying the targetWorkspaceId on the SaveAs call (via the SaveAsTriggered event) or is it enough that your token request includes the target workspace?
- shietpas_cbts3 years agoFrequent Visitor
gotters I capture the targetWorkspaceId back out of the embedded object within the saveAsTriggered event:
report.on("saveAsTriggered", function (event) { var targetWorkspaceId = embeddedObject.targetWorkspaceId;This is then passed with report name to my saveAs function that does the actual work.
- gotters3 years agoResolver I
Thanks for the help. I was trying that but my saveAsTriggered was not firing.
just figured out I need to add to configsettings: {useCustomSaveAsDialog: true}