Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ScheduledPageEventReceiver : SPItemEventReceiver
- {
- protected void HandleScheduling(PublishingPage page)
- {
- Type t = typeof(PublishingPage);
- MethodInfo notificationMethod = t.GetMethod("UpdateNotificationList",BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod);
- if (notificationMethod != null)
- {
- notificationMethod.Invoke(page, null);
- }
- }
- public override void ItemUpdating(SPItemEventProperties properties)
- {
- if (properties == null)
- {
- throw new ArgumentNullException("properties");
- }
- if (properties.AfterProperties == null)
- {
- throw new ArgumentNullException("properties.AfterProperties");
- }
- object status = properties.AfterProperties["vti_doclibmodstat"];
- if ((status != null) && (Convert.ToInt32(status, CultureInfo.InvariantCulture) == 0)) //Approved
- {
- using (SPWeb web = properties.OpenWeb())
- {
- SPListItem item = web.GetFile(properties.BeforeUrl).Item;
- if (PublishingPage.IsPublishingPage(item) && PublishingPage.IsScheduledItem(item))
- {
- PublishingPage page = PublishingPage.GetPublishingPage(item);
- HandleScheduling(page);
- return;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment