/// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
                case XmlElementNames.UserOptions:
                    if (!reader.IsEmptyElement)
                    {
                        do
                        {
                            reader.Read();

                            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.VotingOptionData))
                            {
                                VotingOptionData option = new VotingOptionData();
                                option.LoadFromXml(reader, reader.LocalName);
                                this.userOptions.Add(option);
                            }
                        }
                        while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UserOptions));
                    }
                    return true;
                case XmlElementNames.VotingResponse:
                    this.votingResponse = reader.ReadElementValue<string>();
                    return true;
                default:
                    return false;
            }
        }
예제 #2
0
        /// <summary>
        /// Read Photo results from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            bool hasChanged = reader.ReadElementValue<bool>(XmlNamespace.Messages, XmlElementNames.HasChanged);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.PictureData);
            byte[] photoData = reader.ReadBase64ElementValue();

            // We only get a content type if we get a photo
            if (photoData.Length > 0)
            {
                this.Results.Photo = photoData;
                this.Results.ContentType = reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.ContentType);
            }

            if (hasChanged)
            {
                if (this.Results.Photo.Length == 0)
                {
                    this.Results.Status = GetUserPhotoStatus.PhotoOrUserNotFound;
                }
                else
                {
                    this.Results.Status = GetUserPhotoStatus.PhotoReturned;
                }
            }
            else
            {
                this.Results.Status = GetUserPhotoStatus.PhotoUnchanged;
            }
        }
예제 #3
0
 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if appropriate element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.OofState:
             this.state = reader.ReadValue<OofState>();
             return true;
         case XmlElementNames.ExternalAudience:
             this.externalAudience = reader.ReadValue<OofExternalAudience>();
             return true;
         case XmlElementNames.Duration:
             this.duration = new TimeWindow();
             this.duration.LoadFromXml(reader);
             return true;
         case XmlElementNames.InternalReply:
             this.internalReply = new OofReply();
             this.internalReply.LoadFromXml(reader, reader.LocalName);
             return true;
         case XmlElementNames.ExternalReply:
             this.externalReply = new OofReply();
             this.externalReply.LoadFromXml(reader, reader.LocalName);
             return true;
         default:
             return false;
     }
 }
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            if (base.TryReadElementFromXml(reader))
            {
                return true;
            }
            else
            {
                if (reader.LocalName == XmlElementNames.Day)
                {
                    this.dayOfMonth = reader.ReadElementValue<int>();

                    EwsUtilities.Assert(
                        this.dayOfMonth > 0 && this.dayOfMonth <= 31,
                        "AbsoluteDayOfMonthTransition.TryReadElementFromXml",
                        "dayOfMonth is not in the valid 1 - 31 range.");

                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
 /// <summary>
 /// Attempts to read the element at the reader's current position.
 /// </summary>
 /// <param name="reader">The reader used to read the element.</param>
 /// <returns>True if the element was read, false otherwise.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.ID:
             this.storeId = reader.ReadElementValue();
             return true;
         case XmlElementNames.Subject:
             this.subject = reader.ReadElementValue();
             return true;
         case XmlElementNames.Location:
             this.location = reader.ReadElementValue();
             return true;
         case XmlElementNames.IsMeeting:
             this.isMeeting = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.IsRecurring:
             this.isRecurring = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.IsException:
             this.isException = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.IsReminderSet:
             this.isReminderSet = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.IsPrivate:
             this.isPrivate = reader.ReadElementValue<bool>();
             return true;
         default:
             return false;
     }
 }
 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.HasLocationChanged:
             this.hasLocationChanged = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.Location:
             this.location = reader.ReadElementValue();
             return true;
         case XmlElementNames.HasStartTimeChanged:
             this.hasStartTimeChanged = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.Start:
             this.start = reader.ReadElementValueAsDateTime().Value;
             return true;
         case XmlElementNames.HasEndTimeChanged:
             this.hasEndTimeChanged = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.End:
             this.end = reader.ReadElementValueAsDateTime().Value;
             return true;
         default:
             return false;
     }
 }
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            if (base.TryReadElementFromXml(reader))
            {
                return true;
            }
            else
            {
                switch (reader.LocalName)
                {
                    case XmlElementNames.TimeOffset:
                        this.timeOffset = EwsUtilities.XSDurationToTimeSpan(reader.ReadElementValue());
                        return true;
                    case XmlElementNames.Month:
                        this.month = reader.ReadElementValue<int>();

                        EwsUtilities.Assert(
                            this.month > 0 && this.month <= 12,
                            "AbsoluteMonthTransition.TryReadElementFromXml",
                            "month is not in the valid 1 - 12 range.");

                        return true;
                    default:
                        return false;
                }
            }
        }
        /// <summary>
        /// Read Conversations from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.Conversation = new ConversationResponse(this.propertySet);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Conversation);
            this.Conversation.LoadFromXml(reader, XmlNamespace.Messages, XmlElementNames.Conversation);
        }
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="propertyBag">The property bag.</param>
        internal override void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
        {
            TimeZoneDefinition timeZoneDefinition = new TimeZoneDefinition();
            timeZoneDefinition.LoadFromXml(reader, this.XmlElementName);

            propertyBag[this] = timeZoneDefinition.ToTimeZoneInfo(reader.Service);
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.ClientExtensions.Clear();
            base.ReadElementsFromXml(reader);
            
            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions);

            if (!reader.IsEmptyElement)
            {
                // Because we don't have an element for count of returned object,
                // we have to test the element to determine if it is StartElement of return object or EndElement
                reader.Read();

                while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ClientExtension))
                {
                    ClientExtension clientExtension = new ClientExtension();
                    clientExtension.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.ClientExtension);
                    this.ClientExtensions.Add(clientExtension);

                    reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.ClientExtension);
                    reader.Read();
                }

                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ClientExtensions);
            }

            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionRawMasterTableXml))
            {
                this.rawMasterTableXml = reader.ReadElementValue();
            }
        }
예제 #11
0
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal void LoadFromXml(EwsServiceXmlReader reader)
        {
            reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Resolution);

            reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Mailbox);
            this.mailbox.LoadFromXml(reader, XmlElementNames.Mailbox);

            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Contact))
            {
                this.contact = new Contact(this.owner.Session);

                // Contacts returned by ResolveNames should behave like Contact.Load with FirstClassPropertySet specified.
                this.contact.LoadFromXml(
                                    reader,
                                    true,                               /* clearPropertyBag */
                                    PropertySet.FirstClassProperties,
                                    false);                             /* summaryPropertiesOnly */

                reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Resolution);
            }
            else
            {
                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.Resolution);
            }
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.Rooms.Clear();
            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Rooms);

            if (!reader.IsEmptyElement)
            {
                // Because we don't have an element for count of returned object,
                // we have to test the element to determine if it is StartElement of return object or EndElement
                reader.Read();
                while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Room))
                {
                    reader.Read(); // skip the start <Room>

                    EmailAddress emailAddress = new EmailAddress();
                    emailAddress.LoadFromXml(reader, XmlElementNames.RoomId);
                    this.Rooms.Add(emailAddress);

                    reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Room);
                    reader.Read();
                }

                reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.Rooms);
            }
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Attachments);
            if (!reader.IsEmptyElement)
            {
                reader.Read(XmlNodeType.Element);

                if (this.attachment == null)
                {
                    if (string.Equals(reader.LocalName, XmlElementNames.FileAttachment, StringComparison.OrdinalIgnoreCase))
                    {
                        this.attachment = new FileAttachment(reader.Service);
                    }
                    else if (string.Equals(reader.LocalName, XmlElementNames.ItemAttachment, StringComparison.OrdinalIgnoreCase))
                    {
                        this.attachment = new ItemAttachment(reader.Service);
                    }
                }

                if (this.attachment != null)
                {
                    this.attachment.LoadFromXml(reader, reader.LocalName);
                }

                reader.ReadEndElement(XmlNamespace.Messages, XmlElementNames.Attachments);
            }
        }
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
                case XmlElementNames.NlgAttendees:
                    this.Attendees = new EmailUserEntityCollection();
                    this.Attendees.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.NlgAttendees);
                    return true;

                case XmlElementNames.NlgLocation:
                    this.Location = reader.ReadElementValue();
                    return true;

                case XmlElementNames.NlgSubject:
                    this.Subject = reader.ReadElementValue();
                    return true;

                case XmlElementNames.NlgMeetingString:
                    this.MeetingString = reader.ReadElementValue();
                    return true;

                case XmlElementNames.NlgStartTime:
                    this.StartTime = reader.ReadElementValueAsDateTime();
                    return true;

                case XmlElementNames.NlgEndTime:
                    this.EndTime = reader.ReadElementValueAsDateTime();
                    return true;
                
                default:
                    return base.TryReadElementFromXml(reader);
            }
        }
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
                case XmlElementNames.ExtendedFieldURI:
                    this.propertyDefinition = new ExtendedPropertyDefinition();
                    this.propertyDefinition.LoadFromXml(reader);
                    return true;
                case XmlElementNames.Value:
                    EwsUtilities.Assert(
                        this.PropertyDefinition != null,
                        "ExtendedProperty.TryReadElementFromXml",
                        "PropertyDefintion is missing");

                    string stringValue = reader.ReadElementValue();
                    this.value = MapiTypeConverter.ConvertToValue(this.PropertyDefinition.MapiType, stringValue);
                    return true;
                case XmlElementNames.Values:
                    EwsUtilities.Assert(
                        this.PropertyDefinition != null,
                        "ExtendedProperty.TryReadElementFromXml",
                        "PropertyDefintion is missing");

                    StringList stringList = new StringList(XmlElementNames.Value);
                    stringList.LoadFromXml(reader, reader.LocalName);
                    this.value = MapiTypeConverter.ConvertToValue(this.PropertyDefinition.MapiType, stringList);
                    return true;
                default:
                    return false;
            }
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.searchableMailboxes.Clear();

            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.SearchableMailboxes);
            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();
                    if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailbox))
                    {
                        this.searchableMailboxes.Add(SearchableMailbox.LoadFromXml(reader));
                    }
                }
                while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.SearchableMailboxes));
            }

            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FailedMailboxes))
            {
                this.FailedMailboxes = FailedSearchMailbox.LoadFailedMailboxesXml(XmlNamespace.Messages, reader);
            }
        }
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
                case XmlElementNames.InternetMessageId:
                    this.InternetMessageId = reader.ReadElementValue();
                    return true;

                case XmlElementNames.ParentInternetMessageId:
                    this.ParentInternetMessageId = reader.ReadElementValue();
                    return true;

                case XmlElementNames.Items:
                    this.Items = reader.ReadServiceObjectsCollectionFromXml<Item>(
                                        XmlNamespace.Types,
                                        XmlElementNames.Items,
                                        this.GetObjectInstance,
                                        true,               /* clearPropertyBag */
                                        this.propertySet,   /* requestedPropertySet */
                                        false);             /* summaryPropertiesOnly */
                    return true;

                default:
                    return false;
            }
        }
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="propertyBag">The property bag.</param>
        internal override sealed void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
        {
            MeetingTimeZone meetingTimeZone = new MeetingTimeZone();
            meetingTimeZone.LoadFromXml(reader, this.XmlElementName);

            propertyBag[AppointmentSchema.StartTimeZone] = meetingTimeZone.ToTimeZoneInfo();
        }
예제 #19
0
        /// <summary>
        /// Load from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void InternalLoadFromXml(EwsServiceXmlReader reader)
        {
            base.InternalLoadFromXml(reader);

            this.itemId = new ItemId();
            this.itemId.LoadFromXml(reader, reader.LocalName);

            reader.Read();

            this.ParentFolderId = new FolderId();
            this.ParentFolderId.LoadFromXml(reader, XmlElementNames.ParentFolderId);

            switch (this.EventType)
            {
                case EventType.Moved:
                case EventType.Copied:
                    reader.Read();

                    this.oldItemId = new ItemId();
                    this.oldItemId.LoadFromXml(reader, reader.LocalName);

                    reader.Read();

                    this.OldParentFolderId = new FolderId();
                    this.OldParentFolderId.LoadFromXml(reader, reader.LocalName);
                    break;

                default:
                    break;
            }
        }
        /// <summary>
        /// Load from xml
        /// </summary>
        /// <param name="reader">The reader</param>
        /// <returns>List of non indexable item statistic object</returns>
        internal static List<NonIndexableItemStatistic> LoadFromXml(EwsServiceXmlReader reader)
        {
            List<NonIndexableItemStatistic> results = new List<NonIndexableItemStatistic>();

            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemStatistics))
            {
                do
                {
                    reader.Read();
                    if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.NonIndexableItemStatistic))
                    {
                        string mailbox = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Mailbox);
                        int itemCount = reader.ReadElementValue<int>(XmlNamespace.Types, XmlElementNames.ItemCount);
                        string errorMessage = null;
                        if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ErrorMessage))
                        {
                            errorMessage = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ErrorMessage);
                        }

                        results.Add(new NonIndexableItemStatistic { Mailbox = mailbox, ItemCount = itemCount, ErrorMessage = errorMessage });
                    }
                }
                while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemStatistics));
            }

            return results;
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            this.searchResult = new SearchMailboxesResult();

            base.ReadElementsFromXml(reader);

            this.searchResult = SearchMailboxesResult.LoadFromXml(reader);
        }
예제 #22
0
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal void LoadFromXml(EwsServiceXmlReader reader)
        {
            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Duration);

            this.startTime = reader.ReadElementValueAsDateTime(XmlNamespace.Types, XmlElementNames.StartTime).Value;
            this.endTime = reader.ReadElementValueAsDateTime(XmlNamespace.Types, XmlElementNames.EndTime).Value;

            reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Duration);
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            if (this.ErrorCode == ServiceError.NoError && reader.IsStartElement(XmlNamespace.NotSpecified, XmlElementNames.WasFirstInstall))
            {
                this.wasFirstInstall = reader.ReadElementValue<bool>(XmlNamespace.NotSpecified, XmlElementNames.WasFirstInstall);
            }
        }
 /// <summary>
 /// Loads from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 internal virtual void LoadFromXml(EwsServiceXmlReader reader)
 {
     this.id = reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.SubscriptionId);
     
     if (this.UsesWatermark)
     {
         this.watermark = reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.Watermark);
     }
 }
예제 #25
0
        /// <summary>
        /// Read Personas from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            EwsUtilities.Assert(
                   this.Results.Personas != null,
                   "FindPeopleResponse.ReadElementsFromXml",
                   "Personas is null.");

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.People);
            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();

                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        Persona item = EwsUtilities.CreateEwsObjectFromXmlElementName<Persona>(reader.Service, reader.LocalName);

                        if (item == null)
                        {
                            reader.SkipCurrentElement();
                        }
                        else
                        {
                            // Don't clear propertyBag because all properties have been initialized in the persona constructor.
                            item.LoadFromXml(reader, false, null, false);
                            this.Results.Personas.Add(item);
                        }
                    }
                }
                while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.People));
            }

            reader.Read();

            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.TotalNumberOfPeopleInView) && !reader.IsEmptyElement)
            {
                this.Results.TotalCount = reader.ReadElementValue<int>();

                reader.Read();
            }

            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FirstMatchingRowIndex) && !reader.IsEmptyElement)
            {
                this.Results.FirstMatchingRowIndex = reader.ReadElementValue<int>();

                reader.Read();
            }

            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FirstLoadedRowIndex) && !reader.IsEmptyElement)
            {
                this.Results.FirstLoadedRowIndex = reader.ReadElementValue<int>();

                reader.Read();
            }
        }
예제 #26
0
        /// <summary>
        /// Reads attributes from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadAttributesFromXml(EwsServiceXmlReader reader)
        {
            this.bodyType = reader.ReadAttributeValue<BodyType>(XmlAttributeNames.BodyType);

            string attributeValue = reader.ReadAttributeValue(XmlAttributeNames.IsTruncated);
            if (!string.IsNullOrEmpty(attributeValue))
            {
                this.isTruncated = bool.Parse(attributeValue);
            }
        }
예제 #27
0
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if appropriate element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
                case XmlElementNames.TimeZone:
                    LegacyAvailabilityTimeZone legacyTimeZone = new LegacyAvailabilityTimeZone();
                    legacyTimeZone.LoadFromXml(reader, reader.LocalName);

                    this.timeZone = legacyTimeZone.ToTimeZoneInfo();
                    
                    return true;
                case XmlElementNames.WorkingPeriodArray:
                    List<WorkingPeriod> workingPeriods = new List<WorkingPeriod>();

                    do
                    {
                        reader.Read();

                        if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.WorkingPeriod))
                        {
                            WorkingPeriod workingPeriod = new WorkingPeriod();

                            workingPeriod.LoadFromXml(reader, reader.LocalName);

                            workingPeriods.Add(workingPeriod);
                        }
                    }
                    while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.WorkingPeriodArray));

                    // Availability supports a structure that can technically represent different working
                    // times for each day of the week. This is apparently how the information is stored in
                    // Exchange. However, no client (Outlook, OWA) either will let you specify different
                    // working times for each day of the week, and Outlook won't either honor that complex
                    // structure if it happens to be in Exchange.
                    // So here we'll do what Outlook and OWA do: we'll use the start and end times of the
                    // first working period, but we'll use the week days of all the periods.
                    this.startTime = workingPeriods[0].StartTime;
                    this.endTime = workingPeriods[0].EndTime;

                    foreach (WorkingPeriod workingPeriod in workingPeriods)
                    {
                        foreach (DayOfTheWeek dayOfWeek in workingPeriods[0].DaysOfWeek)
                        {
                            if (!this.daysOfTheWeek.Contains(dayOfWeek))
                            {
                                this.daysOfTheWeek.Add(dayOfWeek);
                            }
                        }
                    }

                    return true;
                default:
                    return false;
            }
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Token);
            this.Id = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Id);
            this.TokenType = (ClientAccessTokenType)Enum.Parse(typeof(ClientAccessTokenType), reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.TokenType));
            this.TokenValue = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.TokenValue);
            this.TTL = int.Parse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.TTL));
            reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.Token);
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            this.items = reader.ReadServiceObjectsCollectionFromXml<Item>(
                XmlElementNames.Items,
                this.GetObjectInstance,
                false,  /* clearPropertyBag */
                null,   /* requestedPropertySet */
                false); /* summaryPropertiesOnly */
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Attachments);

            reader.Read(XmlNodeType.Element);
            this.attachment.LoadFromXml(reader, reader.LocalName);

            reader.ReadEndElement(XmlNamespace.Messages, XmlElementNames.Attachments);
        }
예제 #31
0
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        this.RoomLists.Clear();
        base.ReadElementsFromXml(reader);

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.RoomLists);

        if (!reader.IsEmptyElement)
        {
            // Because we don't have an element for count of returned object,
            // we have to test the element to determine if it is return object or EndElement
            reader.Read();
            while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Address))
            {
                EmailAddress emailAddress = new EmailAddress();
                emailAddress.LoadFromXml(reader, XmlElementNames.Address);
                this.RoomLists.Add(emailAddress);
                reader.Read();
            }
            reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.RoomLists);
        }
        return;
    }
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        EwsUtilities.Assert(
            this.People != null,
            "GetPeopleInsightsResponse.ReadElementsFromXml",
            "People is null.");

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.People);
        if (!reader.IsEmptyElement)
        {
            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    Person item = new Person();
                    item.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.Person);
                    this.People.Add(item);
                }
            }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.People));
        }
    }
예제 #33
0
 bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     if (base.TryReadElementFromXml(reader))
     {
         return true;
     }
     else
     {
         switch (reader.LocalName)
         {
             case XmlElementNames.DaysOfWeek:
                 this.DaysOfTheWeek.LoadFromXml(reader, reader.LocalName);
                 return true;
             case XmlElementNames.FirstDayOfWeek:
                 this.FirstDayOfWeek = reader.ReadElementValue<DayOfWeek>(
                     XmlNamespace.Types,
                     XmlElementNames.FirstDayOfWeek);
                 return true;
             default:
                 return false;
         }
     }
 }
예제 #34
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.DayOfWeek:
            EwsUtilities.ParseEnumValueList <DayOfTheWeek>(
                this.daysOfWeek,
                reader.ReadElementValue <String>(),
                ' ');
            return(true);

        case XmlElementNames.StartTimeInMinutes:
            this.startTime = TimeSpan.FromMinutes(reader.ReadElementValue <int>());
            return(true);

        case XmlElementNames.EndTimeInMinutes:
            this.endTime = TimeSpan.FromMinutes(reader.ReadElementValue <int>());
            return(true);

        default:
            return(false);
        }
    }
예제 #35
0
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.EmailAddress:
                this.EmailAddress = reader.ReadElementValue();
                break;

            case XmlElementNames.DisplayName:
                this.DisplayName = reader.ReadElementValue();
                break;

            case XmlElementNames.Insights:
                this.Insights = new PersonInsightCollection();
                this.Insights.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.Insights);
                break;

            default:
                return(base.TryReadElementFromXml(reader));
            }

            return(true);
        }
    /// <summary>
    /// Load from xml
    /// </summary>
    /// <param name="reader">The reader</param>
    /// <returns>Non indexable item details result object</returns>
    static NonIndexableItemDetailsResult LoadFromXml(EwsServiceXmlReader reader)
    {
        NonIndexableItemDetailsResult nonIndexableItemDetailsResult = new NonIndexableItemDetailsResult();

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemDetailsResult);

        do
        {
            reader.Read();

            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Items))
            {
                List <NonIndexableItem> nonIndexableItems = new List <NonIndexableItem>();
                if (!reader.IsEmptyElement)
                {
                    do
                    {
                        reader.Read();
                        NonIndexableItem nonIndexableItem = NonIndexableItem.LoadFromXml(reader);
                        if (nonIndexableItem != null)
                        {
                            nonIndexableItems.Add(nonIndexableItem);
                        }
                    }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.Items));

                    nonIndexableItemDetailsResult.Items = nonIndexableItems.ToArray();
                }
            }

            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.FailedMailboxes))
            {
                nonIndexableItemDetailsResult.FailedMailboxes = FailedSearchMailbox.LoadFailedMailboxesXml(XmlNamespace.Types, reader);
            }
        }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.NonIndexableItemDetailsResult));

        return(nonIndexableItemDetailsResult);
    }
예제 #37
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.PhoneCallState:
            this.state = reader.ReadElementValue <PhoneCallState>();
            return(true);

        case XmlElementNames.ConnectionFailureCause:
            this.connectionFailureCause = reader.ReadElementValue <ConnectionFailureCause>();
            return(true);

        case XmlElementNames.SIPResponseText:
            this.sipResponseText = reader.ReadElementValue();
            return(true);

        case XmlElementNames.SIPResponseCode:
            this.sipResponseCode = reader.ReadElementValue <int>();
            return(true);

        default:
            return(false);
        }
    }
    object ParseResponse(EwsServiceXmlReader reader)
    {
        ServiceResponseCollection <SearchMailboxesResponse> serviceResponses = new ServiceResponseCollection <SearchMailboxesResponse>();

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages);

        while (true)
        {
            // Read ahead to see if we've reached the end of the response messages early.
            reader.Read();
            if (reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages))
            {
                break;
            }

            SearchMailboxesResponse response = new SearchMailboxesResponse();
            response.LoadFromXml(reader, this.GetResponseMessageXmlElementName());
            serviceResponses.Add(response);
        }

        reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.ResponseMessages);

        return(serviceResponses);
    }
예제 #39
0
    /// <summary>
    /// Load from xml
    /// </summary>
    /// <param name="reader">The reader</param>
    /// <returns>Mailbox hold object</returns>
    static MailboxHoldResult LoadFromXml(EwsServiceXmlReader reader)
    {
        List <MailboxHoldStatus> statuses = new List <MailboxHoldStatus>();

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.MailboxHoldResult);

        MailboxHoldResult holdResult = new MailboxHoldResult();

        holdResult.HoldId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.HoldId);

        // the query could be empty means there won't be Query element, hence needs to read and check
        // if the next element is not Query, then it means already read MailboxHoldStatuses element
        reader.Read();
        holdResult.Query = "";
        if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Query))
        {
            holdResult.Query = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Query);
            reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.MailboxHoldStatuses);
        }

        do
        {
            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.MailboxHoldStatus))
            {
                String     mailbox        = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Mailbox);
                HoldStatus status         = (HoldStatus)Enum.Parse(typeof(HoldStatus), reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Status));
                String     additionalInfo = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.AdditionalInfo);
                statuses.Add(new MailboxHoldStatus(mailbox, status, additionalInfo));
            }
        }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.MailboxHoldResult));

        holdResult.Statuses = statuses.Count == 0 ? null : statuses.ToArray();

        return(holdResult);
    }
예제 #40
0
 bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     if (base.TryReadElementFromXml(reader))
     {
         return true;
     }
     else
     {
         switch (reader.LocalName)
         {
             case XmlElementNames.DaysOfWeek:
                 this.dayOfTheWeek = reader.ReadElementValue<DayOfTheWeek>();
                 return true;
             case XmlElementNames.DayOfWeekIndex:
                 this.dayOfTheWeekIndex = reader.ReadElementValue<DayOfTheWeekIndex>();
                 return true;
             case XmlElementNames.Month:
                 this.month = reader.ReadElementValue<Month>();
                 return true;
             default:
                 return false;
         }
     }
 }
예제 #41
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.FieldURI:
            this.ruleProperty = reader.ReadElementValue <RuleProperty>();
            return(true);

        case XmlElementNames.ErrorCode:
            this.errorCode = reader.ReadElementValue <RuleErrorCode>();
            return(true);

        case XmlElementNames.ErrorMessage:
            this.errorMessage = reader.ReadElementValue();
            return(true);

        case XmlElementNames.FieldValue:
            this.value = reader.ReadElementValue();
            return(true);

        default:
            return(false);
        }
    }
예제 #42
0
 void ReadElementsFromXml(EwsServiceXmlReader reader)
 {
     reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.PhoneCallInformation);
     this.phoneCall.LoadFromXml(reader, XmlNamespace.Messages, XmlElementNames.PhoneCallInformation);
     reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.PhoneCallInformation);
 }
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        EwsUtilities.Assert(
            this.Results.Conversations != null,
            "FindConversationResponse.ReadElementsFromXml",
            "conversations is null.");

        EwsUtilities.Assert(
            this.Results.HighlightTerms != null,
            "FindConversationResponse.ReadElementsFromXml",
            "highlightTerms is null.");

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Conversations);
        if (!reader.IsEmptyElement)
        {
            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    Conversation item = EwsUtilities.CreateEwsObjectFromXmlElementName <Conversation>(reader.Service, reader.LocalName);

                    if (item == null)
                    {
                        reader.SkipCurrentElement();
                    }
                    else
                    {
                        item.LoadFromXml(
                            reader,
                            true,             /* clearPropertyBag */
                            null,
                            false /* summaryPropertiesOnly */);

                        this.Results.Conversations.Add(item);
                    }
                }
            }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.Conversations));
        }

        reader.Read();

        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.HighlightTerms) &&
            !reader.IsEmptyElement)
        {
            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    HighlightTerm term = new HighlightTerm();

                    term.LoadFromXml(
                        reader,
                        XmlNamespace.Types,
                        XmlElementNames.HighlightTerm);

                    this.Results.HighlightTerms.Add(term);
                }
            }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.HighlightTerms));
        }

        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.TotalConversationsInView) && !reader.IsEmptyElement)
        {
            this.Results.TotalCount = reader.ReadElementValue <int>();

            reader.Read();
        }

        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.IndexedOffset) && !reader.IsEmptyElement)
        {
            this.Results.IndexedOffset = reader.ReadElementValue <int>();

            reader.Read();
        }
    }
예제 #44
0
    /// <summary>
    /// Load failed mailboxes xml
    /// </summary>
    /// <param name="rootXmlNamespace">Root xml namespace</param>
    /// <param name="reader">The reader</param>
    /// <returns>Array of failed mailboxes</returns>
    static FailedSearchMailbox[] LoadFailedMailboxesXml(XmlNamespace rootXmlNamespace, EwsServiceXmlReader reader)
    {
        List <FailedSearchMailbox> failedMailboxes = new List <FailedSearchMailbox>();

        reader.EnsureCurrentNodeIsStartElement(rootXmlNamespace, XmlElementNames.FailedMailboxes);
        do
        {
            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.FailedMailbox))
            {
                String mailbox   = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Mailbox);
                int    errorCode = 0;
                int.TryParse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ErrorCode), out errorCode);
                String errorMessage = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ErrorMessage);
                bool   isArchive    = false;
                bool.TryParse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.IsArchive), out isArchive);

                failedMailboxes.Add(new FailedSearchMailbox(mailbox, errorCode, errorMessage, isArchive));
            }
        }while (!reader.IsEndElement(rootXmlNamespace, XmlElementNames.FailedMailboxes));

        return(failedMailboxes.Count == 0 ? null : failedMailboxes.ToArray());
    }
    /// <summary>
    /// Load from xml
    /// </summary>
    /// <param name="reader">The reader</param>
    /// <returns>Discovery search configuration object</returns>
    static DiscoverySearchConfiguration LoadFromXml(EwsServiceXmlReader reader)
    {
        List <SearchableMailbox> mailboxes = new List <SearchableMailbox>();

        reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.DiscoverySearchConfiguration);

        DiscoverySearchConfiguration configuration = new DiscoverySearchConfiguration();

        configuration.SearchId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SearchId);

        // the query could be empty means there won't be Query element, hence needs to read and check
        // if the next element is not Query, then it means already read SearchableMailboxes element
        configuration.SearchQuery           = "";
        configuration.InPlaceHoldIdentity   = "";
        configuration.ManagedByOrganization = "";
        configuration.Language = "";

        do
        {
            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchQuery))
            {
                configuration.SearchQuery = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SearchQuery);
                reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.SearchQuery);
            }
            else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailboxes))
            {
                // search object without any source mailbox is possible, hence need to check if element is empty
                if (!reader.IsEmptyElement)
                {
                    while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.SearchableMailboxes))
                    {
                        reader.Read();

                        if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailbox))
                        {
                            mailboxes.Add(SearchableMailbox.LoadFromXml(reader));
                            reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.SearchableMailbox);
                        }
                    }
                }
            }
            else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.InPlaceHoldIdentity))
            {
                configuration.InPlaceHoldIdentity = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.InPlaceHoldIdentity);
                reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.InPlaceHoldIdentity);
            }
            else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ManagedByOrganization))
            {
                configuration.ManagedByOrganization = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ManagedByOrganization);
                reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.ManagedByOrganization);
            }
            else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Language))
            {
                configuration.Language = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Language);
                reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.Language);
            }
            else
            {
                break;
            }
        }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.DiscoverySearchConfiguration));

        configuration.SearchableMailboxes = mailboxes.Count == 0 ? null : mailboxes.ToArray();

        return(configuration);
    }
예제 #46
0
 /// <summary>
 /// Reads text value from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 internal override void ReadTextValueFromXml(EwsServiceXmlReader reader)
 {
     this.text = reader.ReadValue();
 }
예제 #47
0
 /// <summary>
 /// Reads the member Key attribute from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 internal override void ReadAttributesFromXml(EwsServiceXmlReader reader)
 {
     this.key = reader.ReadAttributeValue <string>(XmlAttributeNames.Key);
 }
예제 #48
0
 /// <summary>
 /// Reads attributes from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 internal override void ReadAttributesFromXml(EwsServiceXmlReader reader)
 {
     this.bodyType = reader.ReadAttributeValue <BodyType>(XmlAttributeNames.BodyType);
 }
예제 #49
0
 void ReadElementsFromXml(EwsServiceXmlReader reader)
 {
     base.ReadElementsFromXml(reader);
     this.UnseenCount = reader.ReadElementValue <int>(XmlNamespace.NotSpecified, XmlElementNames.UnseenCount);
 }
예제 #50
0
 void ReadAttributesFromXml(EwsServiceXmlReader reader)
 {
     this.id = reader.ReadAttributeValue(XmlAttributeNames.Id);
 }
 void ReadElementsFromXml(EwsServiceXmlReader reader)
 {
     base.ReadElementsFromXml(reader);
     this.passwordExpirationDate = reader.ReadElementValueAsDateTime(XmlNamespace.NotSpecified, XmlElementNames.PasswordExpirationDate);
 }
예제 #52
0
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        base.ReadElementsFromXml(reader);

        this.NonIndexableItemsResult = NonIndexableItemDetailsResult.LoadFromXml(reader);
    }
예제 #53
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.MeetingTime:
            this.meetingTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
            return(true);

        case XmlElementNames.IsWorkTime:
            this.isWorkTime = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.SuggestionQuality:
            this.quality = reader.ReadElementValue <SuggestionQuality>();
            return(true);

        case XmlElementNames.AttendeeConflictDataArray:
            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();

                    if (reader.IsStartElement())
                    {
                        Conflict conflict = null;

                        switch (reader.LocalName)
                        {
                        case XmlElementNames.UnknownAttendeeConflictData:
                            conflict = new Conflict(ConflictType.UnknownAttendeeConflict);
                            break;

                        case XmlElementNames.TooBigGroupAttendeeConflictData:
                            conflict = new Conflict(ConflictType.GroupTooBigConflict);
                            break;

                        case XmlElementNames.IndividualAttendeeConflictData:
                            conflict = new Conflict(ConflictType.IndividualAttendeeConflict);
                            break;

                        case XmlElementNames.GroupAttendeeConflictData:
                            conflict = new Conflict(ConflictType.GroupConflict);
                            break;

                        default:
                            EwsUtilities.Assert(
                                false,
                                "TimeSuggestion.TryReadElementFromXml",
                                string.Format("The {0} element name does not map to any AttendeeConflict descendant.", reader.LocalName));

                            // The following line to please the compiler
                            break;
                        }

                        conflict.LoadFromXml(reader, reader.LocalName);

                        this.conflicts.Add(conflict);
                    }
                }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.AttendeeConflictDataArray));
            }

            return(true);

        default:
            return(false);
        }
    }
예제 #54
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.Categories:
            this.categories.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.ContainsBodyStrings:
            this.containsBodyStrings.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.ContainsHeaderStrings:
            this.containsHeaderStrings.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.ContainsRecipientStrings:
            this.containsRecipientStrings.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.ContainsSenderStrings:
            this.containsSenderStrings.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.ContainsSubjectOrBodyStrings:
            this.containsSubjectOrBodyStrings.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.ContainsSubjectStrings:
            this.containsSubjectStrings.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.FlaggedForAction:
            this.flaggedForAction = reader.ReadElementValue <FlaggedForAction>();
            return(true);

        case XmlElementNames.FromAddresses:
            this.fromAddresses.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.FromConnectedAccounts:
            this.fromConnectedAccounts.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.HasAttachments:
            this.hasAttachments = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.Importance:
            this.importance = reader.ReadElementValue <Importance>();
            return(true);

        case XmlElementNames.IsApprovalRequest:
            this.isApprovalRequest = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsAutomaticForward:
            this.isAutomaticForward = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsAutomaticReply:
            this.isAutomaticReply = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsEncrypted:
            this.isEncrypted = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsMeetingRequest:
            this.isMeetingRequest = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsMeetingResponse:
            this.isMeetingResponse = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsNDR:
            this.isNonDeliveryReport = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsPermissionControlled:
            this.isPermissionControlled = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsSigned:
            this.isSigned = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsVoicemail:
            this.isVoicemail = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.IsReadReceipt:
            this.isReadReceipt = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.ItemClasses:
            this.itemClasses.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.MessageClassifications:
            this.messageClassifications.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.NotSentToMe:
            this.notSentToMe = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.SentCcMe:
            this.sentCcMe = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.SentOnlyToMe:
            this.sentOnlyToMe = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.SentToAddresses:
            this.sentToAddresses.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.SentToMe:
            this.sentToMe = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.SentToOrCcMe:
            this.sentToOrCcMe = reader.ReadElementValue <bool>();
            return(true);

        case XmlElementNames.Sensitivity:
            this.sensitivity = reader.ReadElementValue <Sensitivity>();
            return(true);

        case XmlElementNames.WithinDateRange:
            this.withinDateRange.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.WithinSizeRange:
            this.withinSizeRange.LoadFromXml(reader, reader.LocalName);
            return(true);

        default:
            return(false);
        }
    }
예제 #55
0
 /// <summary>
 /// Reads the attributes from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 internal override void ReadAttributesFromXml(EwsServiceXmlReader reader)
 {
     this.Traversal = reader.ReadAttributeValue <SearchFolderTraversal>(XmlAttributeNames.Traversal);
 }
예제 #56
0
    /// <summary>
    /// Loads the free busy view from XML.
    /// </summary>
    /// <param name="reader">The reader.</param>
    /// <param name="viewType">Type of free/busy view.</param>
    void LoadFreeBusyViewFromXml(EwsServiceXmlReader reader, FreeBusyViewType viewType)
    {
        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.FreeBusyView);

        String viewTypeString = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.FreeBusyViewType);

        this.viewType = (FreeBusyViewType)Enum.Parse(typeof(FreeBusyViewType), viewTypeString, false);

        do
        {
            reader.Read();

            if (reader.IsStartElement())
            {
                switch (reader.LocalName)
                {
                case XmlElementNames.MergedFreeBusy:
                    String mergedFreeBusy = reader.ReadElementValue <String>();

                    for (int i = 0; i < mergedFreeBusy.Length; i++)
                    {
                        this.mergedFreeBusyStatus.Add((LegacyFreeBusyStatus)Byte.Parse(mergedFreeBusy[i].ToString()));
                    }

                    break;

                case XmlElementNames.CalendarEventArray:
                    do
                    {
                        reader.Read();

                        // Sometimes Exchange Online returns blank CalendarEventArray tag like bellow.
                        // <CalendarEventArray xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
                        // So we have to check the end of CalendarEventArray tag.
                        if (reader.LocalName == XmlElementNames.FreeBusyView)
                        {
                            // There is no the end tag of CalendarEventArray, but the reader is reading the end tag of FreeBusyView.
                            break;
                        }
                        else if (reader.LocalName == XmlElementNames.WorkingHours)
                        {
                            // There is no the end tag of CalendarEventArray, but the reader is reading the start tag of WorkingHours.
                            goto case XmlElementNames.WorkingHours;
                        }

                        if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.CalendarEvent))
                        {
                            CalendarEvent calendarEvent = new CalendarEvent();

                            calendarEvent.LoadFromXml(reader, XmlElementNames.CalendarEvent);

                            this.calendarEvents.Add(calendarEvent);
                        }
                    }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.CalendarEventArray));

                    break;

                case XmlElementNames.WorkingHours:
                    this.workingHours = new WorkingHours();
                    this.workingHours.LoadFromXml(reader, reader.LocalName);

                    break;
                }
            }
        }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.FreeBusyView));
    }
    void LoadAttributesFromXml(EwsServiceXmlReader reader)
    {
        base.LoadAttributesFromXml(reader);

        this.FolderId = reader.ReadAttributeValue(XmlAttributeNames.FolderId);
    }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            this.xml = reader.ReadElementValue <string>(XmlNamespace.Messages, XmlElementNames.OMEConfigurationXml);
        }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            this.Members.LoadFromXml(reader);
        }
예제 #60
0
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        EwsUtilities.Assert(
            this.Results.Personas != null,
            "FindPeopleResponse.ReadElementsFromXml",
            "Personas is null.");

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.People);
        if (!reader.IsEmptyElement)
        {
            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    Persona item = EwsUtilities.CreateEwsObjectFromXmlElementName <Persona>(reader.Service, reader.LocalName);

                    if (item == null)
                    {
                        reader.SkipCurrentElement();
                    }
                    else
                    {
                        // Don't clear propertyBag because all properties have been initialized in the persona constructor.
                        item.LoadFromXml(reader, false, null, false);
                        this.Results.Personas.Add(item);
                    }
                }
            }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.People));
        }

        reader.Read();

        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.TotalNumberOfPeopleInView) && !reader.IsEmptyElement)
        {
            this.Results.TotalCount = reader.ReadElementValue <int>();
            reader.Read();
        }

        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FirstMatchingRowIndex) && !reader.IsEmptyElement)
        {
            this.Results.FirstMatchingRowIndex = reader.ReadElementValue <int>();
            reader.Read();
        }

        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FirstLoadedRowIndex) && !reader.IsEmptyElement)
        {
            this.Results.FirstLoadedRowIndex = reader.ReadElementValue <int>();
            reader.Read();
        }

        if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.FindPeopleTransactionId) && !reader.IsEmptyElement)
        {
            this.TransactionId = reader.ReadElementValue <string>();
            reader.Read();
        }

        // Future proof by skipping any additional elements before returning
        while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.FindPeopleResponse))
        {
            reader.Read();
        }
    }