XXX Chats


On itemupdating

To work around this issue, I implemented the following code: The code looks for the key (the Doc ID) in the property bag and if it is present, skip the creation of the task and remove the property from the bag.

The document's Doc ID is being used as the key--it will be unique.

I've done my due diligence and followed recommendations here and here.

I made sure that the event receiver was not registered twice using the Share Point 2010 Manager tool.

In this Item Updated event, we are simply assigning the current List Item to a new SPList Item object, changing its "Title" property, and updating it. However, this simple piece of code will cause an endless loop, as each time you call list Item. As you can see, we need a way to prevent this loop from occuring.

Luckily there is an easy and elegant solution with a little custom code.

The requirement is pretty simple, when a document is added to the Documents library or an existing document is updated, create a task for someone to review the document's metadata.

The problem is that the Item Updated event in this custom Event Receiver will fire twice under certain circumstances--such as having require document checkout set on the Documents library.String() the other Item Updating used New Values(). What you can do is, in updating: Session["old Values"] = e. String() the Irem Inserting send the email as requested vut the Item Updating does it 25% of the time. You can also add new parameters that're not part of the input form if needed (for example, f you need to set some default values or additional params for a sproc). Item Updated fires after the data has been successfully persisted on the database. Old Values; and in updated: IOrdered Dictionary old Values = (IOrdered Dictionary)Session["old Values"]; I need more help with this Putting Session["old Values"] = e. I have several of these that make up the Saved data and put it in the body of the email o Mail. This will most likely work for 99.9% of all implementations, but why take the risk.There may be other code working some magic here as well, and by saving off the value and setting it back you do not interfere with anything else that may be going on. All we need to do is wrap our previous code in a Using statement: Viola! Update() fires, we are inside the scope of our Disabled Events Scope class which has disabled event firing.One idea why Any help would be grealty appreciated There's a significant difference between the two. Old Values in Item Updating results in Syntax Error Property access must assign to the property or use its value Identifier expected Also the Item Updated part is generating errors Not sure what it requires. Item Updating is fired as soon as the user clicks "update" and before the data is sent to the data store to be updated. It appears one is during the process the other after the fact. hope it helps you Yes, the mail should be sent from updated and not updating. I have some code that is identical in Item Updating and Item Inserting The only differnce is one use Values(). There's really no built in way to grab the previous values in updated. I made sure to Disable Event Firing() before creating the task item.Regardless of what I tried, I really couldn't track down exactly why it was getting fired twice.

Comments On itemupdating