/// <summary> /// Gets the E mail and entry id pairs from give EdrmManager object. This information can be used for email message generation /// </summary> /// <param name="outlookEdrmManager">The outlook edrm manager.</param> /// <param name="edrmFilePath">The edrm file path.</param> /// <returns>E mail and entry id pairs </returns> private IEnumerable <KeyValuePair <string, string> > GetEMailAndEntryIdPairs(OutlookEdrmManager outlookEdrmManager, string edrmFilePath) { if (outlookEdrmManager.OutlookEmailDocumentEntities != null) { List <KeyValuePair <string, string> > EntryIdEMailMessagePair = new List <KeyValuePair <string, string> >(); foreach (OutlookEMailDocumentEntity outlookEmailDocumentEntity in outlookEdrmManager.OutlookEmailDocumentEntities) { string externalFileName = string.Empty; // Take first file in external file entities, use same name but different extension for msg file. // This msg file doesn't exist here - but will be created later in the flow with the given name, decided here.. if (outlookEmailDocumentEntity.Files != null && outlookEmailDocumentEntity.Files.Count > 0 && outlookEmailDocumentEntity.Files[0].ExternalFile != null && outlookEmailDocumentEntity.Files[0].ExternalFile.Count > 0) { ExternalFileEntity externalFile = outlookEmailDocumentEntity.Files[0].ExternalFile[0]; externalFileName = CreateFileURIForEmailMessage(Path.GetDirectoryName(edrmFilePath), externalFile.FilePath, externalFile.FileName); } EntryIdEMailMessagePair.Add(new KeyValuePair <string, string>(outlookEmailDocumentEntity.EntryId, externalFileName)); } return(EntryIdEMailMessagePair); } return(null); }
/// <summary> /// Creates file path for specified file in EDRM document. /// Handles 1) relative path from EDRM location, 2) file at EDRM location and 3) absolute path the file /// </summary> /// <param name="externalFile"> The external file entity. It represents EDRM file's external file entity </param> /// <param name="eDRMFileLocation"> The eDRM file location. </param> /// <returns> /// Complete file URI /// </returns> private static string CreateFilePath(ExternalFileEntity externalFile, string eDRMFileLocation) { // file path and file name from external file BEO string fileLocation = externalFile.FilePath, fileName = externalFile.FileName; // file at EDRM location if (string.IsNullOrEmpty(fileLocation)) { return(eDRMFileLocation + @"\" + fileName); } else { // Check if file location is absolute path // Condition 1: if file location contains ":", it's drive location. for example C:\ - hence it's absolute path. // Condition 2: if file location's first character is "\\" it's shared drive - hence it's absolute path. if (fileLocation.Contains(":") || fileLocation.Substring(0, 1).Equals("\\")) { // does last character of file location have \. if not add it. if (!fileLocation.Substring(fileLocation.Length - 1, 1).Equals(@"\")) { fileLocation = fileLocation + @"\"; } return(fileLocation + fileName); } else // relative path to the file from EDRM location { // does last character of file location have \. if not add it. if (!fileLocation.Substring(fileLocation.Length - 1, 1).Equals(@"\")) { fileLocation = fileLocation + @"\"; } return(eDRMFileLocation + @"\" + fileLocation + fileName); } } }
/// <summary> /// Creates file path for specified file in EDRM document. /// Handles 1) relative path from EDRM location, 2) file at EDRM location and 3) absolute path the file /// </summary> /// <param name="externalFile"> The external file entity. It represents EDRM file's external file entity </param> /// <param name="eDRMFileLocation"> The eDRM file location. </param> /// <returns> /// Complete file URI /// </returns> private static string CreateFilePath(ExternalFileEntity externalFile, string eDRMFileLocation) { // file path and file name from external file BEO string fileLocation = externalFile.FilePath, fileName = externalFile.FileName; // file at EDRM location if (string.IsNullOrEmpty(fileLocation)) { return eDRMFileLocation + @"\" + fileName; } else { // Check if file location is absolute path // Condition 1: if file location contains ":", it's drive location. for example C:\ - hence it's absolute path. // Condition 2: if file location's first character is "\\" it's shared drive - hence it's absolute path. if (fileLocation.Contains(":") || fileLocation.Substring(0, 1).Equals("\\")) { // does last character of file location have \. if not add it. if (!fileLocation.Substring(fileLocation.Length - 1, 1).Equals(@"\")) fileLocation = fileLocation + @"\"; return fileLocation + fileName; } else // relative path to the file from EDRM location { // does last character of file location have \. if not add it. if (!fileLocation.Substring(fileLocation.Length - 1, 1).Equals(@"\")) fileLocation = fileLocation + @"\"; return eDRMFileLocation + @"\" + fileLocation + fileName; } } }