예제 #1
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.InsightSource:
            this.InsightSource = reader.ReadElementValue <string>();
            break;

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

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

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

        default:
            return(false);
        }

        return(true);
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        bool hasChanged = reader.ReadElementValue <bool>(XmlNamespace.Messages, XmlElementNames.HasChanged);

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.PictureData);
        Uint8List 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;
        }
    }
예제 #4
0
    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;
     }
 }
예제 #6
0
    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)
        {
            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;
            }
        }
예제 #8
0
    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.View /* private */ Items:
            this.view /* private */ Items = reader.ReadElementValue <bool>();
            return(true);

        default:
            return(false);
        }
    }
        /// <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;
        }
예제 #10
0
    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);
    }
예제 #11
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;
            }
        }
예제 #12
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.InternetMessageId:
            this.InternetMessageId = reader.ReadElementValue <String>();
            return(true);

        case XmlElementNames.ParentInternetMessageId:
            this.ParentInternetMessageId = reader.ReadElementValue <String>();
            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">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;
                }
            }
        }
예제 #14
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.Name:
                this.name = reader.ReadElementValue();
                return(true);

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

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

            case XmlElementNames.MailboxType:
                this.mailboxType = reader.ReadElementValue <MailboxType>();
                return(true);

            case XmlElementNames.ItemId:
                this.id = new ItemId();
                this.id.LoadFromXml(reader, reader.LocalName);
                return(true);

            default:
                return(false);
            }
        }
예제 #15
0
    /// <summary>
    /// Loads from XML.
    /// </summary>
    /// <param name="reader">The reader.</param>
    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));
    }
        /// <summary>
        /// Reads response elements from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            base.ReadElementsFromXml(reader);

            this.imageBase64    = reader.ReadElementValue <string>(XmlNamespace.Messages, XmlElementNames.EncryptionConfigurationImageBase64);
            this.emailText      = reader.ReadElementValue <string>(XmlNamespace.Messages, XmlElementNames.EncryptionConfigurationEmailText);
            this.portalText     = reader.ReadElementValue <string>(XmlNamespace.Messages, XmlElementNames.EncryptionConfigurationPortalText);
            this.disclaimerText = reader.ReadElementValue <string>(XmlNamespace.Messages, XmlElementNames.EncryptionConfigurationDisclaimerText);
            this.otpEnabled     = reader.ReadElementValue <bool>(XmlNamespace.Messages, XmlElementNames.EncryptionConfigurationOTPEnabled);
        }
예제 #17
0
    /// <summary>
    /// Load from xml.
    /// </summary>
    /// <param name="reader">The reader.</param>
    /// <returns>Retention policy tag object.</returns>
    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);
    }
예제 #18
0
    /// <summary>
    /// Load from xml
    /// </summary>
    /// <param name="reader"></param>
    /// <returns></returns>
    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);
    }
예제 #19
0
    /// <summary>
    /// Load from xml
    /// </summary>
    /// <param name="reader"></param>
    /// <returns></returns>
    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);
    }
        /// <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);
        }
    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));
        }
예제 #23
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)
        {
            while (true)
            {
                switch (reader.LocalName)
                {
                case XmlElementNames.Name:
                    this.Name = reader.ReadElementValue();
                    break;

                case XmlElementNames.EmailAddress:
                    this.Address = reader.ReadElementValue();

                    // Process the next node before returning. Otherwise, the current </EmailAddress> node
                    // makes ComplexProperty.InternalLoadFromXml think that this ends the outer <EmailAddress>
                    // node, causing the remaining children of the outer EmailAddress node to be skipped.
                    reader.Read();
                    if (reader.NodeType == System.Xml.XmlNodeType.Element)
                    {
                        continue;
                    }
                    break;

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

                case XmlElementNames.MailboxType:
                    try {
                        this.MailboxType = reader.ReadElementValue <MailboxType>();
                    } catch (System.Exception) {
                        this.MailboxType = Data.MailboxType.Unknown;
                    }
                    break;

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

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

                default:
                    return(false);
                }

                return(true);
            }
        }
예제 #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)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.HighlightTermScope:
             this.scope = reader.ReadElementValue();
             return true;
         case XmlElementNames.HighlightTermValue:
             this.value = reader.ReadElementValue();
             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.VotingOptionDisplayName:
             this.displayName = reader.ReadElementValue<string>();
             return true;
         case XmlElementNames.SendPrompt:
             this.sendPrompt = reader.ReadElementValue<SendPrompt>();
             return true;
         default:
             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;
     }
 }
예제 #27
0
    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);
        }
    }
        /// <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;
            }
        }
예제 #29
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.NlgName:
            this.Name = reader.ReadElementValue <String>();
            return(true);

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

        default:
            return(base.TryReadElementFromXml(reader));
        }
    }
예제 #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.EmailAddress:
                this.Address = reader.ReadElementValue();
                return(true);

            case XmlElementNames.RoutingType:
                this.RoutingType = reader.ReadElementValue();
                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.Key:
                    this.Key = reader.ReadElementValue();
                    break;
                case XmlElementNames.Value:
                    this.Value = reader.ReadElementValue();
                    break;
                default:
                    return false;
            }

            return true;
        }
예제 #32
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);
            }
        }
예제 #33
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.StartTime:
            this.startTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
            return(true);

        case XmlElementNames.EndTime:
            this.endTime = reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
            return(true);

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

        case XmlElementNames.CalendarEventDetails:
            this.details = new CalendarEventDetails();
            this.details.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)
        {
            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;
            }
        }
        /// <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.MinimumSize:
                this.minimumSize = reader.ReadElementValue <int>();
                return(true);

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

            default:
                return(false);
            }
        }
예제 #36
0
    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();
        }
    }
        /// <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;
                }
            }
        }
예제 #38
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.HighlightTermScope:
                this.scope = reader.ReadElementValue();
                return(true);

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

            default:
                return(false);
            }
        }
예제 #39
0
    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);
        }
    }
예제 #40
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.InsightSource:
            this.InsightSource = reader.ReadElementValue <string>();
            break;

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

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

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

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

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

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

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

        case XmlElementNames.ProfilePicture:
            var picture = new UserProfilePicture();
            picture.LoadFromXml(reader, XmlNamespace.Types, XmlElementNames.ProfilePicture);
            this.profilePicture = picture;
            break;

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

        default:
            return(false);
        }

        return(true);
    }
예제 #41
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        while (true)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.Name:
                this.Name = reader.ReadElementValue <String>();
                break;

            case XmlElementNames.EmailAddress:
                this.Address = reader.ReadElementValue <String>();

                // Process the next node before returning. Otherwise, the current </EmailAddress> node
                // makes ComplexProperty.InternalLoadFromXml think that this ends the outer <EmailAddress>

                reader.Read();
                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    continue;
                }
                break;

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

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

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

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

            default:
                return(false);
            }

            return(true);
        }
    }
예제 #42
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.Date:
            // The date that is returned by Availability is unscoped.
            DateTime tempDate = DateTime.Parse(reader.ReadElementValue <String>(), CultureInfo.InvariantCulture);

            if (tempDate.Kind != DateTimeKind.Unspecified)
            {
                this.date = new DateTime(tempDate.Ticks, DateTimeKind.Unspecified);
            }
            else
            {
                this.date = tempDate;
            }

            return(true);

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

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

                    if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Suggestion))
                    {
                        TimeSuggestion timeSuggestion = new TimeSuggestion();

                        timeSuggestion.LoadFromXml(reader, reader.LocalName);

                        this.timeSuggestions.Add(timeSuggestion);
                    }
                }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.SuggestionArray));
            }

            return(true);

        default:
            return(false);
        }
    }
예제 #43
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.EndNodeUrl:
             this.EndNodeUrl = reader.ReadElementValue<string>();
             return true;
         case XmlElementNames.ActionUrl:
             this.ActionUrl = reader.ReadElementValue<string>();
             return true;
         case XmlElementNames.AppStatus:
             this.AppStatus = reader.ReadElementValue<string>();
             return true;
         default:
             return false;
     }
 }
예제 #44
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.Date:
                    // The date that is returned by Availability is unscoped. 
                    DateTime tempDate = DateTime.Parse(reader.ReadElementValue(), CultureInfo.InvariantCulture);

                    if (tempDate.Kind != DateTimeKind.Unspecified)
                    {
                        this.date = new DateTime(tempDate.Ticks, DateTimeKind.Unspecified);
                    }
                    else
                    {
                        this.date = tempDate;
                    }

                    return true;
                case XmlElementNames.DayQuality:
                    this.quality = reader.ReadElementValue<SuggestionQuality>();
                    return true;
                case XmlElementNames.SuggestionArray:
                    if (!reader.IsEmptyElement)
                    {
                        do
                        {
                            reader.Read();

                            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Suggestion))
                            {
                                TimeSuggestion timeSuggestion = new TimeSuggestion();

                                timeSuggestion.LoadFromXml(reader, reader.LocalName);

                                this.timeSuggestions.Add(timeSuggestion);
                            }
                        }
                        while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.SuggestionArray));
                    }

                    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 void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
        {
            string value = reader.ReadElementValue(XmlNamespace.Types, this.XmlElementName);

            if (!string.IsNullOrEmpty(value))
            {
                propertyBag[this] = this.Parse(value);
            }
        }
        /// <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);
            }
        }
예제 #47
0
    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);
     }
 }
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.Key:
            this.Key = reader.ReadElementValue <String>();
            break;

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

        default:
            return(false);
        }

        return(true);
    }
        /// <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.UpdatedUtcTicks:
                    this.UpdatedUtcTicks = reader.ReadElementValue<long>();
                    break;
                case XmlElementNames.Data:
                    this.Data = reader.ReadElementValue();
                    break;
                default:
                    return false;
            }

            return true;
        }
        /// <summary>
        /// Load from xml
        /// </summary>
        /// <param name="reader">The reader</param>
        /// <returns>Searchable mailbox object</returns>
        internal static SearchableMailbox LoadFromXml(EwsServiceXmlReader reader)
        {
            reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailbox);

            SearchableMailbox searchableMailbox = new SearchableMailbox();
            searchableMailbox.Guid = new Guid(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Guid));
            searchableMailbox.SmtpAddress = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.PrimarySmtpAddress);
            bool isExternalMailbox = false;
            bool.TryParse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.IsExternalMailbox), out isExternalMailbox);
            searchableMailbox.IsExternalMailbox = isExternalMailbox;
            searchableMailbox.ExternalEmailAddress = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ExternalEmailAddress);
            searchableMailbox.DisplayName = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.DisplayName);
            bool isMembershipGroup = false;
            bool.TryParse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.IsMembershipGroup), out isMembershipGroup);
            searchableMailbox.IsMembershipGroup = isMembershipGroup;
            searchableMailbox.ReferenceId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ReferenceId);

            return searchableMailbox;
        }
        /// <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.NlgOriginalPhoneString:
                    this.OriginalPhoneString = reader.ReadElementValue();
                    return true;

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

                case XmlElementNames.NlgType:
                    this.Type = reader.ReadElementValue();
                    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.IsUndecidedApprovalRequest:
             this.isUndecidedApprovalRequest = reader.ReadElementValue<bool>();
             return true;
         case XmlElementNames.ApprovalDecision:
             this.approvalDecision = reader.ReadElementValue<int>();
             return true;
         case XmlElementNames.ApprovalDecisionMaker:
             this.approvalDecisionMaker = reader.ReadElementValue<string>();
             return true;
         case XmlElementNames.ApprovalDecisionTime:
             this.approvalDecisionTime = reader.ReadElementValueAsDateTime().Value;
             return true;
         default:
             return false;
     }
 }
예제 #54
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.DayOfWeek:
             EwsUtilities.ParseEnumValueList<DayOfTheWeek>(
                 this.daysOfWeek,
                 reader.ReadElementValue(),
                 ' ');
             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;
     }
 }
예제 #55
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;
            }
        }
 /// <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.NlgEmailAddress:
             this.EmailAddress = reader.ReadElementValue();
             return true;
         
         default:
             return base.TryReadElementFromXml(reader);
     }
 }
예제 #57
0
 /// <summary>
 /// Reads response elements from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
 {
     reader.Read();
     this.ruleCollection.OutlookRuleBlobExists = reader.ReadElementValue<bool>(
         XmlNamespace.Messages, 
         XmlElementNames.OutlookRuleBlobExists);
     reader.Read();
     if (reader.IsStartElement(XmlNamespace.NotSpecified, XmlElementNames.InboxRules))
     {
         this.ruleCollection.LoadFromXml(reader, XmlNamespace.NotSpecified, XmlElementNames.InboxRules);
     }
 }
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal void LoadFromXml(EwsServiceXmlReader reader)
        {
            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Notification);

            do
            {
                NotificationGroup notifications = new NotificationGroup();
                notifications.SubscriptionId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SubscriptionId);
                notifications.Events = new Collection<NotificationEvent>();

                lock (this)
                {
                    this.events.Add(notifications);
                }

                do
                {
                    reader.Read();

                    if (reader.IsStartElement())
                    {
                        string eventElementName = reader.LocalName;
                        EventType eventType;

                        if (GetEventsResults.XmlElementNameToEventTypeMap.TryGetValue(eventElementName, out eventType))
                        {
                            if (eventType == EventType.Status)
                            {
                                // We don't need to return status events
                                reader.ReadEndElementIfNecessary(XmlNamespace.Types, eventElementName);
                            }
                            else
                            {
                                this.LoadNotificationEventFromXml(
                                    reader,
                                    eventElementName,
                                    eventType, 
                                    notifications);
                            }
                        }
                        else
                        {
                            reader.SkipCurrentElement();
                        }
                    }
                }
                while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.Notification));

                reader.Read();
            }
            while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.Notifications));
        }
예제 #59
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;
     }
 }
        /// <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;
        }