I am currently trying to develop an event receiver that uses properties.AfterProperties object in updating and ItemUpdated and ItemUpdating event, so can I get the BeforeProperties and AfterProperties in my ItemCheckedIn event or ItemCheckedout event?
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);
}
ItemUpdated
instead ofItemUpdating
?ItemUpdated
.Will I get the values if I useItemUpdated
event?ItemUpdating
, then my doubt is that, the issue should appear in the test and staging environments. We have tested thoroughly this in the above 2 environments and ported the content db back up to production and deployed the webpart's latest wsp. So as per my understanding there should not be an issue when triggering the event receiver.The only difference between in staging and production is, staging is <mydms.company.com> and production is in <mydms.company.com> .