Error with GetJobWaitTime

I

Ismael

I have the next method to manage jobs in Project Server 2007:

private static void WaitForQueue(w2003wss2.QueueSystem q, Guid jobGuid)
{
w2003wss2.JobState jobState;
const int QUEUE_WAIT_TIME = 2;
bool jobDone = false;
string xmlError = string.Empty;
int wait = 0;

wait = q.GetJobWaitTime(jobGuid);

System.Threading.Thread.Sleep(wait * 1000);

do
{
jobState = q.GetJobCompletionState(jobGuid, out xmlError);

if (jobState == w2003wss2.JobState.Success)
{
jobDone = true;
}
else
{
if (jobState == w2003wss2.JobState.Unknown
|| jobState == w2003wss2.JobState.Failed
|| jobState == w2003wss2.JobState.FailedNotBlocking
|| jobState == w2003wss2.JobState.CorrelationBlocked
|| jobState == w2003wss2.JobState.Canceled)
{
throw (new ApplicationException("Queue request failed \"" + jobState + "\"
Job ID: " + jobGuid + ".\r\n" + xmlError));
}
else
{
System.Threading.Thread.Sleep(QUEUE_WAIT_TIME *
1000);
}
}
}
while (!jobDone);
}

When GetJobWaitTime() method is executed, an exception appears:

HTTP status 401: Unauthorized error

What happen? How can I solve this problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top