Exemple #1
0
        public void UsePowerBIReports()
        {
            string report = ContentManager.GetNextCatalogItem("PowerBIReport");

            var context = this.ContentManager.PortalAccessorV1.CreateContext();

            ICredentials executionCredentails = CredentialCache.DefaultNetworkCredentials;

            if (!String.IsNullOrEmpty(ReportServerInformation.DefaultInformation.ExecutionAccount))
            {
                CredentialCache myCache         = new CredentialCache();
                Uri             reportServerUri = new Uri(ReportServerInformation.DefaultInformation.ReportServerUrl);
                myCache.Add(new Uri(reportServerUri.GetLeftPart(UriPartial.Authority)),
                            "NTLM",
                            new NetworkCredential(
                                ReportServerInformation.DefaultInformation.ExecutionAccount,
                                ReportServerInformation.DefaultInformation.ExecutionAccountPwd));
                executionCredentails = myCache;
            }

            PowerBIReport pbiReport = context.CatalogItemByPath(report).GetValue() as PowerBIReport;

            PowerBIClient.SimulatePowerBIReportUsage(executionCredentails, pbiReport);
        }