获得Outlook VSTO解决方案的发件人证书的错误
在使用Outlook VSTO解决方案工作时,面对获得电子邮件发送者证书(PR_USER_X509_CERTIFICATE)的问题,当PR_ADDRTYPE_W为SMTP时,而如果EX IE Exchange则不给以下代码提供任何例外。
这是我的C#示例代码要获取用户证书
NameSpace mapiNamespace = mailItem.Application.GetNamespace("MAPI");
Recipient emailSender = mapiNamespace.CreateRecipient(mailItem.SenderEmailAddress);
emailSender.Resolve();
object[] senderCertificateInfo = emailSender.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A701102");
,我已经通过OutlookSpy分析了两种类型的电子邮件的差异。根据我的发现,对于Exchange,对于很多其他属性也可以使用PR_USER_X509_CERTIFIFICATE,但对于SMTP,与Exchange电子邮件相比,很少有属性可用。
有人可以帮助我在所有情况下获得发件人证书吗?
谢谢
While working on Outlook VSTO solution, facing an issue for getting email sender's certificate (PR_USER_X509_CERTIFICATE) when PR_ADDRTYPE_W is SMTP whereas in case of EX i.e. EXCHANGE no exception thrown for below code.
Here is my sample code of C# to get user certificate
NameSpace mapiNamespace = mailItem.Application.GetNamespace("MAPI");
Recipient emailSender = mapiNamespace.CreateRecipient(mailItem.SenderEmailAddress);
emailSender.Resolve();
object[] senderCertificateInfo = emailSender.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A701102");
I have analyzed the difference of both types of emails via OutlookSpy. As per my findings, for EXCHANGE lot of additional properties are also available with PR_USER_X509_CERTIFICATE but for SMTP, a very few properties available as compare of EXCHANGE emails.
Can someone assist me to get sender certificate for all cases?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非证书与消息一起发送,否则没有位置可以在一次性SMTP地址中从Outlook中获取证书。
对于“ EX”类型发件人,证书存储在GAL中,您可以在其中阅读。没有SMTP地址的全球中央存储库。最好的方法是检查是否有本地联系人,其中可能存储证书的匹配SMTP地址,但是您是需要将该证书添加到该联系人的人。
Unless the certificate was somehow sent along with the message, there is no place for Outlook to pull a certificate from in case of an one-off SMTP address.
In case of "EX" type senders, the certificate is stored in GAL, where you can read it from. There is no central world-wide repository of SMTP addresses. The best you can do is check if you have a local contact with a matching SMTP address that might have a certificate stored, but you are the one who would need to add that certificate to that contact to begin with.