针对 Outlook Interop MailItem 的自定义属性
我将自定义属性添加到 Microsoft.Office.Interop.Outlook.MailItem 对象,如下所示:
Public Const SharePointSiteUrl As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteUrl"
Public Const SharePointSiteFolder As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteFolder"
Public Const SharePointSiteUsername As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteUsername"
Public Const SharePointSitePassword As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSitePassword"
...
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSiteUrl, sharepointSite)
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSiteFolder, sharepointFolder)
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSiteUsername, sharepointUserName)
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSitePassword, sharepointPassword)
执行上述四个调用后,我测试是否可以使用 PropertyAccessor.GetProperty 访问属性,它们就在那里。
然后,我使用 .SaveAs 将电子邮件保存到目录中。当我稍后打开邮件项目并尝试访问属性时,出现以下错误:
email.PropertyAccessor.GetProperty(SharePointSiteFolder)
The property "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteFolder" is unknown or cannot be found.
I am adding custom properties to a Microsoft.Office.Interop.Outlook.MailItem object like so:
Public Const SharePointSiteUrl As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteUrl"
Public Const SharePointSiteFolder As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteFolder"
Public Const SharePointSiteUsername As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteUsername"
Public Const SharePointSitePassword As String = "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSitePassword"
...
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSiteUrl, sharepointSite)
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSiteFolder, sharepointFolder)
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSiteUsername, sharepointUserName)
email.PropertyAccessor.SetProperty(OutlookHelper.SharePointSitePassword, sharepointPassword)
After the four calls above have been executed, I test if I can access the properies using PropertyAccessor.GetProperty, and they are there.
I then save the email to a directory using .SaveAs. When I open the mail item later and try and access the properties I get the following error:
email.PropertyAccessor.GetProperty(SharePointSiteFolder)
The property "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/SharePointSiteFolder" is unknown or cannot be found.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
ItemProperties
代替?Can you use
ItemProperties
instead?