Save Documents and Emails to Server Folder

Saves binary data to server disk instead of database.

By default, documents and emails are saved into server database as well as all other eWay-CRM data. In case you are using free Express edition of SQL Server, the maximum size of a database is limited (4-10 GB depending on SQL Server version). For small and some medium businesses with average clerical work style (mainly text files, pdf etc.) the storage could serve for several years. However, by a company that works mainly with large-volume files (scans of project documentation, non-compressed picture formats, emails with large attachments) the limited size limit of the database can be reached quite soon.

To prevent reaching the database limit as quick, eWay-CRM gives you an option of saving binary data (documents, images, emails) separately into a directory on server. Often, by activation of this setting, you may delay or completely avoid investment on purchasing higher versions of SQL Server.

Activation

ATTENTION: If the web service is running on a different server than the SQL server, there could be issues with documents - in the case, when document revisions are saved to the path to which the SQL server does not have permission. When a user wants to return to an older revision, the CLR procedure works with the file and it is situated to the SQL server - so the user that runs te SQL server must have permission to this path and the path must be visible to the SQL server.

In order to activate saving binary data into an external directory, you need to edit Web.config file which is to be found in the web service folder. Add these two rows into the source code to the section <appSettings>:

<add key="BinaryDataDirectory" value="C:\Warehouse\"/>
<add key="StoreBinaryDataInFileSystem" value="1"/>
<add key="StoreBinaryDataByDate" value="1"/>
Key Values Description
BinaryDataDirectory Specific folder path Defines path to the folder where documents and email will be stored. The folder has to be already created on the hard drive.
StoreBinaryDataInFileSystem 0 (turned off) or 1 (turned on) It turns on/off the functionality of saving items into folder. If the value is 0, items are saved right to the database.
StoreBinaryDataByDate 0 (turned off) or 1 (turned on)

If the key is turned on, the new folder structure is created - files are in folders by year and month.

Adding these rows to web.config file should look like this example:

Transfer of Existing Files

Steps from above helps you to activate saving emails and documents to a folder system instead of to database. However, in case you need to save space in your database system, we also recommend you to move already existing files to this folder. To move the files follow these steps:

  1. Turn off eWayTimer service
  2. Turn off the Web Service - rename file "_App_Offline.htm" to "App_Offline.htm"
  3. Launch MoveBinaryDataToFileSystem.exe in the bin folder in web service folder
  4. Wait until the process is successfully completed (if an error caused by incomplete files occurs during the transfer, please follow instructions in this article)
  5. Start the web service again - back in the web service folder rename
    "App_Offline.htm" to "_App_Offline.htm"
  6. Turn the eWayTimer service on again

    If the process is completed, you have all documents and emails saved in your folder and you will save there all new files.

    Backwards Import to Database

    In the case that you imported your documents and emails to the file structure, you can revert the process if you change your opinion and you will want to save documents and emails again into the database structure. Steps are similar to the previous manual, the main difference is in the step 3:

    1. Turn off eWayTimer service.
    2. Turn off the Web Service - rename file "_App_Offline.htm" to "App_Offline.htm".
    3. Launch MoveBinaryDataToFileSystem.exe in the bin folder in web service folder but you need to do it from the Command Line Interface - open the file in the bin folder with his parameter. 
    MoveBinaryDataToFileSystem.exe /revert
    1. Wait until the process is successfully completed.
    2. Start the web service again - back in the web service folder rename 
      "App_Offline.htm" to "_App_Offline.htm".
    3. Turn the eWayTimer service on again.

      If the process is completed, you have all documents and emails saved in the database structure and you will save there all new files.

      Change Structure of Saved Documents

      Documents can be saved each to its own folder or even into a subfolder by year and month when they were created. This is set by this key:

      <add key="StoreBinaryDataByDate" value="1"/>

      If 0 is inserted, each document is saved to own folder where are its versions. The root folder can have a huge amount of folders. Used system is: /ItemGUID/Version/.

      If the value is 1, documents are saved to folders by year and month. Used system is: /Year-Month/ItemGUID/Version/.

      You can change documents structure even when you are already using one. This would lead to the state when you have part of documents in old structure and part in the new one. Please follow these steps:

      1. Make a backup of documents whose structure will be changed.
      2. Turn off eWayTimer service.
      3. Turn off the Web Service - rename file "_App_Offline.htm" to "App_Offline.htm".
      4. Make sure that there is StoreBinaryDataByDate parameter presented in the web.config file and its value is 1.
      5. Run MoveBinaryDataToFileSystem.exe file in the bin folder of your web service. You need to run it with this parameter:
      MoveBinaryDataToFileSystem.exe /rearrange
      1. Wait until the process is successfully completed. Old documents are moved to the new folder structure.
      2. Start the web service again - back in the web service folder rename "App_Offline.htm" to "_App_Offline.htm".
      3. Turn the eWayTimer service on again.

      Error Log

      Errors are saved to the eWayTimer log.