LinkedIn

Showing posts with label Remote Event Receiver. Show all posts
Showing posts with label Remote Event Receiver. Show all posts

Sunday, November 6, 2016

Solved Remote Event Receiver on updated will be firing multiple times in SharePoint 2013/16

 Most of you who are working on Remote Event Receivers must have encountered this issue of "Updated event getting fired multiple times". The following code should fix the issue:

Use the adding or updating events. And then update the title within the "ProcessEvent" as follows:

public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
    {
        SPRemoteEventResult result = new SPRemoteEventResult();

            result.ChangedItemProperties.Add("Title", "NEW Title");
            result.Status = SPRemoteEventServiceStatus.Continue;
        return result;
    }


or



   public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
        {
            SPRemoteEventResult result = new SPRemoteEventResult();
            if (properties.EventType == SPRemoteEventType.ItemAdding ||
                properties.EventType == SPRemoteEventType.ItemUpdating)
            {
                // Generate Image Search for Flower
                result.ChangedItemProperties.Add("Title", 
                    "My New Title");
                result.Status = SPRemoteEventServiceStatus.Continue;
            }
            return result;

        }


Reference:

http://code.msdn.microsoft.com/office/SharePoint-2013-Add-list-2c6e71e0