摘要:应用程序不会接受ExchangeServiceBinding
命令。ExchangeServiceBinding命名空间错误
详情:
我通过一个非常大的邮箱试图循环,所以我使用的是指数突破收件箱到200个邮件块。我能找到的唯一的例子(如下所示)保持返回
类型或命名空间名称“ExchangeServiceBinding”找不到(是否缺少using指令或程序集引用?)
哪我觉得很奇怪,因为我使用它using Microsoft.Exchange.WebServices;
。任何想法或帮助,不胜感激。我正在运行Windows和Outlook 2007,并尝试访问Exchange 2007邮箱。
事情我已经尝试:
- 谷歌搜索
- 搜索堆栈溢出
- 搜索MSDN
- 砰我的头放在我的桌子
- 试错
代码:
// Create binding variable to be used for GetItemsFromInbox().
// Set up the binding with credentials and URL.
ExchangeServiceBinding binding = new ExchangeServiceBinding();
binding.Credentials = new NetworkCredential(dUser, dPassword, dDomain);
binding.Url = new Uri("https://" + ExchangeServerName + "/EWS/Exchange.asmx");
// Set up the binding for Exchange impersonation.
binding.ExchangeImpersonation = new ExchangeImpersonationType();
binding.ExchangeImpersonation.ConnectingSID = new ConnectingSIDType();
binding.ExchangeImpersonation.ConnectingSID.PrimarySmtpAddress = "mailboxnamehere”;
// Call GetItemsFromInbox()
int index = 0;
bool looping = true;
while (looping)
{
List<ItemType> items = GetItemsFromInbox(binding, index, 200, index);
if (items == null || items.count == 0)
{
looping = false;
break;
}
// Do your work here
}
您的项目是否参考ews程序集? –
是的。使用Microsoft.Exchange.WebServices; using Microsoft.Exchange.WebServices.Data; using Microsoft.Exchange.WebServices.Autodiscover; – toosweetnitemare