I am currently trying to develop an event receiver that checks if an item being updated is already in the ItemCheckedIn event handler.
I have read that in the properties.AfterProperties object it shows the what is being updated on a List Item. What I have seen is that, the value I am setting in ItemUpdating or ItemUpdated eventhandler method will not be visible or available in ItemCheckedIn event handler. So is there any way I can access this value? I need to pass the latest value of the item's column info. and be available in itemcheckedin method.I know, I can not use properties.AfterProperties[" "] in itemcheckedin event since its not available.
If I explain my scenario,when the user upload a document he will select a drop down,public and confidential,and when
confidential is selected am triggering a custom action such that,3 people pickers were populated for entering the user names for giving access programmatically. I can say its a kind of approval workflow i am trying to implement through visual web part and
event receiver -without using SP
D 2013
/ WF
Manager
. The strange thing is that, it works in my test and staging environment, but fails in production.
public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
try
{
if (properties.AfterProperties["vti_sourcecontrolcheckedoutby"] == null
&& properties.BeforeProperties["vti_sourcecontrolcheckedoutby"] != null)
{
if (IsConfidential(properties))
{
SetRoleChanged(properties);
}
}
}
public void SetRoleChanged(SPItemEventProperties properties)
{
try
{
string currentRead =
Convert.ToString(properties.AfterProperties[READACCESSCOL]);
string oldRead =
Convert.ToString(properties.BeforeProperties[READACCESSCOL]);
string x2 =
Convert.ToString(properties.ListItem[READACCESSCOL]);
}
string currentView =
Convert.ToString(properties.AfterProperties[VIEWACCESSCOL]);
string oldView =
Convert.ToString(properties.BeforeProperties[VIEWACCESSCOL]);
if (currentView != oldView)
{
properties.AfterProperties["ViewChanged"] = "true";
}
public override void ItemUpdated(SPItemEventProperties properties)
{
base.ItemUpdated(properties);
}
Would like to know any other approaches I can implement for achieving this?
- Edited by SaMolPP Tuesday, June 02, 2015 8:20 AM