2017-11-29 8 views
0

다른 사람의 일정에 대한 개요를보고 싶습니다. 방법 1을 사용할 때 'Occurences'항목이 제외 된 그의 캘린더 정보를 얻을 수 있습니다.EWS API Outlook을 사용하여 다른 사용자의 캘린더 항목을 가져 오는 방법

방법 2를 사용하면 해당 사용자의 부재 항목을 가져올 수 있지만 내 캘린더를 표시합니다. 대신 그 사람의 항목은, 내가 otherones 이메일 주소가 들어있는 "서비스"매개 변수를 전달하고있어 두 방법으로

...

내가 필요 ... 그 사람 이메일 주소의 서비스를 전달하면서 X 사람의 모든 캘린더 정보 + 발생 ... 방법 2가 그 사람 대신 내 일정 항목을 제공하는 이유는 무엇입니까?

어떤 조언을 ...

방법 1 : 방법 -> Folder.Bind 사용

string username ="[email protected]" 
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); 
service.UseDefaultCredentials = true; 
folderIdFromCalendar = new FolderId(WellKnownFolderName.Calendar, username); 
PropertySet propertySet = new PropertySet(AppointmentSchema.Subject); 
Folder TargetFolder = Folder.Bind(service, folderIdFromCalendar, propertySet); 

방법 2 : 방법 -> FindAppointments 사용됩니다.

service.AutodiscoverUrl(username, RedirectionUrlValidationCallback); 
       ///////// 

       DateTime startDate = DateTime.Now; 
       DateTime endDate = startDate.AddDays(30); 
       const int NUM_APPTS = 5; 

       // Initialize the calendar folder object with only the folder ID. 
       CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet()); 

       // Set the start and end time and number of appointments to retrieve. 
       CalendarView ccView = new CalendarView(startDate, endDate, NUM_APPTS); 

       // Limit the properties returned to the appointment's subject, start time, and end time. 
       ccView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End); 

       // Retrieve a collection of appointments by using the calendar view. 
       FindItemsResults<Appointment> appointments2 = calendar.FindAppointments(ccView); 

       Console.WriteLine("\nThe first " + NUM_APPTS + " appointments on your calendar from " + startDate.Date.ToShortDateString() + 
            " to " + endDate.Date.ToShortDateString() + " are: \n"); 

       foreach (Appointment a in appointments2) 
       { 
        Console.Write("Subject: " + a.Subject.ToString() + " "); 
        Console.Write("Start: " + a.Start.ToString() + " "); 
        Console.Write("End: " + a.End.ToString()); 
        Console.WriteLine(); 
       } 

답변

1

방법 2 작동해야하지만 그렇게

CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet()); 

folderIdFromCalendar = new FolderId(WellKnownFolderName.Calendar, username); 
CalendarFolder calendar = CalendarFolder.Bind(service, folderIdFromCalendar , new PropertySet()); 
+0

슈퍼 감사 변경에 액세스 할 사서함을 지정합니다 FolderId의 오버로드를 사용할 필요가 ... 내가 놓친 . – user3080110