Aim: I want whenever someone creates a new Task, validate it and cancel if needed.
Enviroment details: Currently I'm using Project Server 2013 and trying to make remote event handlers work. Remote event handlers are in WCF service which is in ASP.NET Web Application, hosted on IIS on Windows Server along with Project Server.
Currently I have 2 WCF services in my application:
ProjectEventReceiver.svc :
namespace EventHandlersTest { public class ProjectEventReceiverDemo : IProjectEventReceiverRemote { ... public ProjectPreEventArgs OnCreatingRemote(PSContextInfo contextInfo, Guid eventHandlerUid, ProjectPreEventArgs e) { if (/*invalid project name for example*/) { e.Cancel = true; } return e; } ... } }
This one is binded in SharePoint Central Administation -> ... -> Server Side Event Handlers -> to the event
Project - Creating
like this:Class Name: EventHandlersTest.ProjectEventReceiverDemo
Url: http://localhost:6569/EventHandlersTest/ProjectEventReceiver.svc
The url is ok, I can access that .cvs file in browser. This handler works perfectly (for example when I create a new Enterprise Project with invalid name - the event is caught, creation canceled and I can see my custom logs show that class was constructed and method
OnCreatingRemote
was invoked).
Now the problem itself with second service:
TaskEventReceiver.svc :
namespace EventHandlersTest { public class TaskEventReceiverDemo : IStatusingEventReceiverRemote { ... public StatusCreateTaskPreEventArgs OnTaskCreatingRemote(PSContextInfo contextInfo, Guid eventHandlerUid, StatusCreateTaskPreEventArgs e) { // just cancel everything for now e.Cancel = true; return e; } ... } }
This one is binded to the event
Statusing - TaskCreating
like this:Class Name: EventHandlersTest.TaskEventReceiverDemo
Url: http://localhost:6569/EventHandlersTest/TaskEventReceiver.svc
Again, url is correct - I can access it in browser.
Now problematic flow: I created a SharePoint Task List Project, then I go there and click on New Task
, fill in required name - it creates a task. Event isn't received, object of class TaskEventReceiverDemo
is not created and the method OnTaskCreatingRemote
is not invoked.
I'm not sure if IStatusingEventReceiverRemote
is a correct interface, because there is no really helpful descriptions in the reference, so I made assumptions only based on method names.
I also tried to implement IResourceEventReceiverRemote
, particularly method OnCreatingRemote
and bind it to Resource - OnCreating
- the same result (and it seems to be logical because Task is not a Resource).
Question: Can someone shed some light on what is the name of event which would be rised when I create a task such as described in problematic flow? Or maybe I am doing something wrong and cannot figure it out.
Thanks in advance.