Quantcast
Channel: Project Server General Questions and Answers forum
Viewing all articles
Browse latest Browse all 7942

ProjectResource Not Found Error in Project Server

$
0
0

Hi,

I've been trying to remove a resource from project given the project resource has no assignments using the following code

            projContext.Load(projContext.Projects);

            projContext.ExecuteQuery();

            PublishedProject pp = projContext.Projects.GetByGuid(new Guid("0dbf7918-5609-e311-b791-1078d24a5e38"));

            projContext.Load(pp);

            projContext.ExecuteQuery();     

            DraftProject dp = pp.CheckOut();    

            DraftProjectResource dpr = dp.ProjectResources.GetByGuid(new Guid("e59a4729-0b03-e311-b791-1078d24a5e38"));

            projContext.Load(dpr);

            projContext.ExecuteQuery();

            DraftProjectResourceCollection resoColl = dp.ProjectResources;    

            Console.WriteLine(dpr.Id +""+dpr.Name);         

            resoColl.Remove(dpr);

            try

            {

                QueueJob qJob = dp.Update();

                qJob = dp.Publish(false);

                JobState jobState = projContext.WaitForQueue(qJob, 30);

                if (jobState == JobState.Success)

                {

                    Console.WriteLine("\nResource replacement Successful!");

                }

                else

                {

                    Console.WriteLine("\nThere is a problem in the queue. Timeout is {0} seconds.", 30);  

                }

            }

when i execute this code, I get an error which says

PJClientCallableException: ProjectResourceNotFound

ProjectResourceNotFound

column = RES_UID

Am i missing something?


Thanks & Regards,

Varun


Viewing all articles
Browse latest Browse all 7942

Trending Articles



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