/// <summary> Closes the workingPstInstance </summary> private void CloseWorkingPst() { if (WorkingPst != null) { WorkingPst.Close(); WorkingPst = null; } WorkingPstFilePath = string.Empty; }
/// <summary> Extract message designated by entry id from specified pst to designated msg file</summary> /// <param name="pstFilePath">The pst file from which to extract the message</param> /// <param name="entryId">The entryId of the message to extract</param> /// <param name="outputMsgFile">Output location of the extracted msg file</param> public void ExtractMessage(string pstFilePath, string entryId, string outputMsgFile) { pstFilePath.ShouldNotBeEmpty(); SetWorkingPst(pstFilePath); if (!string.IsNullOrEmpty(entryId)) { Item i = WorkingPst.GetItem(EntryIdToByteArray(entryId)); if (i == null) { throw new EVException().AddDbgMsg("Error occured attempting to create native email message for Outlook: Entryid ({0}) In ({1}) was not found.", entryId, pstFilePath); } outputMsgFile.ShouldNotBeEmpty(); i.Save(outputMsgFile, true); if (!File.Exists(outputMsgFile))//create empty file in case msg file generation fails { CreateEmptyMsgFile(outputMsgFile); } } else { CreateEmptyMsgFile(outputMsgFile); } }