通过Exchange Web服务访问投票按钮扩展属性

我正在使用Exchange Web服务(Exchange Server 2007)尝试发送带有投票按钮的电子邮件。

我读了这个问题/答案:
发送投票电子邮件

我有一位使用Outlook 2007的同事给我发了一封简单的是/否投票按钮的电子邮件(按钮显示在Outlook中,我还没有发送回答)我可以确认这是我收件箱中的第一封电子邮件。

然后我使用EWS获取该电子邮件并尝试获取与电子邮件相关的扩展属性,因此我可以获得与投票按钮相关的二进制文件,从而发送带有投票按钮的电子邮件。

这是我的代码。

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Url = new Uri(ConfigurationManager.AppSettings["URL"]); service.Credentials = new NetworkCredential( ConfigurationManager.AppSettings["Username"], ConfigurationManager.AppSettings["Password"], ConfigurationManager.AppSettings["Domain"] ); Item foundItem = service.FindItems(WellKnownFolderName.Inbox, new ItemView(10)).Items[0]; ExtendedPropertyDefinition epd = new ExtendedPropertyDefinition( DefaultExtendedPropertySet.Common, 0x00008520, MapiPropertyType.Binary ); object propertyValue = null; bool outBool; outBool = foundItem.TryGetProperty(epd, out propertyValue); 

outBool始终为false, propertyValue始终为null。

当我放置断点并查看foundItem ,其余属性是正确的 – 例如发送者,主题行,发送的日期/时间等。

另外, foundItem.ExtendedProperties的计数总是为零。 该房产里有什么东西吗?

我在这里找到了我需要的信息:
http://social.technet.microsoft.com/Forums/en/exchangesvrdevelopment/thread/2dbab0f2-b23f-4808-8f55-9ecc77edf877

C#

 ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Url = new Uri(ConfigurationManager.AppSettings["URL"]); service.Credentials = new NetworkCredential( ConfigurationManager.AppSettings["Username"], ConfigurationManager.AppSettings["Password"], ConfigurationManager.AppSettings["Domain"] ); Item foundItem = service.FindItems(WellKnownFolderName.Inbox, new ItemView(10)).Items[0]; ExtendedPropertyDefinition myProp = new ExtendedPropertyDefinition( DefaultExtendedPropertySet.Common, 0x00008520, MapiPropertyType.Binary ); EmailMessage otherMessage = EmailMessage.Bind(service, foundItem.Id, new PropertySet(myProp)); byte[] bytes = (byte[])otherMessage[myProp]; 

VB

 Dim service As New ExchangeService(ExchangeVersion.Exchange2007_SP1) service.Url = New Uri(ConfigurationManager.AppSettings("URL")) service.Credentials = New NetworkCredential(ConfigurationManager.AppSettings("Username"), ConfigurationManager.AppSettings("Password"), ConfigurationManager.AppSettings("Domain")) Dim myProp As New ExtendedPropertyDefinition( DefaultExtendedPropertySet.Common, 34080, MapiPropertyType.Binary ) Dim foundItem As Item = service.FindItems(WellKnownFolderName.Inbox, New ItemView(10))(0) Dim otherMessage As EmailMessage = EmailMessage.Bind(service, foundItem.Id, New PropertySet(myProp)) Dim bytes As Byte() = DirectCast(otherMessage(myProp), Byte()) 

希望这有助于某人。