本文整理汇总了C#中EwsServiceXmlReader.EnsureCurrentNodeIsEndElement方法的典型用法代码示例。如果您正苦于以下问题:C# EwsServiceXmlReader.EnsureCurrentNodeIsEndElement方法的具体用法?C# EwsServiceXmlReader.EnsureCurrentNodeIsEndElement怎么用?C# EwsServiceXmlReader.EnsureCurrentNodeIsEndElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EwsServiceXmlReader
的用法示例。
在下文中一共展示了EwsServiceXmlReader.EnsureCurrentNodeIsEndElement方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromXml
/// <summary>
/// Loads from XML.
/// </summary>
/// <param name="reader">The reader.</param>
internal void LoadFromXml(EwsServiceXmlReader reader)
{
reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Resolution);
reader.ReadStartElement(XmlNamespace.Types, XmlElementNames.Mailbox);
this.mailbox.LoadFromXml(reader, XmlElementNames.Mailbox);
reader.Read();
if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Contact))
{
this.contact = new Contact(this.owner.Session);
// Contacts returned by ResolveNames should behave like Contact.Load with FirstClassPropertySet specified.
this.contact.LoadFromXml(
reader,
true, /* clearPropertyBag */
PropertySet.FirstClassProperties,
false); /* summaryPropertiesOnly */
reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Resolution);
}
else
{
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.Resolution);
}
}
示例2: ReadElementsFromXml
/// <summary>
/// Reads response elements from XML.
/// </summary>
/// <param name="reader">The reader.</param>
internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
{
this.Rooms.Clear();
base.ReadElementsFromXml(reader);
reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Rooms);
if (!reader.IsEmptyElement)
{
// Because we don't have an element for count of returned object,
// we have to test the element to determine if it is StartElement of return object or EndElement
reader.Read();
while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Room))
{
reader.Read(); // skip the start <Room>
EmailAddress emailAddress = new EmailAddress();
emailAddress.LoadFromXml(reader, XmlElementNames.RoomId);
this.Rooms.Add(emailAddress);
reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Room);
reader.Read();
}
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.Rooms);
}
}
示例3: ReadElementsFromXml
/// <summary>
/// Reads response elements from XML.
/// </summary>
/// <param name="reader">The reader.</param>
internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
{
responseCollection = new ServiceResponseCollection<MailTipsResponseMessage>();
base.ReadElementsFromXml(reader);
reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages);
if (!reader.IsEmptyElement)
{
// Because we don't have count of returned objects
// test the element to determine if it is return object or EndElement
reader.Read();
while (reader.IsStartElement(XmlNamespace.Messages, XmlElementNames.MailTipsResponseMessageType))
{
MailTipsResponseMessage mrm = new MailTipsResponseMessage();
mrm.LoadFromXml(reader, XmlElementNames.MailTipsResponseMessageType);
this.responseCollection.Add(mrm);
reader.Read();
}
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, XmlElementNames.ResponseMessages);
}
}
示例4: ReadElementsFromXml
/// <summary>
/// Read Conversations from XML.
/// </summary>
/// <param name="reader">The reader.</param>
internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
{
this.groupsSets.Clear();
base.ReadElementsFromXml(reader);
reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.GroupsSets);
if (!reader.IsEmptyElement)
{
reader.Read();
while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet))
{
UnifiedGroupsSet unifiedGroupsSet = new UnifiedGroupsSet();
unifiedGroupsSet.LoadFromXml(reader, XmlElementNames.UnifiedGroupsSet);
this.groupsSets.Add(unifiedGroupsSet);
}
// Skip end element GroupsSets
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsSets);
reader.Read();
}
}
示例5: ReadElementsFromXml
/// <summary>
/// Reads response elements from XML.
/// </summary>
/// <param name="reader">The reader.</param>
internal override void ReadElementsFromXml(EwsServiceXmlReader reader)
{
this.Manifests.Clear();
base.ReadElementsFromXml(reader);
reader.Read(XmlNodeType.Element);
// We can have a response from Exchange 2013 (first time this API was introduced)
// or the newer response, starting in Exchange 2013 SP1, (X-EWS-TargetVersion: 2.5 or above)
bool exchange2013Response;
if (XmlElementNames.Manifests.Equals(reader.LocalName))
{
exchange2013Response = true;
}
else if (XmlElementNames.Apps.Equals(reader.LocalName))
{
exchange2013Response = false;
}
else
{
throw new ServiceXmlDeserializationException(
string.Format(
Strings.UnexpectedElement,
EwsUtilities.GetNamespacePrefix(XmlNamespace.Messages),
XmlElementNames.Manifests,
XmlNodeType.Element,
reader.LocalName,
reader.NodeType));
}
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();
if (exchange2013Response)
{
this.ReadFromExchange2013(reader);
}
else
{
this.ReadFromExchange2013Sp1(reader);
}
}
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Messages, exchange2013Response ? XmlElementNames.Manifests : XmlElementNames.Apps);
}
示例6: ReadFromExchange2013Sp1
/// <summary>
/// Read the response from Exchange 2013.
/// This method assumes that the reader is currently at the Manifests element.
/// </summary>
/// <param name="reader">The reader.</param>
private void ReadFromExchange2013Sp1(EwsServiceXmlReader reader)
{
////<GetAppManifestsResponse ResponseClass="Success" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
//// <ResponseCode>NoError</ResponseCode>
//// <m:Apps xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
//// <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <--- reader should be at this node at the beginning of the loop
//// <t:Metadata>
//// <t:EndNodeUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&ver=15&clid=1033&p1=15d0d766d0&p2=4&p3=0&p4=WA&p5=en-US\WA102996382&Scope=2&CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&DeployId=EXHV-4680dom.extest.microsoft.com</t:EndNodeUrl>
//// <t:AppStatus>2.3</t:AppStatus>
//// <t:ActionUrl>http://o15.officeredir.microsoft.com/r/rlidMktplcExchRedirect?app=outlook.exe&ver=15&clid=1033&p1=15d0d766d0&p2=4&p3=0&p4=WA&p5=en-US\WA102996382&Scope=2&CallBackURL=https%3a%2f%2fexhv-4880%2fecp%2fExtension%2finstallFromURL.slab%3fexsvurl%3d1&DeployId=EXHV-4680dom.extest.microsoft.com</t:ActionUrl>
//// </t:Metadata>
//// <t:Manifest>[base 64 encoded manifest]</t:Manifest>
//// </t:App>
//// <t:App xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
//// ....
//// <m:Apps> <----- reader should be at this node at the end of the loop
while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.App))
{
ClientApp clientApp = new ClientApp();
clientApp.LoadFromXml(reader, XmlElementNames.App);
this.Apps.Add(clientApp);
this.Manifests.Add(clientApp.Manifest);
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.App);
reader.Read();
}
}
示例7: LoadFromXml
/// <summary>
/// Read Conversations from XML.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="xmlElementName">The name of the xml element</param>
internal override void LoadFromXml(EwsServiceXmlReader reader, string xmlElementName)
{
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet);
do
{
reader.Read();
switch (reader.LocalName)
{
case XmlElementNames.FilterType:
this.FilterType = (UnifiedGroupsFilterType)Enum.Parse(typeof(UnifiedGroupsFilterType), reader.ReadElementValue(), false);
break;
case XmlElementNames.TotalGroups:
this.TotalGroups = reader.ReadElementValue<int>();
break;
case XmlElementNames.GroupsTag:
reader.Read();
while (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup))
{
UnifiedGroup unifiedGroup = new UnifiedGroup();
unifiedGroup.LoadFromXml(reader, XmlElementNames.UnifiedGroup);
this.unifiedGroups.Add(unifiedGroup);
}
// Skip end element.
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.GroupsTag);
reader.Read();
break;
default:
break;
}
}
while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet));
// Skip end element
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroupsSet);
reader.Read();
}
示例8: ReadElementsFromXml
/// <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();
}
}
示例9: LoadFromXml
/// <summary>
/// Read Conversations from XML.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="xmlElementName">The xml element to read.</param>
internal override void LoadFromXml(EwsServiceXmlReader reader, string xmlElementName)
{
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup);
do
{
reader.Read();
switch (reader.LocalName)
{
case XmlElementNames.SmtpAddress:
this.SmtpAddress = reader.ReadElementValue();
break;
case XmlElementNames.LegacyDN:
this.LegacyDN = reader.ReadElementValue();
break;
case XmlElementNames.MailboxGuid:
this.MailboxGuid = reader.ReadElementValue();
break;
case XmlElementNames.DisplayName:
this.DisplayName = reader.ReadElementValue();
break;
case XmlElementNames.IsFavorite:
this.IsFavorite = reader.ReadElementValue<bool>();
break;
case XmlElementNames.LastVisitedTimeUtc:
this.LastVisitedTimeUtc = reader.ReadElementValue();
break;
case XmlElementNames.AccessType:
this.AccessType = (UnifiedGroupAccessType)Enum.Parse(typeof(UnifiedGroupAccessType), reader.ReadElementValue(), false);
break;
case XmlElementNames.ExternalDirectoryObjectId:
this.ExternalDirectoryObjectId = reader.ReadElementValue();
break;
default:
break;
}
}
while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.UnifiedGroup));
// Skip end element
reader.EnsureCurrentNodeIsEndElement(XmlNamespace.NotSpecified, XmlElementNames.UnifiedGroup);
reader.Read();
}