Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there any way to get all local contentdeployment jobs from within web application code?

I'm trying to list all jobs on an aspx page in the backend of a site collection, but everytime I execute this:

ContentDeploymentJob.GetAllJobs()

an AccessDenied Exception raises, saying that the executing user is not a farm admin. If I try it with ElevatedPriviliges or Impersonation as farm admin it doesnt work too.

share|improve this question
    
Already found a solution for this? –  Ole Albers Dec 6 '12 at 14:18
add comment

1 Answer 1

up vote 0 down vote accepted

After a few months of not thinking about this issue I found an answer:

Execute the following PowerShell Script and it should work (tested on a standalone farm):

PS C:\Users\xxx> $contentService  = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
PS C:\Users\xxx> $contentService.RemoteAdministratorAccessDenied = $false
PS C:\Users\xxx> $contentService.Update()

Here my testing code (executed in a webpart):

try
{
    ContentDeploymentJobCollection jobs = ContentDeploymentJob.GetAllJobs();
    foreach (ContentDeploymentJob job in jobs)
    {
        BulletedList1.Items.Add(job.Name);
    }
 }
 catch (Exception ex)
 {
     BulletedList1.Items.Add(ex.Message);
 }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.