Exemplo n.º 1
0
        public void AttachItems()
        {
            OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");
            string           text             = (string)base.GetParameter("CK");
            bool             flag             = false;
            Item             item;

            if (!string.IsNullOrEmpty(text) && owaStoreObjectId != null)
            {
                item = Utilities.GetItem <Item>(base.UserContext, owaStoreObjectId, text, new PropertyDefinition[0]);
                if (base.UserContext.IsIrmEnabled)
                {
                    Utilities.IrmDecryptIfRestricted(item, base.UserContext, true);
                }
            }
            else
            {
                flag = true;
                StoreObjectType itemType = (StoreObjectType)base.GetParameter("IT");
                item = this.CreateImplicitDraftItemHelper(itemType, null);
            }
            List <OwaStoreObjectId> itemsToAttachIds   = this.GetItemsToAttachIds();
            SanitizedHtmlString     errorInAttachments = AttachmentUtility.AddExistingItems(item, itemsToAttachIds, base.UserContext);

            item.Load();
            if (base.UserContext.IsIrmEnabled)
            {
                Utilities.IrmDecryptIfRestricted(item, base.UserContext, true);
            }
            ArrayList attachmentInformation = AttachmentWell.GetAttachmentInformation(item, null, base.UserContext.IsPublicLogon);

            RenderingUtilities.RenderAttachmentItems(this.SanitizingWriter, attachmentInformation, base.UserContext);
            this.SanitizingWriter.Write("<div id=attIB>");
            AttachmentWell.RenderInfobar(this.SanitizingWriter, attachmentInformation, errorInAttachments, base.UserContext);
            this.SanitizingWriter.Write("</div>");
            if (flag)
            {
                base.WriteNewItemId(item);
            }
            this.RenderTotalAttachmentSize(item);
            base.WriteChangeKey(item);
            if (item != null)
            {
                item.Dispose();
            }
        }