public byte[] Read(Guid id, string filename, out Dictionary <string, string> metaData)
        {
            metaData = null;
            Dictionary <string, string> storeMetaData = null;

            byte[] data = blobStorageHelper.GetBlob(configuration.Container, GetFullFilename(id, filename), out storeMetaData);
            if (storeMetaData != null)
            {
                metaData = storeMetaData.ToDictionary(m => m.Key.Replace(MetaDataPrefix, ""), m => m.Value);
            }
            return(data);
        }
コード例 #2
0
        public static async Task <string> UploadBlob([ActivityTrigger] GroupReport groupReport, ILogger log)
        {
            log.LogInformation("Trying to upload report {reportid} of group {groupid}", groupReport.ReportId, groupReport.GroupId);

            Stream reportStream;
            string reportName;

            try
            {
                // Create a Power BI Client object. It will be used to call Power BI APIs.
                using (PowerBIClient powerBIClient = new PowerBIClient(PowerBIApiUrl, TokenCredentials))
                {
                    log.LogInformation($"powerBI client created");
                    Report report = await powerBIClient.Reports.GetReportAsync(groupReport.GroupId, groupReport.ReportId);

                    reportName   = DateTime.Now.ToString("yyyyMMdd_HH") + "h/" + groupReport.GroupName + "/" + report.Name + ".pbix";
                    reportStream = await powerBIClient.Reports.ExportReportAsync(groupReport.GroupId, groupReport.ReportId);
                }

                // Retrieve destination blob reference
                CloudBlockBlob pbixBlob = BlobStorageHelper.GetBlob(
                    BlobStorageCS
                    , BlobStorageContainerName
                    , reportName);
                log.LogInformation("Blob reference retrieved for report {reportname}", reportName);

                await pbixBlob.UploadFromStreamAsync(reportStream);
            }
            catch (Exception e)
            {
                log.LogError(new EventId(666), e, "Error while trying to upload blob: {message}", e.Message);
                return(e.Message);
            }

            return($"{reportName} successfully created!");
        }
コード例 #3
0
 public byte[] Read(Guid id, string filename)
 {
     return(blobStorageHelper.GetBlob(configuration.Container, GetFullFilename(id, filename)));
 }