Search code examples
c#pluginsdynamics-crm-365

Get a file from a plugin in Microsoft Dynamics 365


I´ve installed Dynamics Version 1612 (8.2.2.112) (DB 8.2.2.112) on-premises. I wrote a plugin to connect to a web API, work perfect, now I need to add more situations. The API can return an url to a zipped file with the response in a JSON file. Well, there're any change to point me in the right direction? First, to get the file. STFW so far he gave me no clue. Thanks in advance.


Solution

  • If you have an URL then get unzip and process.

    Example how to get and unzip file.

    WebClient wc = new WebClient();
    using (MemoryStream stream = new MemoryStream(wc.DownloadData("URL")))
    {
        using (var zip = new ZipArchive(stream, ZipArchiveMode.Read))
        {
           ...
        }
    }