Outlook EWS:保存EML时是否将userproperties添加到EML?
在我的一些邮件中,我通过Outlook存储了一些用户属性Outlook EWS:保存EML时是否将userproperties添加到EML?,outlook,exchangewebservices,eml,Outlook,Exchangewebservices,Eml,在我的一些邮件中,我通过Outlook存储了一些用户属性 item.UserProperties.Add("CustID", Outlook.OlUserPropertyType.olText) item.UserProperties("CustID").Value = custID.ToString 在未安装Outlook的Pc(服务器)上,我想以EML形式下载邮件并存储用户属性(如“CustID”等) 我的EML保存代码: Private Sub Form1_Load(sender As
item.UserProperties.Add("CustID", Outlook.OlUserPropertyType.olText)
item.UserProperties("CustID").Value = custID.ToString
在未安装Outlook的Pc(服务器)上,我想以EML形式下载邮件并存储用户属性(如“CustID”等)
我的EML保存代码:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim service As New ExchangeService(ExchangeVersion.Exchange2013)
service.Credentials = New WebCredentials("my@email.com", "mypsw")
service.Url = New System.Uri("https://outlook.office365.com/EWS/Exchange.asmx")
Dim entryID As String = "00000000C802F40668D27342B788D508E9210A67005DF9A7DEF7194A418C8515031D4262280000E00005DF9A7DEF7194A418C8515031D4262280002A9D18B320000"
Dim id As New ItemId(Convert(service, "my@email.com", entryID))
Dim email As EmailMessage = EmailMessage.Bind(service, id)
Dim ps As PropertySet = New PropertySet(ItemSchema.MimeContent)
email.Load(ps)
Using fileStream = New IO.FileStream("D:\sandbox\_email_test.eml", IO.FileMode.Create)
fileStream.Write(email.MimeContent.Content, 0, email.MimeContent.Content.Length)
End Using
End Sub
Private Function Convert(service As ExchangeService, mailbox As String, entryID As String) As String
Dim originalID As New AlternateId()
originalID.Format = IdFormat.HexEntryId
originalID.Mailbox = mailbox
originalID.UniqueId = entryID 'EntryId retrieved from email in Outlook
Dim altBase As AlternateIdBase = service.ConvertId(originalID, IdFormat.EwsId)
Dim convertedID As AlternateId = DirectCast(altBase, AlternateId)
Dim strConvertedID As String = convertedID.UniqueId
Return strConvertedID
End Function
有没有办法在EML中存储userproperties?如果是,如果我双击EML在Outlook中打开它,我可以从EML读回userproperties吗
谢谢 用户属性是Mapi/扩展属性,不包括在消息的模拟流中。如果您将属性添加为X-Header,则它们将在MimeSteam中可用,否则您最好将消息导出为MSG文件,这将为您提供所有MAPI属性的完全保真度。要将其导出为MSG,您需要使用Outlook,如果需要自动化,还可以查看类似于redemption的内容 干杯 峡谷