I hade the exact same problem last week and found no built in way of solving it. What I ended up doing was checking the value of beforeProperties and afterProperties of what I wanted to update, and if there was no difference, then I broke out of the method. I actually wrote a blog post about it.
This is an annoying problem that I hope Microsoft improves in ...
Could you please check as if your client id is expired or not. Generally this error can be found when the Client Secret Id got Expired. To get the end date of when the client secret will expire you have to query the application keys using the client Id. If the current secret id is expired then you have to remove the it and create a new one.
I thing this ...
Answering your 4 questions:
Remote Event Receiver (RER) -
A provider hosted app is must, which means you need additional infra. Apparently, as pointed out by Mihail-Florin Popa, it is no longer true.
Works using web services, you expose web services on your provider hosted app, that are called when an event is fired.
Only Client Object Model ...
Yes event receiver do get fired if item is updated from client object model code. This is how I tested it. Created a custom list and added a text column named "Quantity" to it. Then created a SharePoint project containing an event receiver "ItemAdded". This event is added to custom lists only. Then added code to update the title of the item.
public override ...
Remote event receivers are mainly introduced for cloud or office 365 environment (SharePoint Online) where the core logic will run in an hosted environment outside of SharePoint Sites and still try to achieve the regular event handler functionalities.
You can still develop them for as SharePoint Ad-In's even in 2013 server but i will list out ...
If you are finding it difficult to debug your remote event receiver,
most probably you would be using an incorrect connection string to
connect to the Microsoft Azure Service Bus. Visual Studio Error List
“Cannot register Services/RemoteEventReceiver1.svc on Microsoft Azure
Service Bus: The remote server returned an error: (500) ...
It's a normal behavior, where
You have set EventType to ItemAdded
receiver.EventType = EventReceiverType.ItemAdded;
Then in the next line, the EventType is set (overwrite) to ItemUpdated again!
So the On ItemUpdated event only will work!
To overcome this issue, you should add each EventType to list ...
If you want to use client id and secret across site collections, you should add tenant scoped permissions for your app:
If you want to register the app once and use it for any site collection, it's better to apply tenant scope permissions, so you can use this credentials everywhere inside your SharePoint tenant. In order to apply tenant scoped ...
You want to attach a remote event receiver to a list in the host web? You have to run some code in order to do that. It can be done from an App Installed event, through your site provisioning process, through PowerShell, or whatever.
EventReceiverDefinitionCreationInformation receiver = new EventReceiverDefinitionCreationInformation();
How to set property in List
PropertyValue.FieldValues is read-only property, the following example demonstrates how to set property for a List:
var list = ctx.Web.Lists.GetByTitle(listTitle);
var listProperties = list.RootFolder.Properties;
listProperties[key] = value;
How to load properties for a ...
You will not be able to capture events on SharePoint in a reliable way for mission critical events. The best you can hope for is to poll the data at intervals for the changes you are looking for.
SharePoint was not designed for these types of systems, and does not support them well. If you implement workarounds those workarounds are going to cause you ...
If you want to create Remote Event Receiver for List on Host Web, the following articles for your reference:
Attaching Remote Event Receivers to Lists in the Host Web
Remote Event Receiver (RER) for Host Web using SharePoint Provider Hosted App in Office 365/SharePoint Online Environment
There are two ways to deploy your event receiver, Check This ...
this worked in my scenario.
List companylibrary = clientContext.Web.Lists.GetByTitle(CompanyType);
Web site = clientContext.Web;
clientContext.Load(site, s => s.RoleDefinitions);
Suggestion for your second question,
Better to use web-hooks instead of remote event receivers. Web hooks support only asynchronous -ed events (like updated, deleted, etc). Assess the requirements in your current farm, if none of the event receivers are fired before the database transaction happens, more precisely synchronous -ing events are not required (...
My normal approach for this would be to add a ListAdded remote event receiver to the host web in the AppInstalled event.
Now any time a new list is added in the host web your ListAdded remote event receiver will be called, and then you can attach your list event receivers as needed.
I faced this problem today in Client Object Model, it seems like it doesn't support comparing to strings either with == or Equals method.
.Where(n => n.ReceiverName == "List_Events") this is what is causing the issue..
You might need to Load EventReceiverDefinitionCollection webEvs object and than iterate through the collection to match the ReceiverName ...
You should configure service bus to debug remote event receivers.
Please read my two full step-by-step articles (with information about service bus configuration) about Remote Event Receivers in SharePoint Online:
1) Creating and Debugging of Remote Event Receivers for SharePoint Online http://blog.virtosoftware.com/2014/12/creating-and-debugging-of-remote-...
For your question "Is it possible to attach a Remote Event Receiver to a list programmatically?, The answer is YES. Yes it is possible to attach the remote event receiver programmatically.
We can make use of EventReceiverDefinitionCreationInformation class to make this possible in AppInstalled event.
For your query there is perfect article written here
Remote Event receivers are hosted as a web service remotely which is possible through only Provider hosted apps in SharePoint 2013
SharePoint hosted apps doesn't allow any objects to be hosted remotely so you should go with Provider Hosted Apps.
Sharepoint add-on is new standard and MSFT encourage all the customer to adopt that one.
Main reason (there are many others)is Office 365, if your company want to move Office 365 then you have to rewrite all customs solutions as add-on. In O365 no farm solution deployment at all.
And you know this feature already on the path of death, so why not start with ...
Use this to break role inheritance and remove all permissions.
//method defined by CSOM
public virtual void BreakRoleInheritance(bool copyRoleAssignments, bool clearSubscopes);
Hope this helps.
To Migrate the whole site collection with sub-site and contents you need to use the third party tool like share-gate , metalogix etc.
However it depends on the size of site collection if it does not have more data than you can store site as template and create the site with that template in Office 365. or you can store all lists/libraries as ...
You can use AfterProperties, at least in ItemUpdated events. You'll need to sniff the contents of these dictionaries out using the debugger because they're totally not intuitive and as you likely know not documented anywhere.
In my example, I'm using ItemUpdated to update an Item (triggering another ItemUpdated), and you can infer by inspecting the ...
There are two way to debug your RERs:
Remote debugging is convenient, but it requires a lot of prerequisites:
deploy your app in Azure
remotely attach from Visual Studio to your Azure Web app instance and debug
It takes time and sometimes doesn't work stable.
From the other hand local debugging is much faster, ...
Use the cloud explorer in Visual Studio and "attach debugger"
Use a proxy like ngrok. I have a blog post that shows how to do that: https://derekgusoff.wordpress.com/2017/11/08/remote-event-receivers-youre-all-doing-it-wrong/
Just an alternate workaround if nothing else works.Since there is no built in method which mimics this.EventFiringEnabled the only way is to set a flag outside this item which will enable us to know whether the current update event is called by a genuine update through browser or external code or from an update called from an update event.
Create another ...
Yes, it is possible.
Just handle the event receiver while installing the app by changing the property attribute to true as sown below.
And then just write the following code
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
SPRemoteEventResult result = new SPRemoteEventResult();
this.EventFiringEnabled = false; is used in Server object model. However, there doesn't seem to be its equivalent in Client object model. So the alternative is to check the field value first before making any changes to avoid the update operation recurrence. See similar question here: http://social.technet.microsoft.com/Forums/exchange/en-US/7f21121c-6bef-...