【问题标题】:EWS - Delegate AccessEWS - 代表访问
【发布时间】:2013-09-20 07:37:45
【问题描述】:

我正在尝试使用 EWS 访问其他人的日历。我可以正常访问自己的日历:

    foreach (Appointment appointment in service.FindItems(
        WellKnownFolderName.Calendar, new ItemView(int.MaxValue)))
    {
        Console.WriteLine(appointment.Subject);
    }
}

但是,当我尝试模拟时(即使使用委托访问),我在下面的代码中遇到未处理的异常错误(抱歉,它是完整的代码,但我认为它可能会有所帮助!)问题孩子似乎在 foreach循环

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Exchange.WebServices.Data;
using Test.ExchangeServices;
 using System.Net;

namespace Test
{
class Program
{
    static void Main(string[] args)
    {
 // Connect to Exchange Web Services
    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);

    service.Credentials = new WebCredentials("User", "Pass", "Domain");
    service.Url = new Uri("https://EWS/EWS/Exchange.asmx");

    //Impersonate the user who is creating the appiontment request (doesn't work so commented out)
// service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, userEmail);

/Delegate access 

    foreach (Appointment appointment in service.FindItems(
new FolderId(WellKnownFolderName.Calendar, new Mailbox("otheremployee@company.com")), 
new ItemView(10)))
    {
        Console.WriteLine(appointment.Subject);
    }
}



    }
}

如果有帮助,我附上了错误截图:

http://i44.tinypic.com/nh1jdi.png

【问题讨论】:

    标签: c# calendar exchange-server exchangewebservices exchange-server-2010


    【解决方案1】:

    您需要审阅者访问日历,然后它才会起作用。 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-09
      • 1970-01-01
      • 1970-01-01
      • 2017-06-25
      相关资源
      最近更新 更多