本文整理汇总了C#中EwsServiceXmlReader.EnsureCurrentNodeIsStartElement方法的典型用法代码示例。如果您正苦于以下问题:C# EwsServiceXmlReader.EnsureCurrentNodeIsStartElement方法的具体用法?C# EwsServiceXmlReader.EnsureCurrentNodeIsStartElement怎么用?C# EwsServiceXmlReader.EnsureCurrentNodeIsStartElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EwsServiceXmlReader
的用法示例。
在下文中一共展示了EwsServiceXmlReader.EnsureCurrentNodeIsStartElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromXml
/// <summary>
/// Loads from XML.
/// </summary>
/// <param name="reader">The reader.</param>
internal void LoadFromXml(EwsServiceXmlReader reader)
{
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Duration);
this.startTime = reader.ReadElementValueAsDateTime(XmlNamespace.Types, XmlElementNames.StartTime).Value;
this.endTime = reader.ReadElementValueAsDateTime(XmlNamespace.Types, XmlElementNames.EndTime).Value;
reader.ReadEndElement(XmlNamespace.Types, XmlElementNames.Duration);
}
示例2: LoadFromXml
/// <summary>
/// Loads from XML.
/// </summary>
/// <param name="reader">The reader.</param>
/// <returns>SearchFilter.</returns>
internal static SearchFilter LoadFromXml(EwsServiceXmlReader reader)
{
reader.EnsureCurrentNodeIsStartElement();
string localName = reader.LocalName;
SearchFilter searchFilter = GetSearchFilterInstance(localName);
if (searchFilter != null)
{
searchFilter.LoadFromXml(reader, reader.LocalName);
}
return searchFilter;
}
示例3: TryReadElementFromXml
/// <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)
{
reader.EnsureCurrentNodeIsStartElement();
TimeZoneTransition transition = TimeZoneTransition.Create(this.timeZoneDefinition, reader.LocalName);
transition.LoadFromXml(reader);
EwsUtilities.Assert(
transition.TargetPeriod != null,
"TimeZoneTransitionGroup.TryReadElementFromXml",
"The transition's target period is null.");
this.transitions.Add(transition);
return true;
}
示例4: LoadFromXml
/// <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;
}
示例5: LoadPropertyValueFromXml
/// <summary>
/// Loads from XML.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="propertyBag">The property bag.</param>
internal override sealed void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
{
ResponseActions value = ResponseActions.None;
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, this.XmlElementName);
if (!reader.IsEmptyElement)
{
do
{
reader.Read();
if (reader.IsStartElement())
{
value |= GetResponseAction(reader.LocalName);
}
}
while (!reader.IsEndElement(XmlNamespace.Types, this.XmlElementName));
}
propertyBag[this] = value;
}
示例6: 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();
}
示例7: LoadPropertyValueFromXml
/// <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)
{
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Recurrence);
Recurrence recurrence = null;
reader.Read(XmlNodeType.Element); // This is the pattern element
recurrence = GetRecurrenceFromString(reader.LocalName);
recurrence.LoadFromXml(reader, reader.LocalName);
reader.Read(XmlNodeType.Element); // This is the range element
RecurrenceRange range = GetRecurrenceRange(reader.LocalName);
range.LoadFromXml(reader, reader.LocalName);
range.SetupRecurrence(recurrence);
reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.Recurrence);
propertyBag[this] = recurrence;
}
示例8: LoadFromXml
/// <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;
}
示例9: LoadPropertyValueFromXml
/// <summary>
/// Loads from XML.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="propertyBag">The property bag.</param>
internal override sealed void LoadPropertyValueFromXml(EwsServiceXmlReader reader, PropertyBag propertyBag)
{
EffectiveRights value = EffectiveRights.None;
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, this.XmlElementName);
if (!reader.IsEmptyElement)
{
do
{
reader.Read();
if (reader.IsStartElement())
{
switch (reader.LocalName)
{
case XmlElementNames.CreateAssociated:
if (reader.ReadElementValue<bool>())
{
value |= EffectiveRights.CreateAssociated;
}
break;
case XmlElementNames.CreateContents:
if (reader.ReadElementValue<bool>())
{
value |= EffectiveRights.CreateContents;
}
break;
case XmlElementNames.CreateHierarchy:
if (reader.ReadElementValue<bool>())
{
value |= EffectiveRights.CreateHierarchy;
}
break;
case XmlElementNames.Delete:
if (reader.ReadElementValue<bool>())
{
value |= EffectiveRights.Delete;
}
break;
case XmlElementNames.Modify:
if (reader.ReadElementValue<bool>())
{
value |= EffectiveRights.Modify;
}
break;
case XmlElementNames.Read:
if (reader.ReadElementValue<bool>())
{
value |= EffectiveRights.Read;
}
break;
case XmlElementNames.ViewPrivateItems:
if (reader.ReadElementValue<bool>())
{
value |= EffectiveRights.ViewPrivateItems;
}
break;
}
}
}
while (!reader.IsEndElement(XmlNamespace.Types, this.XmlElementName));
}
propertyBag[this] = value;
}
示例10: LoadFromXml
/// <summary>
/// Load from xml
/// </summary>
/// <param name="reader"></param>
/// <returns></returns>
internal static SearchRefinerItem LoadFromXml(EwsServiceXmlReader reader)
{
SearchRefinerItem sri = new SearchRefinerItem();
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Refiner);
sri.Name = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Name);
sri.Value = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Value);
sri.Count = reader.ReadElementValue<long>(XmlNamespace.Types, XmlElementNames.Count);
sri.Token = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Token);
return sri;
}
示例11: LoadPreviewItemsXml
/// <summary>
/// Load preview items xml
/// </summary>
/// <param name="reader">The reader</param>
/// <returns>Array of preview items</returns>
private static SearchPreviewItem[] LoadPreviewItemsXml(EwsServiceXmlReader reader)
{
List<SearchPreviewItem> previewItems = new List<SearchPreviewItem>();
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.Items);
do
{
reader.Read();
if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchPreviewItem))
{
SearchPreviewItem previewItem = new SearchPreviewItem();
do
{
reader.Read();
if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Id))
{
previewItem.Id = new ItemId();
previewItem.Id.ReadAttributesFromXml(reader);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ParentId))
{
previewItem.ParentId = new ItemId();
previewItem.ParentId.ReadAttributesFromXml(reader);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Mailbox))
{
previewItem.Mailbox = new PreviewItemMailbox();
previewItem.Mailbox.MailboxId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.MailboxId);
previewItem.Mailbox.PrimarySmtpAddress = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.PrimarySmtpAddress);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.UniqueHash))
{
previewItem.UniqueHash = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.UniqueHash);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SortValue))
{
previewItem.SortValue = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SortValue);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.OwaLink))
{
previewItem.OwaLink = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.OwaLink);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Sender))
{
previewItem.Sender = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Sender);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ToRecipients))
{
previewItem.ToRecipients = GetRecipients(reader, XmlElementNames.ToRecipients);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.CcRecipients))
{
previewItem.CcRecipients = GetRecipients(reader, XmlElementNames.CcRecipients);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.BccRecipients))
{
previewItem.BccRecipients = GetRecipients(reader, XmlElementNames.BccRecipients);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.CreatedTime))
{
previewItem.CreatedTime = DateTime.Parse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.CreatedTime));
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ReceivedTime))
{
previewItem.ReceivedTime = DateTime.Parse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ReceivedTime));
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SentTime))
{
previewItem.SentTime = DateTime.Parse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SentTime));
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Subject))
{
previewItem.Subject = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Subject);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Preview))
{
previewItem.Preview = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Preview);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Size))
{
previewItem.Size = ulong.Parse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Size));
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Importance))
{
previewItem.Importance = (Importance)Enum.Parse(typeof(Importance), reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Importance));
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Read))
{
previewItem.Read = bool.Parse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Read));
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.HasAttachment))
{
previewItem.HasAttachment = bool.Parse(reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.HasAttachment));
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ExtendedProperties))
//.........这里部分代码省略.........
示例12: LoadExtendedPropertiesXml
/// <summary>
/// Load extended properties xml
/// </summary>
/// <param name="reader">The reader</param>
/// <returns>Extended properties collection</returns>
private static ExtendedPropertyCollection LoadExtendedPropertiesXml(EwsServiceXmlReader reader)
{
ExtendedPropertyCollection extendedProperties = new ExtendedPropertyCollection();
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.ExtendedProperties);
do
{
reader.Read();
if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ExtendedProperty))
{
extendedProperties.LoadFromXml(reader, XmlElementNames.ExtendedProperty);
}
}
while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.ExtendedProperties));
return extendedProperties.Count == 0 ? null : extendedProperties;
}
示例13: LoadFromXml
/// <summary>
/// Load from xml
/// </summary>
/// <param name="reader">The reader</param>
/// <returns>Discovery search configuration object</returns>
internal static DiscoverySearchConfiguration LoadFromXml(EwsServiceXmlReader reader)
{
List<SearchableMailbox> mailboxes = new List<SearchableMailbox>();
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, XmlElementNames.DiscoverySearchConfiguration);
DiscoverySearchConfiguration configuration = new DiscoverySearchConfiguration();
configuration.SearchId = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SearchId);
// the query could be empty means there won't be Query element, hence needs to read and check
// if the next element is not Query, then it means already read SearchableMailboxes element
configuration.SearchQuery = string.Empty;
configuration.InPlaceHoldIdentity = string.Empty;
configuration.ManagedByOrganization = string.Empty;
configuration.Language = string.Empty;
do
{
reader.Read();
if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchQuery))
{
configuration.SearchQuery = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SearchQuery);
reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.SearchQuery);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailboxes))
{
// search object without any source mailbox is possible, hence need to check if element is empty
if (!reader.IsEmptyElement)
{
while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.SearchableMailboxes))
{
reader.Read();
if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SearchableMailbox))
{
mailboxes.Add(SearchableMailbox.LoadFromXml(reader));
reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.SearchableMailbox);
}
}
}
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.InPlaceHoldIdentity))
{
configuration.InPlaceHoldIdentity = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.InPlaceHoldIdentity);
reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.InPlaceHoldIdentity);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ManagedByOrganization))
{
configuration.ManagedByOrganization = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ManagedByOrganization);
reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.ManagedByOrganization);
}
else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.Language))
{
configuration.Language = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Language);
reader.ReadEndElementIfNecessary(XmlNamespace.Types, XmlElementNames.Language);
}
else
{
break;
}
}
while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.DiscoverySearchConfiguration));
configuration.SearchableMailboxes = mailboxes.Count == 0 ? null : mailboxes.ToArray();
return configuration;
}
示例14: TryReadElementFromXml
/// <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)
{
reader.EnsureCurrentNodeIsStartElement(this.Namespace, XmlElementNames.DictionaryEntry);
this.LoadEntry(reader);
return true;
}
示例15: LoadFromXml
/// <summary>
/// Loads 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)
{
reader.EnsureCurrentNodeIsStartElement(XmlNamespace.Types, xmlElementName);
if (reader.HasAttributes)
{
this.culture = reader.ReadAttributeValue("xml:lang");
}
this.message = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.Message);
reader.ReadEndElement(XmlNamespace.Types, xmlElementName);
}