0

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.

1
  • Already found a solution for this?
    – Ole Albers
    Commented Dec 6, 2012 at 14:18

1 Answer 1

0

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);
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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