예제 #1
0
        /// <summary>
        /// For ItemAttachment, AttachmentId and Item should be patched.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        internal override bool TryReadElementFromXmlToPatch(EwsServiceXmlReader reader)
        {
            // update the attachment id.
            base.TryReadElementFromXml(reader);

            reader.Read();
            Type itemClass = EwsUtilities.GetItemTypeFromXmlElementName(reader.LocalName);

            if (itemClass != null)
            {
                if (this.item == null || this.item.GetType() != itemClass)
                {
                    throw new ServiceLocalException(Strings.AttachmentItemTypeMismatch);
                }

                this.item.LoadFromXml(reader, false /* clearPropertyBag */);
                return(true);
            }

            return(false);
        }