当前位置: 首页>>代码示例>>C#>>正文


C# EwsServiceXmlReader.SkipCurrentElement方法代码示例

本文整理汇总了C#中EwsServiceXmlReader.SkipCurrentElement方法的典型用法代码示例。如果您正苦于以下问题:C# EwsServiceXmlReader.SkipCurrentElement方法的具体用法?C# EwsServiceXmlReader.SkipCurrentElement怎么用?C# EwsServiceXmlReader.SkipCurrentElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EwsServiceXmlReader的用法示例。


在下文中一共展示了EwsServiceXmlReader.SkipCurrentElement方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadElementsFromXml

        /// <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();
            }
        }
开发者ID:XavierDa,项目名称:ews-managed-api,代码行数:60,代码来源:FindPeopleResponse.cs

示例2: ReadElementsFromXml

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

            using (XmlReader returnValueReader = reader.GetXmlReaderForNode())
            {
                this.ReturnValue = new SafeXmlDocument();
                this.ReturnValue.Load(returnValueReader);
            }

            reader.SkipCurrentElement();
            reader.ReadEndElementIfNecessary(XmlNamespace.Messages, XmlElementNames.ReturnValue);
        }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:17,代码来源:ExecuteDiagnosticMethodResponse.cs

示例3: TryLoadFromXml

 /// <summary>
 /// Tries to load from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <param name="propertyDefinition">The property definition.</param>
 /// <returns>True if property was loaded.</returns>
 internal static bool TryLoadFromXml(EwsServiceXmlReader reader, ref PropertyDefinitionBase propertyDefinition)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.FieldURI:
             propertyDefinition = ServiceObjectSchema.FindPropertyDefinition(reader.ReadAttributeValue(XmlAttributeNames.FieldURI));
             reader.SkipCurrentElement();
             return true;
         case XmlElementNames.IndexedFieldURI:
             propertyDefinition = new IndexedPropertyDefinition(
                 reader.ReadAttributeValue(XmlAttributeNames.FieldURI),
                 reader.ReadAttributeValue(XmlAttributeNames.FieldIndex));
             reader.SkipCurrentElement();
             return true;
         case XmlElementNames.ExtendedFieldURI:
             propertyDefinition = new ExtendedPropertyDefinition();
             (propertyDefinition as ExtendedPropertyDefinition).LoadFromXml(reader);
             return true;
         default:
             return false;
     }
 }
开发者ID:asine,项目名称:ews-managed-api,代码行数:28,代码来源:PropertyDefinitionBase.cs

示例4: ReadElementsFromXml

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

            this.results.TotalCount = reader.ReadAttributeValue<int>(XmlAttributeNames.TotalItemsInView);
            this.results.MoreAvailable = !reader.ReadAttributeValue<bool>(XmlAttributeNames.IncludesLastItemInRange);

            // Ignore IndexedPagingOffset attribute if MoreAvailable is false.
            this.results.NextPageOffset = results.MoreAvailable ? reader.ReadNullableAttributeValue<int>(XmlAttributeNames.IndexedPagingOffset) : null;

            reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Folders);
            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();

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

                        if (folder == null)
                        {
                            reader.SkipCurrentElement();
                        }
                        else
                        {
                            folder.LoadFromXml(
                                        reader,
                                        true, /* clearPropertyBag */
                                        this.propertySet,
                                        true  /* summaryPropertiesOnly */);

                            this.results.Folders.Add(folder);
                        }
                    }
                }
                while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.Folders));
            }

            reader.ReadEndElement(XmlNamespace.Messages, XmlElementNames.RootFolder);
        }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:46,代码来源:FindFolderResponse.cs

示例5: LoadFromXml

        /// <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));
        }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:62,代码来源:UserConfiguration.cs

示例6: ReadElementsFromXml

        /// <summary>
        /// Read Conversations from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
        {
            EwsUtilities.Assert(
                   this.Results.Conversations != null,
                   "FindConversationResponse.ReadElementsFromXml",
                   "conversations is null.");

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

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

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

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

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

            reader.Read();

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

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

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

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

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

                reader.Read();
            }

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

                reader.Read();
            }
        }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:84,代码来源:FindConversationResponse.cs

示例7: LoadFromXml

        /// <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));
        }
开发者ID:liliankasem,项目名称:ProjectSpikeAPI,代码行数:56,代码来源:GetStreamingEventsResults.cs

示例8: LoadFromXml

        /// <summary>
        /// Loads response from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="xmlElementName">Name of the XML element.</param>
        internal void LoadFromXml(EwsServiceXmlReader reader, string xmlElementName)
        {
            if (!reader.IsStartElement(XmlNamespace.Messages, xmlElementName))
            {
                reader.ReadStartElement(XmlNamespace.Messages, xmlElementName);
            }

            this.result = reader.ReadAttributeValue<ServiceResult>(XmlAttributeNames.ResponseClass);

            if (this.result == ServiceResult.Success || this.result == ServiceResult.Warning)
            {
                if (this.result == ServiceResult.Warning)
                {
                    this.errorMessage = reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.MessageText);
                }
                else
                {
                    reader.ReadElementValue();
                    if (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MessageText))
                    {
                        this.errorMessage = reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.MessageText);
                    }
                }

                this.errorCode = reader.ReadElementValue<ServiceError>(XmlNamespace.Messages, XmlElementNames.ResponseCode);

                if (this.result == ServiceResult.Warning)
                {
                    reader.ReadElementValue<int>(XmlNamespace.Messages, XmlElementNames.DescriptiveLinkKey);
                }

                // If batch processing stopped, EWS returns an empty element. Skip over it.
                if (this.BatchProcessingStopped)
                {
                    do
                    {
                        reader.Read();
                    }
                    while (!reader.IsEndElement(XmlNamespace.Messages, xmlElementName));
                }
                else
                {
                    this.ReadElementsFromXml(reader);

                    reader.ReadEndElementIfNecessary(XmlNamespace.Messages, xmlElementName);
                }
            }
            else
            {
                this.errorMessage = reader.ReadElementValue(XmlNamespace.Messages, XmlElementNames.MessageText);
                this.errorCode = reader.ReadElementValue<ServiceError>(XmlNamespace.Messages, XmlElementNames.ResponseCode);
                reader.ReadElementValue<int>(XmlNamespace.Messages, XmlElementNames.DescriptiveLinkKey);

                while (!reader.IsEndElement(XmlNamespace.Messages, xmlElementName))
                {
                    reader.Read();

                    if (reader.IsStartElement())
                    {
                        if (!this.LoadExtraErrorDetailsFromXml(reader, reader.LocalName))
                        {
                            reader.SkipCurrentElement();
                        }
                    }
                }
            }

            this.MapErrorCodeToErrorMessage();

            this.Loaded();
        }
开发者ID:AdamMachera,项目名称:ews-managed-api,代码行数:76,代码来源:ServiceResponse.cs

示例9: LoadFromXml

        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal void LoadFromXml(EwsServiceXmlReader reader)
        {
            reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Notification);

            this.subscriptionId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SubscriptionId);
            this.previousWatermark = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.PreviousWatermark);
            this.moreEventsAvailable = reader.ReadElementValue<bool>(XmlNamespace.Types, XmlElementNames.MoreEvents);

            do
            {
                reader.Read();

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

                    if (xmlElementNameToEventTypeMap.Member.TryGetValue(eventElementName, out eventType))
                    {
                        this.newWatermark = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Watermark);

                        if (eventType == EventType.Status)
                        {
                            // We don't need to return status events
                            reader.ReadEndElementIfNecessary(XmlNamespace.Types, eventElementName);
                        }
                        else
                        {
                            this.LoadNotificationEventFromXml(
                                reader,
                                eventElementName,
                                eventType);
                        }
                    }
                    else
                    {
                        reader.SkipCurrentElement();
                    }
                }
            }
            while (!reader.IsEndElement(XmlNamespace.Messages, XmlElementNames.Notification));
        }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:46,代码来源:GetEventsResults.cs


注:本文中的EwsServiceXmlReader.SkipCurrentElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。