我正在尝试使用我的 MSDN 提供的代码通过 PSI 在现有项目中创建任务:http: //msdn.microsoft.com/en-us/library/office/ms487478 (v=office.12).aspx#pj12_PDSPSIExamples_Task
问题是我在尝试调用 projectClient.QueueUpdateProject(jobId, sessionId, project, false); 时收到错误“GeneralOnlyUpdatesAllowed”;
有什么想法吗?
Guid sessionId = Guid.NewGuid();
Guid jobId = Guid.NewGuid();
string SESSION_DESC = "MSP-DAX Synchronization";
backendProject.ProjectDataSet project = projectClient.ReadProject(task.ProjectId, backendProject.DataStoreEnum.WorkingStore);
projectClient.CheckOutProject(task.ProjectId, sessionId, SESSION_DESC);
backendProject.ProjectDataSet.TaskRow taskRow = project.Task.NewTaskRow();
taskRow.PROJ_UID = task.ProjectId;
taskRow.TASK_UID = Guid.NewGuid();
taskRow.TASK_NAME = task.Subject;
taskRow.CREATED_DATE = task.Date;
taskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Hour;
project.Task.AddTaskRow(taskRow);
projectClient.QueueUpdateProject(jobId, sessionId, project, false);//here is the error
//projectClient.QueueAddToProject(jobId, sessionId, project, false);
WaitForQueue(queueSystemClient, jobId);
jobId = Guid.NewGuid();
projectClient.QueueCheckInProject(jobId, task.ProjectId, false, sessionId, SESSION_DESC);
WaitForQueue(queueSystemClient, jobId);