SaaS News Hubb
Advertisement
  • Home
  • News
  • Software Engineering
  • Software Development
  • SAAS Applications
  • Contact Us
No Result
View All Result
  • Home
  • News
  • Software Engineering
  • Software Development
  • SAAS Applications
  • Contact Us
No Result
View All Result
SaaS News Hubb
Home SAAS Applications

Zipped Up Acumatica – Manipulating Files Part 1 .Zip

by admin
April 6, 2022
in SAAS Applications
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter


Introduction

In our years ( ASI LLC ) developing solutions within the Acumatica framework we have experienced multiple instances in which files of one type or another need to be generated and manipulated within the system.

An example usage which we will review in this article is the archiving of files attached to a document within an Acumatica instance -or- the attachment of files from within a .Zip file to a document within an Acumatica instance.

.Zip – PX.Common.Std

To utilize .ZIP files within Acumatica you will need to add reference to the PX.Common.Std .dll within your project. This .dll can be found in the bin folder of the instance install.

ZipArchive

CreateFrom

This static method returns an instance of ZipArchive which represents a .ZIP file. This method will take Stream os and bool onlyRead as parameters. 

The code example below illustrates the creation of a new zip file utilizing a new MemoryStream and setting the onlyRead argument as false to allow the addition of files to our created .Zip file.

GIST: [Creation of .Zip file (github.com)]

CreateFrom is also utilized when opening a pre-existing .ZIP file. To open a pre-existing file you must first retrieve its byte[] and create a new MemoryStream from the data, setting the bool onlyRead parameter as true. 

GIST: [Open existing .Zip file (github.com)]

AddFile

This public void method adds a file from the given name and a byte[] array of the file to be included in the .Zip file.

GIST: [Addition of file to created .Zip archive (github.com)]

GetFiles

This method returns a list of files within the .Zip archive; each file’s information is encapsulated within the inner ItemInfo class. 

GIST: [Iterate through file names in Archive (github.com)]

GetItems

This method is utilized when you only wish to pull the files from a specific directory within the archive. It utilizes the string parameter directory.

OpenRead

This method returns a Stream from a file within the archive. The file is specified by providing a file name, this name 

GIST: [Retrieving a file from ZipArchive (github.com)]

Examples

Below you will find examples of creating a new .Zip archive within Acumatica as well as taking a .Zip file attached to a document and reading / saving the contents within.

Archive Creation

The following example will retrieve the list of files attached to an Acumatica document and create a .Zip archive which is then attached.

GIST: [Opens a zip file attached to an Acumatica document (github.com)]

Archive Retrieval

The following example will retrieve the .Zip file attached to an Acumatica document and attach all documents within that archive to the source document.

GIST: [Button to create .Zip file from files attached to Acumatica document (github.com)]

With the usage of Libraries provided within an Acumatica ERP install, we are able to create and manipulate .Zip files

Happy Coding!





Source link

Previous Post

Visions of the Automotive Supply Chain Prophets

Next Post

How SMEs leverage ERP to bounce back faster & better

Related Posts

SAAS Applications

How AI Changes the Future of Sales and Marketing

May 19, 2022
SAAS Applications

Dynamics 365 CE Edit Filter Criteria Error

May 19, 2022
SAAS Applications

The Beginner’s Guide to SEO for Retailers

May 19, 2022
SAAS Applications

Internal emails are being tracked in Dynamics 365

May 18, 2022
SAAS Applications

The Future of Healthcare Facilities Management with Dynamics 365 BC

May 18, 2022
SAAS Applications

Acumatica xRP Framework: Reusable ASPX Definitions

May 18, 2022

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Popular

News

Customer Acquisition Strategy for SaaS Companies: A Complete Guide

May 19, 2022
Software Engineering

Crystal balls and clairvoyance: Future proofing in a world of inevitable change

May 19, 2022
Software Engineering

Tell a Compelling Story: Pitch Deck Components That Persuade

May 19, 2022
Software Engineering

Skyflow Privacy and Compliance with Sean Falconer

May 19, 2022
Software Development

Report | Evaluating DevSecOps Tools

May 19, 2022
Software Development

Avoiding Design by Committee

May 19, 2022
SAAS Applications

How AI Changes the Future of Sales and Marketing

May 19, 2022
SAAS Applications

Dynamics 365 CE Edit Filter Criteria Error

May 19, 2022
SAAS Applications

The Beginner’s Guide to SEO for Retailers

May 19, 2022

© 2022 Sass News Hubb All rights reserved.

Use of these names, logos, and brands does not imply endorsement unless specified. By using this site, you agree to the Privacy Policy

Navigate Site

  • Home
  • News
  • Software Engineering
  • Software Development
  • SAAS Applications
  • Contact Us

Newsletter Sign Up

No Result
View All Result
  • Home
  • News
  • Software Engineering
  • Software Development
  • SAAS Applications
  • Contact Us