コード例 #1
0
        /// <summary>
        /// An item was updated.
        /// </summary>
        public override void ItemUpdated(SPItemEventProperties properties)
        {
            base.ItemUpdated(properties);
            Requirement newRequirement = new Requirement();

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (newRequirement.site = new SPSite(properties.WebUrl))
                {
                    using (newRequirement.web = newRequirement.site.OpenWeb())
                    {
                        newRequirement.listItemForm = newRequirement.web.Lists[properties.ListId].GetItemById(properties.ListItemId);
                        newRequirement.LoadInfoPathForm();
                        newRequirement.CreateTempFolder();
                        newRequirement.GetPdfTemplates();
                        newRequirement.CreateRequirementPdf();
                        newRequirement.UploadFile(newRequirement.libraryNameRequirements, newRequirement.pdfFileNameRequirement, newRequirement.requirementPdf, true);
                        newRequirement.UpdateListItemRequirement();
                        newRequirement.UploadAttachments();
                        if (!newRequirement.reasonEmpty)
                        {
                            newRequirement.CreateReasonPdf();
                            newRequirement.UploadFile(newRequirement.libraryNameReasons, newRequirement.pdfFileNameReason, newRequirement.reasonPdf, true);
                            newRequirement.UpdateListItemReason();
                        }
                        newRequirement.StartSPWorkflow(newRequirement.workflow1Name);
                    }
                }
            });
        }