ccampora / ZipFunction

Function to zip files from a blob Storage to use them with Dynamics 365 for Finance and Operations DMF API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZipFunction

Function to zip files from a blob Storage. The initial purpose of this function is to use it as part of a Logic Apps flow.

Installation

Deploy to Azure

image

After the deployment is sucessful

image

Configure a new Blob Storage Account

  • Create a new Azure Blob Storage Account -- Yes. Another account. Do not re-use the account created by the Azure functions deployment.
  • Create a new container.
  • Go to Access Keys and obtain a Connection String
  • Create the parameter StorageAccountConnectionString and input the value obtain in the previous step

image

Testing

Drop some files to zip into the container.

Go to the Azure function and select Code + Test

image

Replace the body with a proper message. See an example below

image

Input message example:

{
  "containerpath": "container01", 
  "filelist": [
    "in/2021071156857-08585755930712445680477052973CU30-SalesOrderHeaderV2Entity.csv,SalesOrderHeaderV2Entity.csv",
    "in/2021071156857-08585755930712445680477052973CU30-SalesOrderLineV2Entity.csv,SalesOrderLineV2Entity.csv",
    "config-files/salesorders/Manifest.xml,Manifest.xml",
    "config-files/salesorders/PackageHeader.xml,PackageHeader.xml"
  ],
  "zipfilename": "in/zipFile/2021071156857-08585755930712445680477052973CU30.zip"
}

Optional use the parameter "validatezip" to check if the final package contains validate data file extensions.

  "validatezip": true

the example above will take zip all the files listed in "filelist" array in a file name "zipfilename". It will also rename each of the files if specified.

Also, read this post: https://ccampora.blogspot.com/2021/12/creating-dmf-data-package-from-files.html

About

Function to zip files from a blob Storage to use them with Dynamics 365 for Finance and Operations DMF API

License:MIT License


Languages

Language:C# 100.0%