1

何をしても、タイトルの前後は常に null です。これは、会議またはイベント リストでレシーバーを更新したアイテムです。

!

[public override void ItemUpdated(SPItemEventProperties properties)
        {
            Logger.LogDebug("MeetingCalendarEvents", "ItemUpdated(SPItemEventProperties properties)", "BEGIN");
            base.ItemUpdated(properties);
            try
            {
                base.EventFiringEnabled = false;
                SPSite site = properties.Web.Site;
                string sitename= properties.BeforeProperties\["Title"\].ToString();
                SPWeb web = site.RootWeb.Webs\[sitename\];
                web.AllowUnsafeUpdates = true;
                string prefix = properties.BeforeProperties\["Title"\].ToString().Substring(0, 2);
                web.Title = properties.AfterProperties\["Title"\].ToString();
                DateTime eventDate = properties.AfterProperties.GetValueAsDateTime(MeetingsCommon.Constants.FIELDS_EVENTDATE_NAME);
                if (eventDate != DateTime.MinValue)
                {
                    string titleMeetingCalendarItem = eventDate.ToString("yyyyMMdd");
                    titleMeetingCalendarItem = string.Format("{0}{1}", prefix, titleMeetingCalendarItem);
                    properties.AfterProperties.SetAfterPropertyValue("Title", titleMeetingCalendarItem);
                    web.ServerRelativeUrl = "/" + titleMeetingCalendarItem;               
                }
                web.Update();

                web.AllowUnsafeUpdates = false;
                base.EventFiringEnabled = true;
            }
            catch (Exception ex)
            {
                Logger.LogError("MeetingCalendarEvents", "ItemUpdated(SPItemEventProperties properties)", ex);
                properties.ErrorMessage = ex.Message;
                properties.Cancel = true;
            }
            finally
            {
                base.EventFiringEnabled = true;
            }
            Logger.LogDebug("MeetingCalendarEvents", "ItemUpdated(SPItemEventProperties properties)", "END");
        }]

ここに画像の説明を入力

4

1 に答える 1

1

ここに答えてください:

http://www.synergyonline.com/Blog/Lists/Posts/Post.aspx?ID=122

于 2012-08-27T14:25:54.397 に答える