Hello,
is there a way to search all users calendar (the are all in a distribution group) and show only the meetings, where they are the oranizers?
I am using impersonation.
With the following code I can get the organizer of a Meeting:
//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("user@domain", RedirectionUrlValidationCallback); //Distinguish Distribution Group string distributiongroup = "distributiongroup@domain"; // 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); } }
My goal is to get only the meetings for every user, where he is the organizer.
Can you help me on this one? I have been struggeling for hours to get this...Kind Regards
Ioannis