Ejemplo n.º 1
0
        private AttachmentRetriever(string id, IdConverterDependencies converterDependencies)
        {
            bool flag = false;

            try
            {
                ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "Initialize IdAndSession to get attachment, id = {0}", id);
                List <AttachmentId> attachmentIds     = new List <AttachmentId>();
                IdHeaderInformation headerInformation = ServiceIdConverter.ConvertFromConcatenatedId(id, BasicTypes.ItemOrAttachment, attachmentIds);
                Item         item = null;
                IdAndSession idAndSession;
                try
                {
                    idAndSession = IdConverter.ConvertId(converterDependencies, headerInformation, IdConverter.ConvertOption.IgnoreChangeKey | IdConverter.ConvertOption.NoBind, BasicTypes.ItemOrAttachment, attachmentIds, null, this.GetHashCode(), false, ref item);
                }
                finally
                {
                    if (item != null)
                    {
                        item.Dispose();
                        item = null;
                    }
                }
                this.attachmentHierarchy = new AttachmentHierarchy(idAndSession, false, true);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    this.Dispose();
                }
            }
        }