【问题标题】:EWS - appointment.body created by outlook365 client returns emptyEWS - outlook365 客户端创建的约会.body 返回空
【发布时间】:2019-05-24 10:36:00
【问题描述】:

我有一个问题:如果它是由 Outlook365 客户端创建的,则无法获取约会正文。 当我运行代码时,除了正文之外,所有属性值都被接收。

经过一番搜索,我发现如果预约是由 Outlook365 进行的,则不会收到预约机构。 请帮忙!

代码:

    public static List<Appointment> SetupConnection()
            {
                ServicePointManager.ServerCertificateValidationCallback = CallbackMethods.CertificateValidationCallBack;
                ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
                service.Credentials = new WebCredentials("Someuser@somedomain.com", "SomePassword");
                service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
                Folder calendarFolder = GetCalendarFolder(service, @"\");
                return GetMeetings(calendarFolder, service);

        }
    public static List<Appointment> GetMeetings(Folder calendarFolder, ExchangeService service)
        {
             if (calendarFolder == null)
            {
                return null;
            }
            SearchFilter.SearchFilterCollection filters = new SearchFilter.SearchFilterCollection(LogicalOperator.And)
            {
                new SearchFilter.IsGreaterThan(AppointmentSchema.Start, DateTime.Today)
            };

            List<Appointment> meetings = new List<Appointment>();
            const Int32 pageSize = 30;
            ItemView itemView = new ItemView(pageSize);
            PropertySet propertySet = new PropertySet(BasePropertySet.IdOnly);
            itemView.PropertySet = propertySet;

            FindItemsResults<Item> findResults = null;
            do
            {
                findResults = calendarFolder.FindItems(filters, itemView);
                itemView.Offset += pageSize;
                meetings.AddRange(findResults.Cast<Appointment>());
            } while (findResults.MoreAvailable);


            PropertySet propertySet1 = new PropertySet(BasePropertySet.IdOnly);
            propertySet1.Add(ItemSchema.Body);
            propertySet1.Add(ItemSchema.Subject);
            propertySet1.Add(AppointmentSchema.Organizer);
            propertySet1.Add(AppointmentSchema.Start);
            propertySet1.Add(AppointmentSchema.End);
            propertySet1.Add(AppointmentSchema.Duration);
            propertySet1.Add(AppointmentSchema.AppointmentType);
            propertySet1.Add(AppointmentSchema.ConferenceType);
            propertySet1.Add(AppointmentSchema.IsOnlineMeeting);
            propertySet1.Add(AppointmentSchema.IsMeeting);
            propertySet1.Add(AppointmentSchema.IsRecurring);
            propertySet1.Add(AppointmentSchema.HasAttachments);
            propertySet1.Add(AppointmentSchema.RequiredAttendees);
            propertySet1.Add(AppointmentSchema.Resources);
            propertySet1.Add(AppointmentSchema.InternetMessageHeaders);
            propertySet1.RequestedBodyType = Microsoft.Exchange.WebServices.Data.BodyType.Text;
            service.LoadPropertiesForItems(meetings, propertySet1);

            return meetings;
        }
     }

【问题讨论】:

    标签: calendar exchangewebservices appointment


    【解决方案1】:

    您的代码只返回IdOnly

    尝试将BasePropertySet.IdOnly 更改为BasePropertySet.FirstClassProperties

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-09
      • 1970-01-01
      • 2020-09-01
      • 2011-01-26
      • 1970-01-01
      • 2012-05-30
      • 2023-04-08
      • 1970-01-01
      相关资源
      最近更新 更多