2017-01-03 7 views
0
Appointment newAppointment = new Appointment(service); 

newAppointment.Subject = "Test Subject"; 
newAppointment.Start = new DateTime(2017, 01, 05, 17, 00, 0); 
newAppointment.StartTimeZone = TimeZoneInfo.Local; 
newAppointment.EndTimeZone = TimeZoneInfo.Local; 
newAppointment.End = newAppointment.Start.AddMinutes(30); 
newAppointment.ICalUid = "asdasda="; 
newAppointment.Save(); 
newAppointment.Body = new MessageBody(BodyType.Text, "test"); 
newAppointment.RequiredAttendees.Add("[email protected]"); 

newAppointment.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendOnlyToAll); 

ExtendedPropertyDefinition CleanGlobalObjectId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting, "ICalUid", MapiPropertyType.String); 
PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties); 
psPropSet.Add(CleanGlobalObjectId); 
newAppointment.Load(psPropSet); 

Folder AtndCalendar = Folder.Bind(service, new FolderId(WellKnownFolderName.Calendar, "[email protected]")); 
SearchFilter sfSearchFilter = new SearchFilter.IsEqualTo(CleanGlobalObjectId, "asdasda="); 
ItemView ivItemView = new ItemView(1); 

FindItemsResults <Item> fiResults = AtndCalendar.FindItems(sfSearchFilter, ivItemView); 

if (fiResults.Items.Count > 0) { 
//do whatever 
} 

Это не работает для меня. И я не хочу использовать приведенный ниже код, где мы перебираем календарный вид. Искали во многих местах и ​​пробовали много кодовых частей.EWS Managed API, поиск на основе ICalUid

EWS не имеет документации по этому вопросу. Любая помощь будет оценена по достоинству.

DateTime startDate = new DateTime(2016, 10, 1); 
DateTime endDate = new DateTime(2017, 12, 1); 
CalendarView calView = new CalendarView(startDate, endDate); 

ответ

0

Если память не используется, вы не можете осуществлять поиск на основе ICalUid. Частично я думаю, потому что это не обязательно уникально, несмотря на его название. Например. если вы проводите встречу и приглашаете две комнаты, ICalUid одинаково подходит для встреч в календарях обеих комнат, а также у вас.

Почему бы вам не просто выбрать ItemId из назначенной вами встречи? Думаю, есть еще одна причина, кроме того, что вы показываете в примере кода?

0

Почему вы не используете CleanGlobalObjectId, который неверно определяет ваше определение (это определение не использует ничего) в вашем коде, а не IcalUid, который является строго типизированным свойством, которое не доступно для поиска. Например, EWS - Given an Appointment, get the owner's copy of the Appointment

-1

с расширенными свойствами.

ExtendedPropertyDefinition def = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, APPOINTMENTIDEXTENDPROPNAME, MapiPropertyType.String); 
Смежные вопросы