有没有人使用过exchnage网络服务的代表?我希望一个用户能够在Exchange中控制其他用户的日历。我发现这个问题有点棘手,我想看看其他人是如何让它正常工作的。
答案 0 :(得分:3)
我刚刚开始,但我设法通过代理帐户访问资源日历。
我使用了this article中有关委托帐户和资源帐户的建议。 (资源帐户很棘手,因为它们在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);
简而言之:
此致 Jesper Hauge