views:

598

answers:

1

I've got a SharePoint timer job that takes a document library and puts the documents, converts them to PDF and puts them into a SQL server every night. Problem is, the timer job doesn't seem to work when it's called on the schedule. If I install it and then using a little console app I wrote, call execute on the job it works properly. When it runs on schedule it doesn't.

The reasons I know the job is running:

  1. The timer job status says that it completed at ~12 minutes past midnight (starts on midnight)
  2. The target database table has been truncated (the job is ment to do this before an export)

The reasons I know something is wrong:

  1. The database is empty and contains no documents. Running it manually fills it with documents
  2. The very first line of code should output to the event log but it doesn't do this once. Running the job manually logs correctly several times. Another timer job to test writing to the log works correctly on this server.

Now I was thinking it's something weird to do with permissions when running under owstimer opposed to a console app. But the fact is, first thing it does is log to the windows event log and this isn't happening but in a timer job that only does this, it does work. And the truncate code is being hit which is after the event logging which doesn't seem to happen.

Any suggestions would be much appriciated.

+1  A: 

When you run the job via the console app, it is running in the security context of your user.

When the job is run via the timer it is running in the security context of the user running that process.

Check which user is running the timer job, check the rights of that user. There should be an error in the event log or the sharepoint log files.

Shiraz Bhaiji