Thursday, December 20, 2018

Bulk Export Dynamics GP Document Attachments using .NET

By Steve Endow

2/20/2023 UPDATE:  Version 1.30 released

A user on the GPUG Open Forum asked if there was a way to export all of the documents that are attached to Dynamics GP customers.

I previously wrote a blog posts showing how to export a single document attachment using BCP:

And another showing how to export a single document attachment using .NET:

But the BCP solution is only for a single attachment, and the .NET solution didn't have any features for filtering or organized export of attachments.

So today I updated the .NET solution to allow the user to select a Database, Record Type, and indicate whether Deleted attachments should be exported.

Once those options are selected, the user can retrieve a list of all of the attachments, which shows the type, the associated record number, the file name, and file size.

The user can then select an export path and click a button to export all of the attachments to disk.

The application and full source code can be downloaded here:

       Version 1.30:  Precipio SaveDocAttachFiles

Version 1.30 adds support for the EFOQUS SharePoint Connector for Business Central

-Save files as  <Attachment Name>!<BC Table Num>!<Record ID>

-Save files as  <Attachment Name>!<BC Table Num>!<BC Record Type Num><Record ID>

New record types can be added by editing the SaveDocAttachFiles.exe.config file. Locate the RecordTypes setting at the bottom of the file and add new name + code pairs to the list.

Please note that this .NET application was assembled in a few hours, and is not a refined, polished, commercial software release.  It does not have lots of configuration options or error handling, so you will want to test it in a TEST environment and be aware that it may need some modifications to work in your environment.

Steve Endow is a Microsoft MVP in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Twitter and YouTube


  1. Hey there,

    I work as IT within a company that uses the Key2Act/Signature products. These have their own modules within GP and from what I can tell these products utilize the same 'Document List' window for their attachments. What would be the best way to configure your tool to include these document types?

  2. Hi,

    I would start by querying the CO00101 table and looking at the value in the ODESCTN field for records related to Signature Series attachments.

    In this post, I list the 'record type' codes used by standard GP document attachments:

    Once you verify that the Signature Series attachments are listed in that table, identify the different ODESCTN values used by Signature Series.

    Once you have those, open the SaveDocAttachFiles.exe.config file in Notepad. Locate the "RecordTypes" setting near the bottom and add the new name + code pairs for the Signature Series record types.

    The name and code values are separated by a comma, and each pair is separated by a semi-colon.

    If you have any questions, post a reply here, or email me at steveendow /at/ gmail /dot/ com

  3. Steve - I would like to learn more about your .NET doc attach export solution and your GP Search tools. The onedrive links do not appear to be valid. Can you FWD me valid links?

    1. Hi, I just tested the OneDrive link, and it seems to work for me, so I'm wondering if it is getting blocked on your end.

      You can submit a contact request on my web site and I can send you an alternate link to try.

      I didn't realize that this download isn't available on my Precipio Services web site, so I'll try to add a page for it under the Products section of my site.

  4. Very Cool Steve, found it interesting that when looking at Purchase Orders many attachments don't have a PO but I supposed you aren't looking at historical POs?

    Arthur A


All comments must be reviewed and approved before being published. Your comment will not appear immediately.

How many digits can a Business Central Amount field actually support?

 by Steve Endow (If anyone has a technical explanation for the discrepancy between the Docs and the BC behavior, let me know!) On Sunday nig...