I want to develop my first sharepoint add-in for implementing a remote event receiver. so i did these steps, without any success in forcing the RER to fire:-
- I have office 365 + Visual Studio 2015 professional.
- I open VS 2015 -> create a new project of type SharePoint Add-in:-
- then i enter the following:-
- Team site collection url
- add-in type as SharePoint-hosted
4. after that i mention that the type is for office 365:-
5. i right click on the project>> new item >> RER + to fire on custom lists when items are being added:
6. then i added this test code inside the remote event receiver, to update a custom list items' title to be "updated title":-
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
{
SPRemoteEventResult result = new SPRemoteEventResult();
using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
if (clientContext != null)
{
if (properties.EventType == SPRemoteEventType.ItemAdding)
{
result.ChangedItemProperties.Add("Title", "updated title");
}
// clientContext.Load(clientContext.Web);
// clientContext.ExecuteQuery();
}
}
return result;
}
7. then i try running the project but i got this error:-
Error occurred in deployment step 'Install SharePoint Add-in': Sideloading of apps is not enabled on this site.
so i realize that i can not directly add my add-in to a team site.
8. so i changed the add-in url to use the developer site url.
9. then i run the add-in, and i got this page, which seems inside my dev site collection:-
- so i trusted the app, then i add a new custom list, but when i add a new item inside the new custom list, title did not get modified, so seems the RER did not get fired.
so are my above steps valid? or there is something missing?
Thanks