Difference between revisions of "Bulk Import of Email Files"

[unchecked revision][unchecked revision]
m (picture added)
Line 3: Line 3:
 
When archiving email files, MailStore only allows archiving of individual email files (PST, MBOX) or directories which contain email files of one user (EML, MSG).
 
When archiving email files, MailStore only allows archiving of individual email files (PST, MBOX) or directories which contain email files of one user (EML, MSG).
  
The following describes how to archive all PST-, MBOX-, EML- or MSG-files of all users in a few steps, using the Python bulk import script.
+
The following describes how to archive all PST-, MBOX-, EML- or MSG-files of all users in a few steps, using a bulk import script written in Python.
  
The bulk import script expects the email files in folders that are named after  the corresponding MailStore users. Such a folder structure can easily be created by another included script.
+
The bulk import script expects the email files in folders that are named after  the corresponding MailStore users. Such a folder structure can easily be created by another script included in the [[Media:MailStoreScripts.zip‎|scripting package]].
  
If you want to archive PST- or MBOX-files of one user only, you can use the [[Windows Batch Scripts|bulkImportPST.bat- and bulkImportMBOX.bat-]]scripts from  the [[Media:MailStoreScripts.zip‎|scripting package]]. The installation of Python is not required for this purpose.
+
If you want to archive PST- or MBOX-files of one user only, you can use the [[Windows Batch Scripts|bulkImportPST.bat- and bulkImportMBOX.bat-]]scripts from  the [[Media:MailStoreScripts.zip‎|scripting package]]; the installation of Python is not required in that case.
  
 
= Preparing Python =
 
= Preparing Python =
  
 
The provided scripts are written in Python. Python 3.2 or newer is required as well as the [Media:MailStoreScripts.zip‎|scripting package]].
 
The provided scripts are written in Python. Python 3.2 or newer is required as well as the [Media:MailStoreScripts.zip‎|scripting package]].
Python con be downloaded from the Python website [http://www.python.org www.python.org]. The <tt>mailstoreapi</tt> directory from the scripting package must be moved into the <tt>site-packages</tt> directory of your Python installation. The default location of Python 3.3 under Windows is <tt>C:\Python33\Lib\site-packages</tt>. The scripts themselves can be stored in any other location such as "My Documents".
+
Python can be downloaded from the Python website [http://www.python.org www.python.org]. The <tt>mailstoreapi</tt> directory from the scripting package must be moved into the <tt>site-packages</tt> directory of your Python installation; in Python 3.3 for Windows its default location is <tt>C:\Python33\Lib\site-packages</tt>. The scripts themselves can be stored in any other location such as "My Documents".
  
 
= Preparing the Folder Structure =
 
= Preparing the Folder Structure =
  
The scripting package contains the <tt>createUserFolders.py</tt> script. This prepares the folders by fetching a list of existing MailStore Server users and creating folders with the same names in the filesystem. The actual bulk archiving script uses these folder names to assign the files to their appropriate users in MailStore.
+
The scripting package contains the <tt>createUserFolders.py</tt> script which prepares the folders by fetching a list of existing MailStore Server users and creating folders with the same names in the filesystem. The actual bulk archiving script uses these folder names to assign the enclosed files to the corresponding users in MailStore.
  
 
The [[MailStore Server Administration API]] must be enabled in the [[MailStore Server Service Configuration]].
 
The [[MailStore Server Administration API]] must be enabled in the [[MailStore Server Service Configuration]].
  
After installing Python, the script can be modified by right-clicking on it, then selecting ''IDLE'', the supplied Python editor. Adjust the values ​​of <tt>USER</tt>, <tt>PASSWORD</tt>, <tt>HOST</tt> and <tt>PORT</tt> according to your installation.
+
After installing Python, the script can be modified by right-clicking on it, then selecting ''IDLE'', the supplied Python editor. Adapt the values ​​of <tt>USER</tt>, <tt>PASSWORD</tt>, <tt>HOST</tt> and <tt>PORT</tt> to your installation.
  
 
The <tt>rootpath</tt> variable contains the path where the folders will be created.
 
The <tt>rootpath</tt> variable contains the path where the folders will be created.
Line 30: Line 30:
 
Before executing the bulk import script, a new archiving profile that corresponds to the email files (PST, MBOX, EML/MSG) to be archived must be created manually in MailStore Server.
 
Before executing the bulk import script, a new archiving profile that corresponds to the email files (PST, MBOX, EML/MSG) to be archived must be created manually in MailStore Server.
  
The properties of the archiving profile get applies to all read files. For instance, if your exclude or include folders or define filters, it will be applied to all files you archive from.
+
The settings in this archiving profile apply to all read files. For instance, if your exclude or include folders or define filters, they will be applied to all files you archive from.
  
The path to the PST or MBOX file, or the folder containing EML/MSG files, that you specify in the profile does not play a role, as it gets overwritten by the bulk import script. Additionally sub folder are recognized when archiving EML/MSG files, whereas MailStore headers are always ignored.
+
The path you specify in the profile to the PST or MBOX file, or the folder containing EML/MSG files, is irrelevant, as it gets overwritten by the bulk import script. Additionally, sub folders are recognized when archiving EML/MSG files, whereas MailStore headers are always ignored.
  
<p class="msnote">'''Important Notice:''' If you want to archive PST files, Microsoft Outlook must be installed on the machine where the archiving profile is executed.</p>
+
<p class="msnote">'''Important Notice:''' If you want to archive PST files, Microsoft Outlook must be installed on the machine where the archiving profile is run.</p>
  
The created profiles must be named after the file type to archive, e.g. <tt>templateBulkImportEMLMSG</tt>, <tt>templateBulkImportPST</tt> or <tt>templateBulkImportMBOX</tt>.
+
Depending on the file type to be archived, the created profiles must be named <tt>templateBulkImportEMLMSG</tt>, <tt>templateBulkImportPST</tt> or <tt>templateBulkImportMBOX</tt>.
  
 
= Filling the Folders =
 
= Filling the Folders =
  
Put the email files of the users to archive into the corresponding folders under the <tt>rootpath</tt>. A simultaneous import of multiple file types is not supported. Would you like to archive PST and MBOX files, a separate run is necessary for each.
+
For each user, put the email files to be archived into the corresponding folders under the <tt>rootpath</tt>. A simultaneous import of different file types is not supported. If you want to archive PST and MBOX files, a separate run is necessary for each.
  
 
= Archiving =
 
= Archiving =
  
Archiving is done by the <tt>bulkImport.py</tt> script. Before execution it must be adjusted to your MailStore Server installation by using ''IDLE'' (see ''Preparing the Folder Structure'').
+
Archiving is done by the <tt>bulkImport.py</tt> script. Before running it must be adapted to your MailStore Server installation by using ''IDLE'' (see ''Preparing the Folder Structure'').
  
To retrieve the correct parameter values for your installation, open the properties of an existing scheduled task of a MailStore archiving profile and copy the ''Run'' command line into a text editor of your choice.<br/>Alternatively you may pretend creating a new archiving profile for an existing archiving profile, by clicking on ''Schedule'' and then ''Copy CMD''. Now open a text editor and paste the command line to see all parameter values. It is now safe to cancel the creation of a new scheduled task.
+
To retrieve the correct parameter values for your installation, open the properties of an existing scheduled task of a MailStore archiving profile and copy the ''Run'' command line into a text editor of your choice.<br/>Alternatively you may pretend creating a new archiving profile for an existing archiving profile, by clicking on ''Schedule'' and then ''Copy CMD''. Now open a text editor and paste the command line to see all parameter values. It is now safe to cancel the creation of the new scheduled task.
  
 
[[File:Cmd_values_en.png|center|640px]]
 
[[File:Cmd_values_en.png|center|640px]]
  
For the <tt>MAILSTORECMD</tt> variable, ''MailStoreCmdSilent.exe'' can be used instead of ''MailStoreCmd.exe''. This prevents MailStore from displaying empty command line windows while archiving.
+
For the <tt>MAILSTORECMD</tt> variable, ''MailStoreCmdSilent.exe'' can be used instead of ''MailStoreCmd.exe''. This prevents MailStore Server from displaying empty command line windows while archiving.
  
 
The bulk import script requires the encrypted version of the password. This corresponds to the value of the <tt>--pc=</tt> parameter.
 
The bulk import script requires the encrypted version of the password. This corresponds to the value of the <tt>--pc=</tt> parameter.
  
Analog to the <tt>createUserFolders.py</tt> script, <tt>rootpath</tt> points to the folder containing the actual user folders.
+
Similar to the <tt>createUserFolders.py</tt> script, <tt>rootpath</tt> points to the folder that contains the actual user folders.
The <tt>filetype</tt> variable can have one of the following values corresponding to the file type to archive: <tt>pst</tt>, <tt>mbox</tt> or <tt>emlmsg</tt>.
+
The <tt>filetype</tt> variable can have one of the following values according to the file type to archive: <tt>pst</tt>, <tt>mbox</tt> or <tt>emlmsg</tt>.
  
In ''IDLE'', pressing the F5 key executes the script.
+
In ''IDLE'', press the F5 key to run the script.
  
 
= Logging =
 
= Logging =
  
While the archiving process runs, the progress can be monitored in the status window. The message ''exitcode: 0'' means, that the file or folder has been archived successfully. A different output would show the error. The task logs of the procedures are store in the <tt>rootpath</tt> folder and are named as follows:
+
While the archiving process runs, its progress can be monitored in the status window. The message ''exitcode: 0'' means that the file or folder has been archived successfully. A different output would show the error. The task logs of the procedures are stored in the <tt>rootpath</tt> folder and are named as follows:
  
 
   Date-Time-User-File.log (PST,MBOX)
 
   Date-Time-User-File.log (PST,MBOX)
Line 69: Line 69:
 
   Date-Time-User.log (EML/MSG)
 
   Date-Time-User.log (EML/MSG)
  
The table ''Recent Results'' in MailStore Client gives you an overview of all executed archiving profiles. Failed runs can by easily identified by its start time, as the file names of the log files begin with the same value.
+
The table ''Recent Results'' in MailStore Client gives you an overview of all run archiving profiles. Failed runs can by easily identified by their start time as the file names of the log files begin with the same value.
  
 
[[de:Massenimport von E-Mail-Dateien]]
 
[[de:Massenimport von E-Mail-Dateien]]

Revision as of 12:21, 18 April 2013

+++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++ DRAFT +++

When archiving email files, MailStore only allows archiving of individual email files (PST, MBOX) or directories which contain email files of one user (EML, MSG).

The following describes how to archive all PST-, MBOX-, EML- or MSG-files of all users in a few steps, using a bulk import script written in Python.

The bulk import script expects the email files in folders that are named after the corresponding MailStore users. Such a folder structure can easily be created by another script included in the scripting package.

If you want to archive PST- or MBOX-files of one user only, you can use the bulkImportPST.bat- and bulkImportMBOX.bat-scripts from the scripting package; the installation of Python is not required in that case.

Preparing Python

The provided scripts are written in Python. Python 3.2 or newer is required as well as the [Media:MailStoreScripts.zip‎|scripting package]]. Python can be downloaded from the Python website www.python.org. The mailstoreapi directory from the scripting package must be moved into the site-packages directory of your Python installation; in Python 3.3 for Windows its default location is C:\Python33\Lib\site-packages. The scripts themselves can be stored in any other location such as "My Documents".

Preparing the Folder Structure

The scripting package contains the createUserFolders.py script which prepares the folders by fetching a list of existing MailStore Server users and creating folders with the same names in the filesystem. The actual bulk archiving script uses these folder names to assign the enclosed files to the corresponding users in MailStore.

The MailStore Server Administration API must be enabled in the MailStore Server Service Configuration.

After installing Python, the script can be modified by right-clicking on it, then selecting IDLE, the supplied Python editor. Adapt the values ​​of USER, PASSWORD, HOST and PORT to your installation.

The rootpath variable contains the path where the folders will be created.

Press F5 to run the script. A security question follows.

Preparing the Archiving Profile

Before executing the bulk import script, a new archiving profile that corresponds to the email files (PST, MBOX, EML/MSG) to be archived must be created manually in MailStore Server.

The settings in this archiving profile apply to all read files. For instance, if your exclude or include folders or define filters, they will be applied to all files you archive from.

The path you specify in the profile to the PST or MBOX file, or the folder containing EML/MSG files, is irrelevant, as it gets overwritten by the bulk import script. Additionally, sub folders are recognized when archiving EML/MSG files, whereas MailStore headers are always ignored.

Important Notice: If you want to archive PST files, Microsoft Outlook must be installed on the machine where the archiving profile is run.

Depending on the file type to be archived, the created profiles must be named templateBulkImportEMLMSG, templateBulkImportPST or templateBulkImportMBOX.

Filling the Folders

For each user, put the email files to be archived into the corresponding folders under the rootpath. A simultaneous import of different file types is not supported. If you want to archive PST and MBOX files, a separate run is necessary for each.

Archiving

Archiving is done by the bulkImport.py script. Before running it must be adapted to your MailStore Server installation by using IDLE (see Preparing the Folder Structure).

To retrieve the correct parameter values for your installation, open the properties of an existing scheduled task of a MailStore archiving profile and copy the Run command line into a text editor of your choice.
Alternatively you may pretend creating a new archiving profile for an existing archiving profile, by clicking on Schedule and then Copy CMD. Now open a text editor and paste the command line to see all parameter values. It is now safe to cancel the creation of the new scheduled task.

Cmd values en.png

For the MAILSTORECMD variable, MailStoreCmdSilent.exe can be used instead of MailStoreCmd.exe. This prevents MailStore Server from displaying empty command line windows while archiving.

The bulk import script requires the encrypted version of the password. This corresponds to the value of the --pc= parameter.

Similar to the createUserFolders.py script, rootpath points to the folder that contains the actual user folders. The filetype variable can have one of the following values according to the file type to archive: pst, mbox or emlmsg.

In IDLE, press the F5 key to run the script.

Logging

While the archiving process runs, its progress can be monitored in the status window. The message exitcode: 0 means that the file or folder has been archived successfully. A different output would show the error. The task logs of the procedures are stored in the rootpath folder and are named as follows:

 Date-Time-User-File.log (PST,MBOX)

or

 Date-Time-User.log (EML/MSG)

The table Recent Results in MailStore Client gives you an overview of all run archiving profiles. Failed runs can by easily identified by their start time as the file names of the log files begin with the same value.