Accessing a WCF Service from a Custom Timer Job

At work, we have a job that has to run every 5 minutes and that check to see if a permission list has been change in our SharePoint environment. If an item in the list changed, the job has to update the Access Control Log (ACL) on a Shared drive on a remote server.

 

image_5.png

To achieve this with SharePoint, we had to develop a SharePoint Custom Job. The logic was to be such that the timer job would be responsible for checking to see if a change happened, and in case there has been a change, call an external WCF Service that would then handle the ACl attribution on the external folder. The big problem is that timer jobs run inside the OWSTimer.exe process, so defining the external WCF contract in the web.config is not going to cut it. After much struggle with this, the solution was found to be easier than thought. The OWSTimer service uses a file located at

 

[14 Hive]/Bin/Owstimer.exe.config

 

This file acts as an app.config file for the timer service. All you need to do for your custom Timer Jobs to have access to your external WCF service, is to define the contract’s info in there. Don’t forget to restart the SharePoint timer service after you’ve made the modification!

Microsoft Premier Field Engineer – SharePoint

Leave a Comment

Your email address will not be published. Required fields are marked *

*
*