Hi,
so i exported a composite data entity by code, and i used File::SendFileToUser(stream, filename); as u can see below to be able to exported file.
#DMF SharedServiceUnitFileID fileId; DMFDefinitionGroupName definitionGroupName = "MyUniqueDefinitionGroupName"; try { str x = "#FieldGroupName_AllFields"; EntityName entityName; DMFEntity dmfEntity; select firstonly dmfEntity order by EntityName asc where dmfEntity.TargetEntity == dataEntityViewStr(SalesOrderV3Entity); entityName = dmfEntity.EntityName; Query query = new Query(DMFUtil::getDefaultQueryForEntity(entityName, "ExportTest")); DMFEntityExporter exporter = new DMFEntityExporter(); fileId = exporter.exportToFile(entityName, definitionGroupName, '', //Optional: ExecutionID "XML-Attribute", //Optional::SourceName x, //Optional field selection query.pack(), //Optional: Filtered Query curExt() //Optional: DataAReaId ); if (fileId != '') { str downloadUrl = DMFDataPopulation::getAzureBlobReadUrl(str2Guid(fileId)); System.Uri uri = new System.Uri(downloadUrl); str fileExt; if (uri != null) { fileExt = System.IO.Path::GetExtension(uri.LocalPath); } Filename filename = strFmt('MyFirstExport%1',fileExt); System.IO.Stream stream = File::UseFileFromURL(downloadUrl); File::SendFileToUser(stream, filename); } else { throw error("DMF execution failed and details were written to the execution log"); } } catch { error("error occurred while exporting"); }
Now i want instead of downloading the file locally, to send it to blob storage, in order for a third system to read from it.
I noticed there is 2 keys and connection strings, which ones to pass?
and what to pass in GetBlockBlobReference and uploadFromFile? or is there another way?
Filename filename = strFmt('MyFirstExport%1',fileExt); System.IO.Stream stream = File::UseFileFromURL(downloadUrl); File::SendFileToUser(stream, filename); Microsoft.WindowsAzure.Storage.Auth.StorageCredentials storageCredentials = new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(accountName, accountKey); Microsoft.WindowsAzure.Storage.CloudStorageAccount storageAccount = new Microsoft.WindowsAzure.Storage.CloudStorageAccount(storageCredentials, true); var blobcli = storageAccount.CreateCloudBlobClient(); Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer cont = blobcli.GetContainerReference("from-d365"); CloudBlockBlob cloudBlockBlob = cont.GetBlockBlobReference(fileName); // should i pass the file name i did above? cloudBlockBlob.UploadFromFile(); ///what to put here?