How to download all attachments in MS CRM/Data Verse – MS CRM Attachment downloader XrmToolBox Plugin

Recently I developed my first XrmToolBox Plugin : Attachment downloader for MS CRM ( https://www.xrmtoolbox.com/plugins/AttachmentDownloader/ )which can be used by business users to download attachments from any table in CE.

Long ago I developed a windows application to download attachments ( https://vishalgrade.com/2018/01/22/ms-crm-attachment-downloader/ ) which was for on-premise CRM.

I was getting many requests to add the capability to connect to online CRM as well in same tool. I thought why not build a plugin in our old savior tool XrmToolBox and add the additional capability to connect to online crm.

Now quickly jumping to show you how you can use it:

Step 1: Go to Xrmtoolbox and click on configuration>Tool Library

Step 2: Search for attachment downloader in search box

Select the Attachment Downloader with bug green icon and click Install

Step 3: Connect to your CRM organization in xrmtoolbox and look for Attachment Downloader plugin:

Step 4: Select the location to download

Step 5: Paste the fetchxml of table/records for which you want to download attachments.

For eg: I wanted to download all attachments related to leads so I pasted this fetch xml.

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
	<entity name='lead'>
		<attribute name='fullname' />
	</entity>
</fetch>

Note: It’s always a good idea to download notes in chunks by applying filter in fetch xml. If you try to download all notes against a table, there can be huge no of notes which will be downloaded and operation will take time.

Step 6: Click on download button:

It’ll 1st show total no of notes records to b downloaded.

Click yes, if you want to download those notes otherwise click No.

Step 7: Once you click on Yes, you should see the downloaded files details on the screen and downloaded files in the selected folder:

So this was how you can use this tool to download attachments from any table in MS CRM.

Open for any suggestion or feedback. If you like this tool, please rate it on XrmToolBox.

This plugin is open source and code is available at https://github.com/vgrade/XrmToolBoxAttachmentDownloader

You are welcome for any contribution for enhancing the capability of the plugin.

Update 12 May 2022 : Version 1.0.8

Bug Fixed :

  1. Fixed the bug where files with duplicate names were not being downloaded properly. Tool was just downloading 1 file for all files with same name. It now create files with different names like file.txt, file (2).txt, file (3).txt in your local folder in case multiple files having same names are found in attachment.

Features:

  1. Tool now downloads 1 CSV file named “AttachmentDetails.csv” which have all the information of notes downloaded which is displayed on tool result window.

22 thoughts on “How to download all attachments in MS CRM/Data Verse – MS CRM Attachment downloader XrmToolBox Plugin

Add yours

  1. Hello Vishal, a pleasure to greet you, I was testing the plugin, but it does not throw me any document, I would appreciate a lot if you tell me if I need something to make it work. I appreciate your guidance.

    https://drive.google.com/file/d/1xMBq4jf_-ua85rJY60sHxqibcNL-56_E/view?usp=sharing
    https://drive.google.com/file/d/18blIo1gC42f1P6yF2PTQDVZLWpDFr4Y9/view?usp=sharing
    https://drive.google.com/file/d/1Dc_Gwp7sfetLeUQTcSjkAJg9o3BfDCIz/view?usp=sharing
    https://drive.google.com/file/d/1B1aIy66AQeS0vfizU9nZP-Zdi5wzM9kn/view?usp=sharing

    regards

    Liked by 1 person

    1. Hi Victor, Please change your fetch xml. This plugin need the fetch xml of records against which notes are uploaded. For example if want to download notes attached to a particular account, please provide fetch xml of account table with condition to select particular account. It automatically downloads the notes attached to the resultant records of fetch xml execution. Using annotation fetchxml will not work. Check out in my blog where I have used lead’s fetch xml to download all attachments from lead records.

      Like

  2. Hi Vishal, I’m hopeful this tool you built will help me. Is there a way to restrict the amount of attachments to download? I need to gather a sample set of 100 attachments but my date filter seems to be ignored as the results window always says 8296 and I know it is less than that for this date range. Here is my fetchxml:

    Like

  3. Hi Vishal, thanks so much for this tool! How does the tool handle duplicates? So when I have the same filename in different data records but all records are inside the fetch xml.
    I want to export all attachments of one entity. The tool finds 4485 notes records. When I click yes then there comes an timeout (I think): System.ServiceModel.CommunicationException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
    When I filter with the creation date a few years it works. But when I sum all files from all years I have a total of 3609 files.

    Like

    1. Hi Markus,

      I appreciate you took time using the tool and sharing your valuable feedback with me. Thanks for your valuable feedback.

      Fixed the bug where files with duplicate names were not being downloaded properly. Tool was just downloading 1 file for all files with same name.
      It now create files with different names like file.txt, file (2).txt, file (3).txt in your local folder in case multiple files having same names are found in attachment.

      Please download the latest version to see the changes.

      Please rate this plugin if you like it at https://www.xrmtoolbox.com/plugins/AttachmentDownloader/.

      Thanks,
      Vishal Grade

      Like

  4. Hello Vishal,

    Thank you for creating this tool, which is very helpful.

    I also have the same question as Markus regarding the duplicate file name. Say two notes retrieved in the fetchXML have the same name, does the program save the second as a different file name?

    Secondly, this is a suggestion for an improvement – it would be so useful to be able to export the details of all the files downloaded including the “regarding” guid, so that they can be referenced easily. Am I missing something maybe to be able to do this?

    Thank you very much again for the tool!

    Dafydd.

    Like

    1. Hi Lewis,

      I appreciate you took time using and sharing your valuable feedback with me. Thanks for your valuable feedback.

      I have fixed the bug where files with duplicate names were not being downloaded properly.
      It now create files duplicate file like file.txt, file (2).txt, file (3).txt in your local folder in case duplicate file names are found in attachment.

      I have worked on your second feedback as well. Please check update section of the blog for more details.

      Please rate this plugin if you like it at https://www.xrmtoolbox.com/plugins/AttachmentDownloader/.

      Please download the latest version to see the changes.

      Thanks,
      Vishal Grade

      Like

    1. Hi Kevin,
      I’m also trying to download email attachments. Did you succeed? Would appreciate any help.
      All the best,
      Lucas

      Like

  5. Hello… is it possible to get past the 10k record limit it cycles through?

    I have an entity with 130k records and it hard stops at 10k. Great tool btw, just don’t know how to move forward

    Like

    1. Hey, Temporarily you could try filtering your record by date or something so that you don’t get lot of records at a time. I’ll see if I can fix the issue but meanwhile try adding some condition in your fetch xml to download for smaller set of records.

      Like

  6. I am downloading attachments from Contact object.The Name field have commas in it,because of it excel is considering as separate column. The file export is completely messed up .Is there a way to solve this issue.?

    Row Id,Record Name,Record Guid,Notes Record Guid,File Name,Status,Message
    1,Harman, Andi,b9ab0f9c-a006-eb11-a814-000d3a1bbde1,4ccd2d1d-680d-eb11-a814-000d3a1bbde1,Called Customer.snote,Downloaded,
    2,Gardner, Natasha,a7ac0f9c-a006-eb11-a814-000d3a1bbde1,8dcd2d1d-680d-eb11-a814-000d3a1bbde1,Called Customer (2).snote,Downloaded,
    3,[not provided],caa107a8-a006-eb11-a814-000d3a1bbde1,83ce2d1d-680d-eb11-a814-000d3a1bbde1,Called Customer (3).snote,Downloaded,

    Like

  7. Hi Vishal,
    Thank you for creating the tool. I’m trying to download email attachments is that something it supports? I’ve tried using the ‘attachments’ entity but no luck.
    All the best,
    Lucas

    Like

  8. Dear Vishal,

    Great tool in essence! I promises exactly what I need, but I run into a problem!
    I tried retrieving notes from account but:
    With any document in the list, it reports a failed status with the message: “Failed in converting file to base 64 or writing file to output location. Exception: The input is not a valid Base-64 string as it contains a non-base 64 character”.
    Any suggestion how to proceed from there?

    kind regards,
    Henk

    Like

Leave a comment

Blog at WordPress.com.

Up ↑