2014-01-15 27 views
0

是否有一种方法可以搜索所有用户的日历(全部位于通讯组中)并仅显示会议,它们是oranizers的会议?仅显示用户是EWS组织者的会议

我正在使用模拟。

用下面的代码,我可以得到一个会议的组织者:

 //Instantiate the ExchangeService class+ Exchange Certificate Validation + Imparsonate 
     ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; 
     ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); 
     service.Credentials = new NetworkCredential("user", "password", "domain"); 
     service.AutodiscoverUrl("[email protected]", RedirectionUrlValidationCallback); 

     //Distinguish Distribution Group 
     string distributiongroup = "[email protected]"; 

     // Initialize values for the start and end time. 
     DateTime startDate = DateTime.Now.AddMinutes(0); 
     DateTime endDate = startDate.AddDays(1); 

     //Extend the distribution group 
     ExpandGroupResults distGroupMembers = service.ExpandGroup(distributiongroup); 
     foreach (EmailAddress address in distGroupMembers.Members) 
     { 
      //Impersonate each distribution group member 
      service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, address.Address); 

      // Execute the search in the calendar folder and return the view 
      CalendarView caledarView = new CalendarView(startDate, endDate); 
      caledarView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties); 
      FindItemsResults<Appointment> apt = service.FindAppointments(WellKnownFolderName.Calendar, caledarView); 

      foreach (Item item in apt.Items) 
      { 
       ServiceResponseCollection<GetItemResponse> myColl = service.BindToItems(new[] { new ItemId(item.Id.UniqueId) }, caledarView.PropertySet); 
       foreach (GetItemResponse temp in myColl) 
       { 
        Appointment app = (Appointment)temp.Item; 

        string organizator = app.Organizer.Address; 

        Console.WriteLine(address + "\n" + app.Subject + " " + organizator); 
       } 
      } 

我的目标是让只为每一位用户,他是组织者的会议。

你能帮我一下吗?

亲切的问候 Xristos

+0

什么关于这个问题你的问题/问题? – Marshall777

+0

我只想列出用户是组织者的约会。 – user3197311

+0

您可以构建一个包含Appointment对象的列表,然后使用LINQ查询获取您想要的约会,即使我承认这不是一个真正的解决方案。 – Marshall777

回答

0
if (organizator == address.Address) 

{ “有所作为” }

相关问题