In an event receiver, Item Was Updated. I want to Compare the Moderation status on ListItems to perform some functionality.This is just some of the code.
SPList list = web.Lists["DocLib"];
SPListItem item = list.GetItemById(listItemID);
var moderationStatus = item["_ModerationStatus"] as string;
if(moderationStatus == SPModerationStatusType.Approve.ToString())
//Do stuff
So I should be able to get the values from this to make the comparison in a later stage:
string beforeStatus = properties.BeforeProperties["_ModerationStatus"] as string;
string afterStatus = properties.AfterProperties["_ModerationStatus"] as string;
In Document Libraries we know that:
- BeforeProperties = Original Value.
- AfterProperties = Changed Value.
But beforeStatus and afterStatus is null.
Does someone have any tips of other ways to Compare the values? I have even tried to take get the value form "ItemUptading" to get the value before it updates.