CRM 2011 Email Attachment Archieval to Sharepoint
{CRM Databases are most of the times get filled due to Email Attachments which consumes more than 50% of the Database size. To avoid such scenarios we can use Sharepoint as an alternate solution for Email attachment storage. the Solution i have uploaded wil provide the efficient way to move the Email attachments to Sharepoint folders }

************************Detailed Notes*************************
This patch will move the Email attachments which are created as of now to sharepoint library which is provided. Sharepoint folders are created in the Document library specified in the configuration file. We can modify the condition that best suits our need.

Once Attachments are moved to Sharepoint we can delete the same form CRM Email, & provide an iframe inside Email Form which will show up the Attachments which is stored in the Share point.

 The Sharepoint Version used in the project is 2010.

/**** Added funtionality to remove invalid characters in filename while uploading file into Sharepoint******/

Since sharepoint does not support special characters like "..","~" in the file name, this has been handled in the code to remove the special characters by replacing with string.empty.

Also for the users who use On premise version they can retrieve the Email attachments using SQL select query rather than CRM service.retrievemultiple. Since SQL select statement is quite fast comparitively.


SharePoint 2013 supports the webservices but it is deprecated. the Code will work for sharepoint 2013 as well. Code conversion is needed from Webservices to Rest API methods.

Last edited Jun 20, 2014 at 7:29 AM by irah2008, version 7