Alternatives of Document storage in Dynamics CRM


CRM space is expensive, and often clients want alternatives to CRM storage for storing documents, images as these take up most of the space.

Available solutions:

  1. SharePoint Online with Dynamics CRM
  2. OneDrive for Business with Dynamics CRM

Currently, SharePoint document management is the preferred choice for most of the customers as alternative to storing email attachments and documents.

Advantages of SharePoint:

  1. SharePoint storage cost is very small about $0.20 per GB/Month compared to CRM’s $9.99/GB/Month. So CRM space is around 50 times costlier than SharePoint space.
  2. You can leverage SharePoint Document management features like:
    1. Full text Search
    2. Metadata sorting
    3. Revisions
    4. Enterprise grade security

There are 2 ways to use SharePoint for document management with Dynamics:

  1. Use SharePoint Online Integration with Dynamics CRM. This is the ideal and efficient way to use SharePoint. You can see the steps for SharePoint online integration in one of our previous blogs:

  1. Use 3rd Party tools like Power Attachment, which will migrate your File attachments (notes) and Email attachments from CRM storage to Dynamics.

More detail and pricing about Power attachments can found here:

1st approach should be the preferred way for using SharePoint as it is free, and works well. But users complain about an extra step to navigate to attachments, in which case you can go for Approach 2.

Alternative Solution:

  • The drawback with using SharePoint is if you have requirement of migrating your documents from CRM storage (Notes Attachments and Email attachments), you need to use 3rd party paid tools like Power Attachment.
  • Developing custom plugins to migrate documents to SharePoint is difficult in CRM online, since we cannot use External libraries in Sandbox plugin.

Due to above 2 reason, we can use Azure Blob storage as a possible alternative for migrating CRM documents.

What is Azure Blob storage:

Massively-scalable object storage for unstructured data

With exabytes of capacity and massive scalability, Azure Blob storage easily and cost-effectively stores from hundreds to billions of objects, in hot or cool tiers depending on how frequently data access is needed. Store any type of unstructured data—images, videos, audio, documents and more.

Azure Blob Features:

  1. Easy to Use – Geo Redundancy
  2. Robust API access
  3. Very Cheap storage space:

It costs about $0.03/ GB/ month- which is 6.5x less than SharePoint storage cost and

300x less than CRM storage cost.

Learn more about pricing here:

API Coding for CRUD Operations in Azure Blob:

I have written a sample plugin which will migrate the CRM attachment to Azure blob, and save the Azure blob file link back in CRM. The plugin is registered on Annotation entity

For this, I have used a RestHelper and BlobHelper utility code files, which have all the operations of (a) making a web request and (b) performing blob operations.

The Helper files and the CRM plugin sample can be found in the below GitHub link:

The plugin file is UploadDocumentToBlob.cs

  1. The below code from the plugin file takes the document from CRM and creates a blob using REST API:
 Entity entity = (Entity)context.InputParameters["Target"];

                string documentBlobURL = string.Empty;

              //// Optional condition to migrate attachments related to particular entity.

                //// If you want to migrate attachments for all entities, remove this CONDITION
                if (entity.Contains("isdocument") && entity.GetAttributeValue<bool>("isdocument") == true &&

                    entity.GetAttributeValue<string>("objecttypecode") == "account")


                    string storageAccount = "<storageaccountname>";

                    string filename = entity.GetAttributeValue<string>("filename");

                    string containerName = "<blobcontainername>";

                    string storageKey = "<blobstorage_accesskey>";

                    //// Read File

                    string text = entity.GetAttributeValue<string>("documentbody");


                    BlobHelper blobHelper = new BlobHelper(storageAccount, storageKey);

                    bool isUploadSuccess = blobHelper.PutBlob(containerName, filename, text);

                    //// Once blob upload is Success, get the Azure blob download-able URL of the uploaded File

                    if (isUploadSuccess)

                        documentBlobURL = string.Format("https://{0}{1}/{2}", storageAccount,

                            containerName, filename);


Let me know your suggestions on this blog, please use the comments for suggestions/ queries.

One thought on “Alternatives of Document storage in Dynamics CRM

  1. Hi Somesh,
    Thanks a lot for the custom plugin code.
    I have a small doubt though.
    While creating the plugin, the class BlobHelper shows “Missing Assembly Reference” for which you have used the reference using AzureBlobStorage.
    Now please tell me, how to include this AzureBlobStorage reference. As a class library or something else?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s