是否有人使用过exchnage网络服务的代表?我希望一个用户能够在Exchange中控制其他用户的日历。我发现这个问题有点棘手,我想看看其他人是如何让它正常工作的。

有帮助吗?

解决方案

我刚刚开始,但我设法通过代理帐户访问资源日历。

我使用了这篇文章中关于代表帐户和资源帐户。 (资源帐户很棘手,因为它们在AD中被禁用,您必须使用委托帐户才能访问它们)

在服务器上设置委托帐户后,我使用委托帐户的凭据设置ExchangeServerBinding:

ExchangeServiceBinding binding = new ExchangeServiceBinding();
binding.Url = @"https://dc1.litwareinc.com/ews/exchange.asmx";
// Setup binding with username and password of the delegate account
binding.Credentials = 
    new NetworkCredential(delegateuserName, delegatepassword, "litwareinc.com");

我正在使用微软准备的虚拟服务器映像进行测试

然后在访问邮箱时,我设置了一个FindItemType请求并使用我想访问的帐户的smtp地址:

// Prepare request
var findItemRequest = new FindItemType();
// Setup the mailbox using the smtp address of the account wanted
var mailbox = new EmailAddressType {EmailAddress = mailboxId};
findItemRequest.ParentFolderIds = 
    new[] {new DistinguishedFolderIdType {Mailbox = mailbox}};
((DistinguishedFolderIdType) findItemRequest.ParentFolderIds[0]).Id = 
    DistinguishedFolderIdNameType.calendar;
findItemRequest.Traversal = ItemQueryTraversalType.Shallow;

// Add ItemResponseShapeType and Calendarview to request here ...

// The create a FindItemResponseType using the binding and the request
var response = binding.FindItem(findItemRequest);

简而言之:

  1. 在Exchange服务器上设置具有委派访问权限的帐户,这可以通过owa或Exchange Shell脚本完成
  2. 在ExchangeServiceBinding对象上使用具有委派访问权限的帐户
  3. 使用目标帐户smtp-addres作为EmailAddressType的FindItemType访问目标帐户
  4. 此致 Jesper Hauge

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top