Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Setting the Project Owner when initially creating a Project with CSOM

$
0
0

Can someone explain how to set a project owner when when I initially create a project using the CSOM way?

I have tried the code below and it creates the project, but it does not set the project owner that was found via the query below.

When I checked the queue, it says that the project is not checked out as if it is trying to do an update after the fact.

I need the project owner to be set initially so that all tasks under the project template in the EPT get the status manager set as the project owner. If I change it after the fact, the status manager does not change for the tasks. I have to believe that we can set this project owner (and other things like custom fields) upon initial creation.

Please help.

User owner = null; var resourcesQuery = projContext.LoadQuery(projContext.EnterpriseResources.Where(p => p.Name == "Some User")); projContext.ExecuteQuery(); var resources = resourcesQuery.SingleOrDefault(); if (resources != null && resources.User != null) { owner = resources.User; } ProjectCreationInformation newProj = new ProjectCreationInformation(); newProj.Id = Guid.NewGuid(); newProj.Name = ProjName; newProj.Description = projectDescription; newProj.Start = projectStart.Date; PublishedProject newPublishedProj = projContext.Projects.Add(newProj); newPublishedProj.Owner = owner; // trying to set owner before "Update" and "ExecuteQuery"

// I have also tried setting newProblishedProj.Draft.Owner with NO success. QueueJob qJob = projContext.Projects.Update(); projContext.ExecuteQuery();



              


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>