Advertisement
Guest User

Untitled

a guest
May 5th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. // Create a dev token for import
  2. var devToken = PowerBIToken.CreateDevToken(workspaceCollectionName, workspaceId);
  3. using (var client = CreateClient(devToken))
  4. {
  5. // Import PBIX file from the file stream
  6. var import = await client.Imports.PostImportWithFileAsync(workspaceCollectionName, workspaceId, fileStream, datasetName);
  7.  
  8. // Example of polling the import to check when the import has succeeded.
  9. while (import.ImportState != "Succeeded" && import.ImportState != "Failed")
  10. {
  11. import = await client.Imports.GetImportByIdAsync(workspaceCollectionName, workspaceId, import.Id);
  12. Console.WriteLine("Checking import state... {0}", import.ImportState);
  13. Thread.Sleep(1000);
  14. }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement