Hi All,
I need to pass a value from ItemUpdating to ItemUpdated event receiver, can anyone please suggest me how I can do it?
Regards Amit
Technology Tips and News
Hi All,
I need to pass a value from ItemUpdating to ItemUpdated event receiver, can anyone please suggest me how I can do it?
Regards Amit
Hello,
can you explain your requirement?
Can't you do all your process in the itemupdated? if you need previous value, i think you can get "beforevalues" in the itemupdated event if you declare it as "synchronous".
<Receiver>
<Name>EventReceiver1ItemUpdated</Name>
<Type>ItemUpdated</Type>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<Class>Class.EventReceiver1.EventReceiver1</Class>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
</Receiver>
hi amit use code like bellow :
static string test = string.Empty; public override void ItemUpdating(SPItemEventProperties properties) { test = "tttt"; } public override void ItemUpdated(SPItemEventProperties properties) { // use test variable }
Hi IIker,
I have already used this code however it doesn't work.
Regards Amit
You can try using the properties argument.
link: http://sampathnarsingam.blogspot.com/2012/05/sharepoint-2010-send-notification-on.html
Hi Paul,
I do agree with you. Static will not work. I have gone through the link that you have provided in last reply. You have mentioned to use the properties argument however in link dummy list column (i.e. old status) is being used to pass the infomation.
Regards amit
Hello Amit,
I hope the problem is still persisting.
If the previous link is not working, i would recommend you to use Cache object to solve it. Create a cache with key unique as listid,itemid,username. Store the key/value with auto deletion after a particular time. You should remember to retrieve the key in the reverse order of insertion.
Considering the problem of multiple front end servers, i should say that you can go for some distributed caching mechanisms like ncache, if necessary.
Please let us know your thoughts.
Hi Paul,
That is a good suggestion. I suppose it is better to use the cache.
Regarding the multiple front end server case, i suppose both itemupdated and itemupdating will always execute on same front end server. so i should worry about the front end server case. what do you say paul?
Regards Amit
Hei Amit,
As long as both events executing in same server, you are right.
Same Issue is giving in the Sandbox solution, how to pass the values between both the events. Tried many thing
1. Static Does not work
2. Before properties returns null
3. Property bag : Gives error does not work
4.HTTP caching : Give error
Please help in this issue.
Got the solution at last, doing to much of searching and stretching my mind :).
Well, create one column in the Main List, where values are changes say "OLDVALUES". Set that field using the properties.ListItem["OLDVALUES"]=Value1+";" +Value2+";" +Value3+";"; in ItemUpdating event(take Value1, Values2 and Value3 using the properties.ListItem["Value1"] and son on).
Now in Item Updating, use like string oldValue = properties.ListItem["OLDVALUES"].ToString(); and slip in array and then you can set global variables and access them in your code. Remember its a SandBox solution approach for event receivers, not for farm solution.
Bharat Sukhwal