Setting many predecessors for one task programmatically via CSOM (.Net) in Project Server 2013? RRS feed

  • Question

  • there is no problem in setting many successors for one task but when i'm trying the other way around ( as in the title ) only the last set link exists like if it was overriding the other ones. It's strange because using the user web interface one can create such setting with just couple of clicks.

    This is my code:

    public bool CreateTaskLink(string _rootProjGUID, string _prevTaskGUID, string _nextTaskGUID)
         bool status = false;
            Guid guidParsed = Guid.Parse(_rootProjGUID);
            var projList = projContext.LoadQuery(
                     proj => proj.Id == guidParsed));
            if (projList.Count() > 0)
                QueueJob qJob;
                JobState jobState;
                PublishedProject proj = projList.First();
                DraftProject draftProject = proj.CheckOut();
                TaskLinkCreationInformation TLCI = new TaskLinkCreationInformation();
                TLCI.Id = Guid.NewGuid();
                TLCI.DependencyType = DependencyType.FinishStart;
                TLCI.StartId    = Guid.Parse(_prevTaskGUID);
                TLCI.EndId      = Guid.Parse(_nextTaskGUID);
                qJob = draftProject.Update();
                projContext.WaitForQueue(qJob, timeoutSeconds);
                qJob = draftProject.Publish(true);
                jobState = projContext.WaitForQueue(qJob, timeoutSeconds);
                status = (jobState == JobState.Success) ? true : false;  
            return status;       

    Thanks for any help.

    Thursday, July 17, 2014 4:15 PM

All replies