仅显示用户是EWS组织者的会议

时间:2014-01-15 12:22:35

标签: c# exchangewebservices exchange-server-2010

有没有办法搜索所有用户日历(所有用户都在一个通讯组中)并只显示会议,他们是哪个会是oranizers?

我正在使用模仿。

使用以下代码,我可以获得会议的组织者:

        //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);
                }
            }

我的目标是只为每个用户举办会议,他是组织者。

你可以帮我解决这个问题吗?

亲切的问候 Xristos

1 个答案:

答案 0 :(得分:0)

if (organizator == address.Address)

{ “做一点事” }