//ExEnd:SourceEmailFilePath /// <summary> /// Gets email file's metadata /// </summary> public static void GetEmailMetadata() { try { //ExStart:GetEmailMessageMetadata // initialize EmlFormat EmlFormat emlFormat = new EmlFormat(Common.MapSourceFilePath(filePath)); // get metadata EmlMetadata metadata = emlFormat.GetEmlInfo(); // display metadata Console.WriteLine("CC: " + metadata.CC); Console.WriteLine("Mail Address From: " + metadata.MailAddressFrom); Console.WriteLine("Subject: " + metadata.Subject); Console.WriteLine("Attachments: " + metadata.Attachments[0]); //ExEnd:GetEmailMessageMetadata } catch (Exception exp) { Console.WriteLine(exp.Message); } }
private List <PropertyItem> AppendMetadata(EmlMetadata metadataArray, List <PropertyItem> values) { foreach (MetadataProperty metadataPropert in metadataArray) { if (metadataPropert.Value != null) { if (!metadataPropert.Value.Type.ToString().Equals("StringArray")) { values.Add(new PropertyItem(metadataPropert.Name, metadataPropert.Value.ToString(), metadataPropert.IsBuiltInProperty)); } else { string strValues = "[" + metadataPropert.Value.ToStringArray().Count().ToString() + "] - "; foreach (string str in metadataPropert.Value.ToStringArray()) { strValues += str + " ,"; } values.Add(new PropertyItem(metadataPropert.Name, strValues.Trim(','), metadataPropert.IsBuiltInProperty)); } } } return(values); }