If someone ever had a similar experience, i'm trying to update word document in the document library and the problem is that my ItemUpdated
is triggered multiple times.
I think that last clientContext.ExecuteQuery()
triggers the ItemUpdated
again.?
My question is how to use this.EventFiringEnabled = false;
in SharePoint 2013.
Here is the sample of my code:
public void ProcessOneWayEvent(SPRemoteEventProperties properties)
{
using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
try
{
List docLib = clientContext.Web.Lists.GetById(properties.ItemEventProperties.ListId);
ListItem item = docLib.GetItemById(properties.ItemEventProperties.ListItemId);
clientContext.Load(item);
clientContext.ExecuteQuery();
//This is just for testing i update word document here
item["Title"] = "NEW Title " + System.DateTime.Now.ToLongTimeString();
////////////////////////////////////////////////
item.Update();
clientContext.ExecuteQuery();
}
catch (Exception oops)
{
System.Diagnostics.Trace.WriteLine(oops.Message);
}
}
}
}