/// <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);
                }
            }
        }
Beispiel #2
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.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>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">XML reader</param>
        /// <returns>Whether the element was read</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.InsightSource:
                this.InsightSource = reader.ReadElementValue <string>();
                break;

            case XmlElementNames.StartTime:
                this.startTime = reader.ReadElementValueAsDateTime(XmlNamespace.Types, XmlElementNames.StartTime).Value;
                break;

            case XmlElementNames.EndTime:
                this.endTime = reader.ReadElementValueAsDateTime(XmlNamespace.Types, XmlElementNames.EndTime).Value;
                break;

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

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

            default:
                return(false);
            }

            return(true);
        }
Beispiel #4
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.NumberOfMembers:
                this.numberOfMembers = reader.ReadElementValue <int>();
                return(true);

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

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

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

            case XmlElementNames.BusyType:
                this.freeBusyStatus = reader.ReadElementValue <LegacyFreeBusyStatus>();
                return(true);

            default:
                return(false);
            }
        }
Beispiel #5
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)
            {
                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);
                    }
                }
            }
        /// <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.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);
            }
        }
Beispiel #8
0
        /// <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);
        }
Beispiel #9
0
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>Returns true if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.UserId:
                this.userId = new UserId();
                this.userId.LoadFromXml(reader, reader.LocalName);
                return(true);

            case XmlElementNames.DelegatePermissions:
                this.permissions.Reset();
                this.permissions.LoadFromXml(reader, reader.LocalName);
                return(true);

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

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

            default:
                return(false);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">XML reader</param>
        /// <returns>Whether the element was read</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.InsightSource:
                this.InsightSource = reader.ReadElementValue <InsightSourceType>();
                break;

            case XmlElementNames.UpdatedUtcTicks:
                this.UpdatedUtcTicks = reader.ReadElementValue <long>();
                break;

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

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

            default:
                return(false);
            }

            return(true);
        }
        /// <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.Offset:
                this.offset = EwsUtilities.XSDurationToTimeSpan(reader.ReadElementValue());
                return(true);

            case XmlElementNames.RelativeYearlyRecurrence:
                this.Recurrence = new TimeChangeRecurrence();
                this.Recurrence.LoadFromXml(reader, reader.LocalName);
                return(true);

            case XmlElementNames.AbsoluteDate:
                DateTime dateTime = DateTime.Parse(reader.ReadElementValue());

                // TODO: BUG
                this.absoluteDate = new DateTime(dateTime.ToUniversalTime().Ticks, DateTimeKind.Unspecified);
                return(true);

            case XmlElementNames.Time:
                this.time = new Time(DateTime.Parse(reader.ReadElementValue()));
                return(true);

            default:
                return(false);
            }
        }
        /// <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;
            }
        }
        /// <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)
        {
            bool result = base.TryReadElementFromXml(reader);

            if (!result)
            {
                switch (reader.LocalName)
                {
                case XmlElementNames.AttachLongPathName:
                    this.attachLongPathName = reader.ReadElementValue();
                    break;

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

                case XmlElementNames.PermissionType:
                    this.permissionType = reader.ReadElementValue <Int32>();
                    break;

                case XmlElementNames.AttachmentIsFolder:
                    this.attachmentIsFolder = reader.ReadElementValue <bool>();
                    break;
                }
            }

            return(result);
        }
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal void LoadFromXml(EwsServiceXmlReader reader)
        {
            EwsUtilities.Assert(
                reader != null,
                "UserConfiguration.LoadFromXml",
                "reader is null");

            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.UserConfiguration);
            reader.Read(); // Position at first property element

            do
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.LocalName)
                    {
                    case XmlElementNames.UserConfigurationName:
                        string responseName = reader.ReadAttributeValue(XmlAttributeNames.Name);

                        EwsUtilities.Assert(
                            string.Compare(this.name, responseName, StringComparison.Ordinal) == 0,
                            "UserConfiguration.LoadFromXml",
                            "UserConfigurationName does not match: Expected: " + this.name + " Name in response: " + responseName);

                        reader.SkipCurrentElement();
                        break;

                    case XmlElementNames.ItemId:
                        this.itemId = new ItemId();
                        this.itemId.LoadFromXml(reader, XmlElementNames.ItemId);
                        break;

                    case XmlElementNames.Dictionary:
                        this.dictionary.LoadFromXml(reader, XmlElementNames.Dictionary);
                        break;

                    case XmlElementNames.XmlData:
                        this.xmlData = Convert.FromBase64String(reader.ReadElementValue());
                        break;

                    case XmlElementNames.BinaryData:
                        this.binaryData = Convert.FromBase64String(reader.ReadElementValue());
                        break;

                    default:
                        EwsUtilities.Assert(
                            false,
                            "UserConfiguration.LoadFromXml",
                            "Xml element not supported: " + reader.LocalName);
                        break;
                    }
                }

                // If XmlData was loaded, read is skipped because GetXmlData positions the reader at the next property.
                reader.Read();
            }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.UserConfiguration));
        }
Beispiel #15
0
        /// <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);
            }
        }
        /// <summary>
        /// Load from xml.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>Retention policy tag object.</returns>
        internal static RetentionPolicyTag LoadFromXml(EwsServiceXmlReader reader)
        {
            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.RetentionPolicyTag);

            RetentionPolicyTag retentionPolicyTag = new RetentionPolicyTag();

            retentionPolicyTag.DisplayName     = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.DisplayName);
            retentionPolicyTag.RetentionId     = new Guid(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.RetentionId));
            retentionPolicyTag.RetentionPeriod = reader.ReadElementValue <int>(XmlNamespace.Types, XmlElementNames.RetentionPeriod);
            retentionPolicyTag.Type            = reader.ReadElementValue <ElcFolderType>(XmlNamespace.Types, XmlElementNames.Type);
            retentionPolicyTag.RetentionAction = reader.ReadElementValue <RetentionActionType>(XmlNamespace.Types, XmlElementNames.RetentionAction);

            // Description is not a required property.
            reader.Read();
            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Description))
            {
                retentionPolicyTag.Description = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Description);
            }

            retentionPolicyTag.IsVisible = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.IsVisible);
            retentionPolicyTag.OptedInto = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.OptedInto);
            retentionPolicyTag.IsArchive = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.IsArchive);

            return(retentionPolicyTag);
        }
        /// <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();
            }
        }
Beispiel #18
0
        /// <summary>
        /// Load from xml
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        internal static MailboxStatisticsItem LoadFromXml(EwsServiceXmlReader reader)
        {
            MailboxStatisticsItem msi = new MailboxStatisticsItem();

            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.MailboxStat);
            msi.MailboxId   = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.MailboxId);
            msi.DisplayName = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.DisplayName);
            msi.ItemCount   = reader.ReadElementValue <long>(XmlNamespace.Types, XmlElementNames.ItemCount);
            msi.Size        = reader.ReadElementValue <ulong>(XmlNamespace.Types, XmlElementNames.Size);
            return(msi);
        }
Beispiel #19
0
        /// <summary>
        /// Load from xml
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        internal static SearchRefinerItem LoadFromXml(EwsServiceXmlReader reader)
        {
            SearchRefinerItem sri = new SearchRefinerItem();

            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Refiner);
            sri.Name  = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Name);
            sri.Value = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Value);
            sri.Count = reader.ReadElementValue <long>(XmlNamespace.Types, XmlElementNames.Count);
            sri.Token = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Token);
            return(sri);
        }
Beispiel #20
0
        /// <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>
        /// Loads the free busy view from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="viewType">Type of free/busy view.</param>
        internal 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();

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

                        break;

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

                            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));
        }
Beispiel #22
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.Title:
                this.title = reader.ReadElementValue();
                return(true);

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

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

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

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

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

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

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

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

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

            default:
                return(false);
            }
        }
Beispiel #23
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)
        {
            while (true)
            {
                switch (reader.LocalName)
                {
                case XmlElementNames.InsightGroupType:
                    this.InsightGroupType = reader.ReadElementValue <InsightGroupType>();
                    break;

                case XmlElementNames.InsightType:
                    this.InsightType = reader.ReadElementValue <InsightType>();
                    break;

                case XmlElementNames.Rank:
                    this.Rank = reader.ReadElementValue <double>();
                    break;

                case XmlElementNames.Content:
                    var type = reader.ReadAttributeValue("xsi:type");
                    switch (type)
                    {
                    case XmlElementNames.SingleValueInsightContent:
                        this.Content = new SingleValueInsightContent();
                        ((SingleValueInsightContent)this.Content).LoadFromXml(reader, reader.LocalName);
                        break;

                    case XmlElementNames.MultiValueInsightContent:
                        this.Content = new MultiValueInsightContent();
                        ((MultiValueInsightContent)this.Content).LoadFromXml(reader, reader.LocalName);
                        break;

                    default:
                        return(false);
                    }
                    break;

                case XmlElementNames.ItemList:
                    this.ReadItemList(reader);
                    break;

                default:
                    return(false);
                }

                return(true);
            }
        }
Beispiel #24
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)
        {
            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>
        /// 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.VotingOptionDisplayName:
                this.displayName = reader.ReadElementValue <string>();
                return(true);

            case XmlElementNames.SendPrompt:
                this.sendPrompt = reader.ReadElementValue <SendPrompt>();
                return(true);

            default:
                return(false);
            }
        }
Beispiel #26
0
        /// <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();
            }
        }
Beispiel #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)
            {
                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);
                    }
                }
            }
        /// <summary>
        /// Read attribution blobs from XML
        /// </summary>
        /// <param name="reader">XML reader</param>
        /// <returns>Whether reading succeeded</returns>
        internal bool LoadAttributionsFromXml(EwsServiceXmlReader reader)
        {
            if (!reader.IsEmptyElement)
            {
                string localName = reader.LocalName;
                this.attributionList = new List <string>();

                do
                {
                    reader.Read();
                    if (reader.NodeType == XmlNodeType.Element &&
                        reader.LocalName == XmlElementNames.Attribution)
                    {
                        string s = reader.ReadElementValue();
                        if (!string.IsNullOrEmpty(s))
                        {
                            this.attributionList.Add(s);
                        }
                    }
                }while (!reader.IsEndElement(XmlNamespace.Types, localName));
                this.Attributions = this.attributionList.ToArray();
            }

            return(true);
        }
Beispiel #29
0
        /// <summary>
        /// Loads extra error details from XML
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="xmlElementName">The current element name of the extra error details.</param>
        /// <returns>
        /// True if the expected extra details is loaded;
        /// False if the element name does not match the expected element.
        /// </returns>
        internal override bool LoadExtraErrorDetailsFromXml(EwsServiceXmlReader reader, string xmlElementName)
        {
            bool baseReturnVal = base.LoadExtraErrorDetailsFromXml(reader, xmlElementName);

            if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.ErrorSubscriptionIds))
            {
                do
                {
                    reader.Read();

                    if (reader.NodeType == System.Xml.XmlNodeType.Element &&
                        reader.LocalName == XmlElementNames.SubscriptionId)
                    {
                        this.ErrorSubscriptionIds.Add(
                            reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.SubscriptionId));
                    }
                }while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.ErrorSubscriptionIds));

                return(true);
            }
            else
            {
                return(baseReturnVal);
            }
        }
Beispiel #30
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.NlgName:
                this.Name = reader.ReadElementValue();
                return(true);

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

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