2017-09-19 3 views
4

C# EWS 2.0 라이브러리를 사용하여 일부 이벤트를 나열하려고합니다.EWS - 참석자를로드하려고 할 때 일정 약속을 나열하지 않습니다.

하면 다음과 같은 코드를 사용하고 다음과 같이

public IEnumerable<AppEvent> ListEvents(CalendarFolder folder, DateTime? startDate, DateTime? endDate) 
    { 
     var items = new List<AppEvent>(); 

     var now = DateTime.Now; 
     if (startDate == null) startDate = DateTime.Now; 
     if (endDate == null) endDate = now.AddDays(14); 

     FindItemsResults<Appointment> findResults = null; 
     ServiceResponseCollection<GetItemResponse> appointments = null; 
     CalendarView view = null; 

     view = new CalendarView((DateTime)startDate, (DateTime)endDate); 
     findResults = folder.FindAppointments(view); 

     if (findResults.Items.Count() == 0) return items; 
     appointments = Service.BindToItems(findResults.Select(item => item.Id), AppointmentPropertySet); 

     foreach (GetItemResponse item in appointments) 
     { 
      var appointment = item.Item as Appointment; 
      try 
      { 
       if (appointment.IsCancelled) continue; 
      } 
      catch (System.NullReferenceException) 
      { 
       continue; 
      } 
      var evt = AppEvent.FromEWSAppointment(appointment); 
      items.Add(evt); 
     } 

     return items; 
    } 

그리고 AppointmentPropertySet입니다 : 우리는 이벤트 중 하나에 대한 다음과 같은 오류를 얻고있다

protected PropertySet AppointmentPropertySet = new PropertySet(
     AppointmentSchema.Subject, 
     AppointmentSchema.Start, 
     AppointmentSchema.End, 
     AppointmentSchema.IsAllDayEvent, 
     AppointmentSchema.IsMeeting, 
     AppointmentSchema.IsRecurring, 
     AppointmentSchema.IsCancelled, 
     AppointmentSchema.IsDraft, 
     AppointmentSchema.Location, 
     AppointmentSchema.Resources, 
     AppointmentSchema.RequiredAttendees, 
     AppointmentSchema.OptionalAttendees, 
     AppointmentSchema.LegacyFreeBusyStatus, 
     AppointmentSchema.Organizer, 
     AppointmentSchema.Body, 
     AppointmentSchema.Sensitivity, 
     AppointmentSchema.AppointmentReplyTime, 
     AppointmentSchema.AppointmentSequenceNumber, 
     AppointmentSchema.AppointmentState, 
     AppointmentSchema.AppointmentType, 
     AppointmentSchema.ConferenceType, 
     AppointmentSchema.DateTimeCreated, 
     AppointmentSchema.Duration, 
     AppointmentSchema.EndTimeZone, 
     AppointmentSchema.HasAttachments, 
     AppointmentSchema.ICalDateTimeStamp, 
     AppointmentSchema.ICalRecurrenceId, 
     AppointmentSchema.ICalUid, 
     AppointmentSchema.Id, 
     AppointmentSchema.Importance, 
     AppointmentSchema.IsOnlineMeeting, 
     AppointmentSchema.IsReminderSet, 
     AppointmentSchema.IsResponseRequested, 
     AppointmentSchema.IsUnmodified, 
     AppointmentSchema.LastModifiedTime, 
     AppointmentSchema.LegacyFreeBusyStatus, 
     AppointmentSchema.MeetingRequestWasSent, 
     AppointmentSchema.MyResponseType, 
     AppointmentSchema.MeetingWorkspaceUrl, 
     AppointmentSchema.NetShowUrl, 
     AppointmentSchema.OriginalStart, 
     AppointmentSchema.ParentFolderId, 
     AppointmentSchema.Recurrence, 
     AppointmentSchema.ReminderDueBy, 
     AppointmentSchema.ReminderMinutesBeforeStart, 
     AppointmentSchema.StartTimeZone, 
     AppointmentSchema.WebClientEditFormQueryString, 
     AppointmentSchema.WebClientReadFormQueryString 
     ); 

. RequiredAttendeesOptionalAttendeesAppointmentPropertySet에서 제거하면 정상적으로 작동하지만 참석자가 반환되지 않습니다.

이 오류를 방지하려면 어떻게해야합니까? 또는보기가 적어도 중단되지 않은 약속을 반환하도록이 이벤트를 건너 뛸 수 있습니까? 예외 스택 추적으로 판단

System.ArgumentException: Requested value 'User' was not found. 
    at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument) 
    at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult) 
    at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) 
    at Microsoft.Exchange.WebServices.Data.EwsUtilities.Parse[T](String value) 
    at Microsoft.Exchange.WebServices.Data.EwsXmlReader.ReadElementValue[T]() 
    at Microsoft.Exchange.WebServices.Data.EmailAddress.TryReadElementFromXml(EwsServiceXmlReader reader) 
    at Microsoft.Exchange.WebServices.Data.Attendee.TryReadElementFromXml(EwsServiceXmlReader reader) 
    at Microsoft.Exchange.WebServices.Data.ComplexProperty.InternalLoadFromXml(EwsServiceXmlReader reader, XmlNamespace xmlNamespace, String xmlElementName, Func`2 readAction) 
    at Microsoft.Exchange.WebServices.Data.ComplexProperty.LoadFromXml(EwsServiceXmlReader reader, XmlNamespace xmlNamespace, String xmlElementName) 
    at Microsoft.Exchange.WebServices.Data.Attendee.TryReadElementFromXml(EwsServiceXmlReader reader) 
    at Microsoft.Exchange.WebServices.Data.ComplexProperty.InternalLoadFromXml(EwsServiceXmlReader reader, XmlNamespace xmlNamespace, String xmlElementName, Func`2 readAction) 
    at Microsoft.Exchange.WebServices.Data.ComplexProperty.LoadFromXml(EwsServiceXmlReader reader, XmlNamespace xmlNamespace, String xmlElementName) 
    at Microsoft.Exchange.WebServices.Data.ComplexPropertyCollection`1.LoadFromXml(EwsServiceXmlReader reader, XmlNamespace xmlNamespace, String localElementName) 
    at Microsoft.Exchange.WebServices.Data.ComplexPropertyDefinitionBase.InternalLoadFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) 
    at Microsoft.Exchange.WebServices.Data.ComplexPropertyDefinitionBase.LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag) 
    at Microsoft.Exchange.WebServices.Data.PropertyBag.LoadFromXml(EwsServiceXmlReader reader, Boolean clear, PropertySet requestedPropertySet, Boolean onlySummaryPropertiesRequested) 
    at Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader.ReadServiceObjectsCollectionFromXml[TServiceObject](XmlNamespace collectionXmlNamespace, String collectionXmlElementName, GetObjectInstanceDelegate`1 getObjectInstanceDelegate, Boolean clearPropertyBag, PropertySet requestedPropertySet, Boolean summaryPropertiesOnly) 
    at Microsoft.Exchange.WebServices.Data.GetItemResponse.ReadElementsFromXml(EwsServiceXmlReader reader) 
    at Microsoft.Exchange.WebServices.Data.ServiceResponse.LoadFromXml(EwsServiceXmlReader reader, String xmlElementName) 
    at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.ParseResponse(EwsServiceXmlReader reader) 
    at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadResponse(EwsServiceXmlReader ewsXmlReader) 
    at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponseXml(Stream responseStream) 
    at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(IEwsHttpWebResponse response) 
    at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalBindToItems(IEnumerable`1 itemIds, PropertySet propertySet, ServiceErrorHandling errorHandling) 
    at ExchangeAppService.Utilities.API.ExchangeAPI.ListEvents(CalendarFolder folder, Nullable`1 startDate, Nullable`1 endDate) in c:\Users\Some Guy\Documents\Visual Studio 2013\Projects\ExchangeAppService\ExchangeAppService\Utilities\API\Exchange\ExchangeAPI.cs:line 195 
+0

이 문제가 계속 발생합니까? 문제를 해결 한 경우 해답을 답변으로 게시하십시오. 같은 문제가 발생한 다른 사람들에게 유용 할 수 있습니다. –

+0

나는 아직도 그것을 가지고있다. – synic

+0

내 대답을 시도해 보셨습니까? 그것은 작동하지 않았다? –

답변

2

, 나는 참석자 이메일 주소 중 하나 (또는 ​​그 이상)의 MailboxType에 대한 Exchange 서버가 잘못된 값 ("사용자")로 회신 것을 확신합니다.

current implementation of the MailboxType enum에서 "User"값이 최신 버전에도 유효하지 않은 것 같습니다.

Exchange가 돌려주는 비누 응답을 분석하거나 추적하여 (How to: Trace requests and responses to troubleshoot EWS Managed API applications 참조) 피들러 (Fiddler) 또는 Wireshark와 같은 네트워크 분석기를 사용하여이를 확인할 수 있습니다.

이 경우 유일한 해결 방법은 github repo에서 문제를 열어 문제에 대한 추가 정보 또는 가능한 해결책을 제공 할 수 있기를 바랍니다.

+1

나는 그 (것)들에 벌레를 열어야하는 것처럼 보인다. 시간 내 주셔서 감사합니다! – synic

+0

괜찮습니다. 나는 당신이했던 것과 똑같은 문제에 빨리 빠지지 않기를 바랍니다. :) –

+0

또한 repo에서 문제를 열면 돌아와 링크 및/또는 결과를 공유하여 미래의 사람들 (나를 포함해서) 문제의 상태를 해결하거나 쉽게 추적 할 수 있습니다. –