使用PSI为项目构建团队

本文关键字:构建 团队 项目 PSI 使用 | 更新日期: 2023-09-27 18:11:32

我是PSI编码新手....我已经创建了一个项目,我需要为该项目建立一个团队....资源必须存在于项目服务器....中我研究了一下,但我找不到我想要的怎么做??

 WbSvcProject.ProjectDataSet pds = new WbSvcProject.ProjectDataSet();
            Guid PUID = Guid.Parse("8d73de15-8f85-4c5e-8da9-de0b85f48eed");
            pds = proj.ReadProject(PUID, WbSvcProject.DataStoreEnum.WorkingStore);

我需要为这个项目建立一个团队…资源必须存在于项目服务器

Thanks in advance

使用PSI为项目构建团队

旧版VS2010?解决方案。VS2012似乎使用了一种通过WbSvcProject.ProjectSoapClient()调用服务的新方法?

using Library = Microsoft.Office.Project.Server.Library;
class ProjectProxy
{
    private WbSvcProject.Project projectSvc;
    public ProjectProxy()
    {
        this.projectSvc = new WbSvcProject.Project();
        this.projectSvc.Url = Program.PWAServer + "/_vti_bin/psi/project.asmx";
        this.projectSvc.UseDefaultCredentials = true;
    }
    //ProjectTeamDataSet ds = new ProjectTeamDataSet();
    //ProjectTeamDataSet.ProjectTeamRow row = ds.ProjectTeam.NewProjectTeamRow();
    //row.PROJ_UID = projectGuid;
    //row.RES_UID = resourceGuid;
    //row.NEW_RES_UID = resourceGuid;
    //ds.ProjectTeam.AddProjectTeamRow(row);
    public void QueueUpdateProjectTeam(Guid sessionUid, Guid projectUid, ProjectTeamDataSet dataset)
    {
        Guid jobUid = Guid.NewGuid();
        try
        {
            this.projectSvc.QueueUpdateProjectTeam(jobUid, sessionUid, projectUid, dataset);
        }
        catch (SoapException soapException)
        {
            List<string> queueErrors = new List<string>();
            queueErrors.Add(soapException.Message);
            Library.PSClientError clientError = new Library.PSClientError(soapException);
            Library.PSErrorInfo[] errors = clientError.GetAllErrors();
            foreach (Library.PSErrorInfo error in errors)
            {
                queueErrors.Add(error.ErrId.ToString());
            }
        }
    }
}