Project Server 2007 PSI - Bug/Limitation or What [Onpublishing event - CICOCheckedOutToOtherUser]

R

Ram

I am trying to update some task names based on some information on
other columns. I need to do this when the project is published.
Though I have checkedout the project, I get CICOCheckedOutToOtherUser
error when I publish the project.

Am I doing somethin wrong?



public override void OnPublishing(PSLib.PSContextInfo contextInfo,
ProjectPrePublishEventArgs e)
{
try
{

prjGUID = e.ProjectGuid.ToString();
Guid sessionId = contextInfo.UserGuid;

ProjectWebSvc.Project project = new
ProjectWebSvc.Project();
project.Credentials =
CredentialCache.DefaultCredentials;

ProjectWebSvc.ProjectDataSet prjDataSet =
project.ReadProject(new System.Guid(prjGUID),
ProjectWebSvc.DataStoreEnum.PublishedStore);

prjDataSet = project.ReadProject(new
System.Guid(prjGUID), ProjectWebSvc.DataStoreEnum.WorkingStore);

foreach (ProjectWebSvc.ProjectDataSet.TaskRow t in
prjDataSet.Task)
{
t.TASK_NAME= "Test - " + t.TASK_NAME.ToString();

}
project.QueueUpdateProject(jobId, sessionId,
prjDataSet, false);

base.OnPublishing(contextInfo, e);
}
catch (SoapException ex)
{

//Log the error

}

}
 
M

ma.benamor

i think that your problem is here in your credential
project.Credentials =
CredentialCache.DefaultCredentials;
you need to use a credential of the server
 
W

Webdev2000

Thanks for the response.

Problem here is when you do a publishing, the publishing event handler uses
sharepoint service account instead of the users account. So obviously,
project server would not let you checkout a project checked out by another
user. I tried using impersonation code provided in SDK with no luck.

Once I get to the below line
project.Credentials = CredentialCache.DefaultCredentials;

it ignores the impersonation session and uses sharepoint servic account. I
did not see any code samples or documentation on impersonating in Event
handlers. If anyone have achived it or seen some code samples, please do let
me know.

Thanks.
 

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