веб-сервис office не возвращает основную информацию

#vb.net #web-services #office365 #exchangewebservices

#vb.net #веб-службы #office365 #exchangewebservices

Вопрос:

Я использовал этот код для извлечения информации из собрания в Office365, но все поля, касающиеся основной части и участников, за исключением пустых. У вас есть какие-либо идеи??

 Dim svc As New ExchangeService(ExchangeVersion.Exchange2010)
        svc.Credentials = New WebCredentials(ConfigurationManager.AppSettings("MailUsername"), ConfigurationManager.AppSettings("MailPassword"))
        svc.Url = New Uri("https://outlook.office365.com/ews/exchange.asmx")

        Dim startDate As Date = Now
        Dim endDate As Date = Now.AddDays(2)

        Dim calendar As CalendarFolder = CalendarFolder.Bind(svc, WellKnownFolderName.Calendar) ', New PropertySet())

        Dim cView As New CalendarView(startDate, endDate, 50)
        cView.PropertySet = New PropertySet(BasePropertySet.FirstClassProperties) 
        Dim appointments As FindItemsResults(Of Appointment) = calendar.FindAppointments(cView)
 

Ответ №1:

Тело и участники не возвращаются вместе с вами с помощью FindAppointments (или FindItems). Чтобы получить это, вам нужно либо выполнить дополнительный запрос GetItem (Load) для каждого элемента, либо лучше использовать LoadPropertiesForItems, например, что-то вроде

 FindItemsResults<Appointment> findResults = service.FindAppointments(
WellKnownFolderName.Calendar,
new CalendarView(DateTime.Now, DateTime.Now.AddDays(7)));

service.LoadPropertiesForItems(
from Item item in findResults select item,
PropertySet.FirstClassProperties);