通过Exchange Web服务访问的投票按钮扩展属性 [英] Access the voting buttons extended property through Exchange Web Services

查看:347
本文介绍了通过Exchange Web服务访问的投票按钮扩展属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Exchange Web服务(Exchange Server 2007中),以尝试用投票按钮发送电子邮件研究。

I'm using the Exchange Web Services (Exchange server 2007) to try to send an email with voting buttons in.

我读了这个问题/回答:
  <一href="http://stackoverflow.com/questions/3012883/send-voting-email">http://stackoverflow.com/questions/3012883/send-voting-email

I read this question/answer:
http://stackoverflow.com/questions/3012883/send-voting-email

我已经使用Outlook 2007发送给我简单的是一个电子邮件有一个同事/没有投票按钮(按钮在Outlook中显示,我并没有打发一个答案),我可以证实,这是在我的收件箱中的第一封电子邮件。

I have had a colleague using Outlook 2007 send me an email with simple yes/no voting buttons (the buttons display in Outlook, I have not sent an answer) and I can confirm that it is the first email in my Inbox.

然后,我用的EWS来获取电子邮件,并得到有关的电子邮件的扩展属性,这样我就可以得到相关的投票按钮,二进制,因而带有投票按钮送我自己的电子邮件。

I've then used the EWS to get that email and try to get the extended properties relating to the email, so I can get the binary related to the voting buttons and thus send my own email with voting buttons.

下面是我的code。

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 永远是假的,而为PropertyValue 始终保持为空。

outBool is always false, and propertyValue always stays null.

当我把一个断点,并看看 foundItem 属性的其余部分是正确的 - 例如:发件人,主题行,日期/时间发送等。

When I put a breakpoint and look at foundItem the rest of the properties are correct - e.g. the sender, subject line, date/time sent, etc.

还有 foundItem.ExtendedProperties 总是有计数为零。 Shoudln't有什么东西在这个属性?

Also foundItem.ExtendedProperties always has a count of zero. Shoudln't there be something in this property?

推荐答案

我发现我需要这里的信息:
<一href="http://social.technet.microsoft.com/Forums/en/exchangesvrdevelopment/thread/2dbab0f2-b23f-4808-8f55-9ecc77edf877" rel="nofollow">http://social.technet.microsoft.com/Forums/en/exchangesvrdevelopment/thread/2dbab0f2-b23f-4808-8f55-9ecc77edf877

I found the information I needed here:
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())

希望这可以帮助别人。

Hope this helps somebody.

这篇关于通过Exchange Web服务访问的投票按钮扩展属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆