Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to send csv to azure blob

Posted on by
Hi Experts,
 
I want to store csv file to azure blob for that i have written a code. Right now it is storing csv file to local computer but i want in azure blob. Please correct this code and guide what to do to achieve that.
 
 
Thanks in advance.
stream = csvFile.getStream();        stream.Position = 0;        if(ledgerParametersLoc.TOBDerivativeAzureBlobAccountKey && ledgerParametersLoc.TOBDerivativeAzureBlobAccountName && ledgerParametersLoc.TOBDerivativAzureBlobContainerName)        {            CO_FileUploader::dropFileOnAzureBlobStorage(stream,ledgerParametersLoc.TOBDerivativeAzureBlobAccountName,ledgerParametersLoc.TOBDerivativeAzureBlobAccountKey, ledgerParametersLoc.TOBDerivativAzureBlobContainerName, filename);                    reader = new System.IO.StreamReader(stream);        csvFileContent = reader.ReadToEnd();        File::SendStringAsFileToUser(csvFileContent,  filename);
 
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,339 Super User 2024 Season 2 on at
    How to send csv to azure blob
    Hi Community member,
     
    Check this link please if it helps (as it's similar to your question and it shows how to send stream to azure blob)
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    How to send csv to azure blob
    Let me re-post your code.
    stream = csvFile.getStream();
    stream.Position = 0;
    
    if (ledgerParametersLoc.TOBDerivativeAzureBlobAccountKey
        && ledgerParametersLoc.TOBDerivativeAzureBlobAccountName
        && ledgerParametersLoc.TOBDerivativAzureBlobContainerName)
    {
        CO_FileUploader::dropFileOnAzureBlobStorage(
            stream,
            ledgerParametersLoc.TOBDerivativeAzureBlobAccountName,
            ledgerParametersLoc.TOBDerivativeAzureBlobAccountKey,
            ledgerParametersLoc.TOBDerivativAzureBlobContainerName,
            filename);
    
        reader = new System.IO.StreamReader(stream);
        csvFileContent = reader.ReadToEnd();
        File::SendStringAsFileToUser(csvFileContent,  filename);
    }
    The usage of File::sendStringAsFileToUser() suggests that you're actually using F&O, not AX, therefore let me more this thread to Dynamics 365 Finance forum.
     
    Unfortunately, we can't find the problem with your code to update to a blob storage but you didn't share the code with us. It seems you have it in CO_FileUploader::dropFileOnAzureBlobStorage(), therefore that's the code you should show. Also, you didn't tell us what kind of problem you have with it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,219 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans