/// <summary>
        /// An item was updated.
        /// </summary>
        public override void ItemUpdated(SPItemEventProperties properties)
        {
            String workBoxURL = properties.ListItem.WBxGetAsString(WBColumn.WorkBoxURL);

            if (!String.IsNullOrEmpty(workBoxURL))
            {
                using (WorkBox workBox = new WorkBox(workBoxURL))
                {
                    workBox.ReferenceDate = (DateTime)properties.ListItem["EventDate"];

                    if (workBox.Item.WBxColumnExists("EventDate"))
                    {
                        workBox.Item["EventDate"] = properties.ListItem["EventDate"];
                    }

                    if (workBox.Item.WBxColumnExists("EndDate"))
                    {
                        workBox.Item["EndDate"] = properties.ListItem["EndDate"];
                    }

                    workBox.JustUpdate();
                    workBox.UpdateCachedDetails();
                }
            }

            base.ItemUpdated(properties);
        }
Exemplo n.º 2
0
        /// <summary>
        /// An item was updated.
        /// </summary>
        public override void ItemUpdated(SPItemEventProperties properties)
        {
            String workBoxURL = properties.ListItem.WBxGetAsString(WBColumn.WorkBoxURL);

            if (!String.IsNullOrEmpty(workBoxURL))
            {
                using (WorkBox workBox = new WorkBox(workBoxURL))
                {
                    workBox.ReferenceDate = (DateTime)properties.ListItem["EventDate"];

                    if (workBox.Item.WBxColumnExists("EventDate"))
                    {
                        workBox.Item["EventDate"] = properties.ListItem["EventDate"];
                    }

                    if (workBox.Item.WBxColumnExists("EndDate"))
                    {
                        workBox.Item["EndDate"] = properties.ListItem["EndDate"];
                    }

                    workBox.GenerateTitle();
                    workBox.Item.Update();
                    workBox.UpdateCachedDetails();

                    workBox.UpdateWorkBoxWebSiteTitle();

                    // Finally we're going to update the title of the calendar event as it may have changed
                    // in light of the update to the title of the associated work box.
                    using (EventsFiringDisabledScope noevents = new EventsFiringDisabledScope())
                    {
                        properties.ListItem["Title"] = workBox.Title;
                        properties.ListItem.Update();
                    }
                }
            }

            base.ItemUpdated(properties);
        }