/// <summary>
        /// identify and return unique document id given the conversation index.
        /// </summary>
        /// <param name="conversationIndex"> Conversation index obtained in EDRM format - metadata for outlook messages </param>
        /// <param name="allowDuplicateIds"> Duplicates are allowed by default as this code is used to calculates parent document Ids and such other purposes </param>
        /// <returns> document id </returns>
        private string GetUniqueEmailDocumentIDFromConversationIndex(string conversationIndex)
        {
            string documentId = ThreadingConstraint + EmailThreadingHelper.GetMD5Hash(ASCIIEncoding.UTF8.GetBytes(conversationIndex));

            // There is a possibility of document Ids being duplicated when created from threading constraint.
            // Hence if it's found to be a duplicate id, replace with GUID.
            if (_documentsIds.Contains(documentId))
            {
                documentId = Guid.NewGuid().ToString().Replace("-", "").ToUpper();
            }

            _documentsIds.Add(documentId);

            return(documentId);
        }
 /// <summary>
 /// Creates instance of OutlookAdapater class.
 /// </summary>
 public OutlookAdapter()
 {
     try
     {
         _documentsIds          = new List <string>();
         _documentRelationships = new List <EmailThreadingEntity>();
         // Threading constraint by default is hash of a GUID. Hash is calculated to set the size to 32 to characters. rest 32 characters come from each document.
         _threadingConstraint = EmailThreadingHelper.GetMD5Hash(Guid.NewGuid().ToByteArray());
         _errors = new List <EVException>();
         _filterByMappedFields  = new List <FieldMapBEO>();
         IsDeleteTemporaryFiles = DeleteExtractedFilesOptions.DeleteNone; // Initialize if temporary files can be deleted
     }
     catch (EVException evException)
     {
         ((Exception)evException).Trace().Swallow();
     }
     catch (Exception exception)
     {
         string errorCode = ErrorCodes.CreateOutlookAdapterInstanceFailure;
         exception.AddErrorCode(errorCode).Trace().Swallow();
     }
 }
 /// <summary>
 /// identify and return document id given the conversation index.
 /// </summary>
 /// <param name="conversationIndex"> Conversation index obtained in EDRM format - metadata for outlook messages </param>
 /// <returns> document id </returns>
 private string GetEmailDocumentIDFromConversationIndex(string conversationIndex)
 {
     return(ThreadingConstraint + EmailThreadingHelper.GetMD5Hash(ASCIIEncoding.UTF8.GetBytes(conversationIndex)));
 }