public async Task <ActionResult> Index() { var poweBIService = new PowerBIService(); var viewModel = await poweBIService.GetDocumentDownloadReportAsync(); return(View(viewModel)); }
private async Task <Report> GetReportByGroupAndName(string GroupID, string Name) { try { if (string.IsNullOrEmpty(GroupID) || string.IsNullOrEmpty(Name)) { return(null); } var tokenCredentials = await PowerBIService.GetAccessTokenSecretAsync(); // Create a Power BI Client object. it's used to call Power BI APIs. using (var client = new PowerBIClient(new Uri(Constants.ApiUrl), tokenCredentials)) { Microsoft.PowerBI.Api.Models.Reports ReportsInGroup = client.Reports.GetReportsInGroup(Guid.Parse(GroupID)); if (ReportsInGroup != null) { Report found = ReportsInGroup.Value.Where(a => a.Name.Equals(Name)).FirstOrDefault(); return(ReportsInGroup.Value.Where(a => a.Name.Equals(Name)).FirstOrDefault()); } } } catch (Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException) { } catch (Exception ex) { } return(null); }
public async Task <JsonResult> DashboardEmbedConfig(string workspaceId, string dashboardId) { try { if (string.IsNullOrWhiteSpace(workspaceId)) { throw new ArgumentNullException(nameof(workspaceId)); } else if (string.IsNullOrWhiteSpace(dashboardId)) { throw new ArgumentNullException(nameof(dashboardId)); } // Generates embedConfig for dashboard else { return(this.Json(await PowerBIService.GetDashboardEmbedConfigAsync(workspaceId, dashboardId))); } } catch (HttpRequestException ex) { Console.Error.WriteLine(ex); throw; } catch (FormatException ex) { Console.Error.WriteLine(ex); throw; } }
public async Task <JsonResult> GetTile(string workspaceId, string dashboardId) { try { if (string.IsNullOrWhiteSpace(workspaceId)) { throw new ArgumentNullException(nameof(workspaceId)); } else if (string.IsNullOrWhiteSpace(dashboardId)) { throw new ArgumentNullException(nameof(dashboardId)); } // Retrieving tiles in a dashboard else { return(this.Json(await PowerBIService.GetTilesAsync(workspaceId, dashboardId))); } } catch (HttpRequestException ex) { Console.Error.WriteLine(ex); throw; } catch (FormatException ex) { Console.Error.WriteLine(ex); throw; } }
public ReportsVM() { PrefilteredItems = new List <WSReport>(); Items = new ObservableCollection <WSReport>(); RefreshCommand = new Command(ExecuteRefreshCommand); Name = string.Format("Hola, {0}!", App.CurrentUser.Name); ReportsService = new ReportsService(); PowerBiService = new PowerBIService(); GetTTReports(); }
public async Task <ActionResult> Embed() { try { return(View("embed", new WorkspaceList { Workspaces = await PowerBIService.GetWorkspacesAsync() })); } catch (Exception ex) { ErrorModel errorModel = new ErrorModel { ErrorCode = (HttpStatusCode)500, ErrorMessage = ex.ToString() }; return(View("Error", errorModel)); } }
public EncryptCredentialsController(PowerBIService powerBIService, IOptions <AzureAd> azureAd) { this.powerBIService = powerBIService; this.azureAd = azureAd; }