public static ItemIndexError ConvertSearchErrorCode(string searchErrorCode)
        {
            ItemIndexError result = ItemIndexError.None;

            Enum.TryParse <ItemIndexError>(searchErrorCode, true, out result);
            return(result);
        }
        /// <summary>
        /// Load from xml
        /// </summary>
        /// <param name="reader">The reader</param>
        /// <returns>Non indexable item object</returns>
        internal static NonIndexableItem LoadFromXml(EwsServiceXmlReader reader)
        {
            NonIndexableItem result = null;

            if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.NonIndexableItemDetail))
            {
                ItemId         itemId             = null;
                ItemIndexError errorCode          = ItemIndexError.None;
                string         errorDescription   = null;
                bool           isPartiallyIndexed = false;
                bool           isPermanentFailure = false;
                int            attemptCount       = 0;
                DateTime?      lastAttemptTime    = null;
                string         additionalInfo     = null;
                string         sortValue          = null;

                do
                {
                    reader.Read();
                    if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ItemId))
                    {
                        itemId = new ItemId();
                        itemId.ReadAttributesFromXml(reader);
                    }
                    else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ErrorDescription))
                    {
                        errorDescription = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.ErrorDescription);
                    }
                    else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.IsPartiallyIndexed))
                    {
                        isPartiallyIndexed = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.IsPartiallyIndexed);
                    }
                    else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.IsPermanentFailure))
                    {
                        isPermanentFailure = reader.ReadElementValue <bool>(XmlNamespace.Types, XmlElementNames.IsPermanentFailure);
                    }
                    else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.AttemptCount))
                    {
                        attemptCount = reader.ReadElementValue <int>(XmlNamespace.Types, XmlElementNames.AttemptCount);
                    }
                    else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.LastAttemptTime))
                    {
                        lastAttemptTime = reader.ReadElementValue <DateTime>(XmlNamespace.Types, XmlElementNames.LastAttemptTime);
                    }
                    else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.AdditionalInfo))
                    {
                        additionalInfo = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.AdditionalInfo);
                    }
                    else if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.SortValue))
                    {
                        sortValue = reader.ReadElementValue(XmlNamespace.Types, XmlElementNames.SortValue);
                    }
                }while (!reader.IsEndElement(XmlNamespace.Types, XmlElementNames.NonIndexableItemDetail));

                result = new NonIndexableItem
                {
                    ItemId             = itemId,
                    ErrorCode          = errorCode,
                    ErrorDescription   = errorDescription,
                    IsPartiallyIndexed = isPartiallyIndexed,
                    IsPermanentFailure = isPermanentFailure,
                    AttemptCount       = attemptCount,
                    LastAttemptTime    = lastAttemptTime,
                    AdditionalInfo     = additionalInfo,
                    SortValue          = sortValue,
                };
            }

            return(result);
        }