I want to change ProjectOwnerUID Using PSI(Project Server Interface).I wrote that with follow similar code
var projectDataSet = this.GetProjectDataSet(projectInfo.ProjectUID);
var orginalProject = this.GetProject(projectInfo.ProjectUID, projectDataSet);
var sessionUID = this.CheckOutProject(projectInfo.ProjectUID);
if (!string.IsNullOrEmpty(projectInfo.ProjectOwnerName))
{
var resourceManager = new Resource();
var ownerResource = resourceManager.GetResource(projectInfo.ProjectOwnerName);
if (ownerResource == null)
{
throw new Exception("this is not valid");
}
orginalProject.ProjectOwnerID = ownerResource.ResourceUID;
}
this.UpdateProject(sessionUID, projectDataSet);
unfortunatly when cursor arrive to UpdateProject line it throws exception with code number
ProjectServerError(s) LastError=ProjectInvalidOwner Instructions: Pass this into PSClientError constructor to access all error information
Inner Error 1056(Invalid project owner).
I don't know what happen that Issued this exception
how can I solve this problem?
This problem occurs when you do not have permissions to edit project information using the following code snippet u can tell to project server to run this piece of code do not check permissions!!
MSDN Reference