/// <summary> /// Parses the XML through the specified reader and creates an Autodiscover error. /// </summary> /// <param name="reader">The reader.</param> /// <returns>An Autodiscover error.</returns> internal static AutodiscoverError Parse(EwsXmlReader reader) { AutodiscoverError error = new AutodiscoverError(); error.time = reader.ReadAttributeValue(XmlAttributeNames.Time); error.id = reader.ReadAttributeValue(XmlAttributeNames.Id); do { reader.Read(); if (reader.NodeType == XmlNodeType.Element) { switch (reader.LocalName) { case XmlElementNames.ErrorCode: error.errorCode = reader.ReadElementValue<int>(); break; case XmlElementNames.Message: error.message = reader.ReadElementValue(); break; case XmlElementNames.DebugData: error.debugData = reader.ReadElementValue(); break; default: reader.SkipCurrentElement(); break; } } } while (!reader.IsEndElement(XmlNamespace.NotSpecified, XmlElementNames.Error)); return error; }
/// <summary> /// Initializes a new instance of the <see cref="AutodiscoverRemoteException"/> class. /// </summary> /// <param name="message">The message.</param> /// <param name="error">The error.</param> /// <param name="innerException">The inner exception.</param> public AutodiscoverRemoteException( string message, AutodiscoverError error, Exception innerException) : base(message, innerException) { this.error = error; }
/// <summary> /// Tries to read the current XML element. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True is the current element was read, false otherwise.</returns> internal virtual bool TryReadCurrentXmlElement(EwsXmlReader reader) { if (reader.LocalName == XmlElementNames.Error) { this.error = AutodiscoverError.Parse(reader); return true; } else { return false; } }
/// <summary> /// Tries to read the current XML element. /// </summary> /// <param name="reader">The reader.</param> /// <returns>True is the current element was read, false otherwise.</returns> internal virtual bool TryReadCurrentXmlElement(EwsXmlReader reader) { if (reader.LocalName == XmlElementNames.Error) { this.error = AutodiscoverError.Parse(reader); return(true); } else { return(false); } }
/// <summary> /// Parses the XML through the specified reader and creates an Autodiscover error. /// </summary> /// <param name="reader">The reader.</param> /// <returns>An Autodiscover error.</returns> internal static AutodiscoverError Parse(EwsXmlReader reader) { AutodiscoverError error = new AutodiscoverError(); error.time = reader.ReadAttributeValue(XmlAttributeNames.Time); error.id = reader.ReadAttributeValue(XmlAttributeNames.Id); do { reader.Read(); if (reader.NodeType == XmlNodeType.Element) { switch (reader.LocalName) { case XmlElementNames.ErrorCode: error.errorCode = reader.ReadElementValue <int>(); break; case XmlElementNames.Message: error.message = reader.ReadElementValue(); break; case XmlElementNames.DebugData: error.debugData = reader.ReadElementValue(); break; default: reader.SkipCurrentElement(); break; } } }while (!reader.IsEndElement(XmlNamespace.NotSpecified, XmlElementNames.Error)); return(error); }
/// <summary> /// Initializes a new instance of the <see cref="AutodiscoverRemoteException"/> class. /// </summary> /// <param name="error">The error.</param> public AutodiscoverRemoteException(AutodiscoverError error) : base() { this.error = error; }
/// <summary> /// Initializes a new instance of the <see cref="T:Microsoft.Exchange.WebServices.Data.AutodiscoverRemoteException"/> class with serialized data. /// </summary> /// <param name="info">The object that holds the serialized object data.</param> /// <param name="context">The contextual information about the source or destination.</param> protected AutodiscoverRemoteException(SerializationInfo info, StreamingContext context) : base(info, context) { this.error = (AutodiscoverError)info.GetValue("Error", typeof(AutodiscoverError)); }