none
Error on creating multiple projects through PSI on project server 2010 RRS feed

  • Question

  • Hi friends

    I am creating projects through PSi coding in project server.Everything works fine if m creating one project at a time., but if I Create simultaneous projects (for example 2 projects), It throws the following error

    LastError=ProjectMultipleProjectsInvalid Instructions:
     Pass this into PSClientError constructor to access all error informationERROR::31-10-2012 12:00:04 ProjectName-DM1002


    can anyone help me on this.

    Thank u

    Wednesday, October 31, 2012 6:44 AM

All replies

  • hi Harry,

    In your code are you using same as below.If so how you are looping below method for second project creation or for multiple project creation:

    private void btnCreateProject_Click(object sender, EventArgs e)
    {
           try
        {
            WebSvcProject.ProjectDataSet dsProject = 
                new WebSvcProject.ProjectDataSet();
            WebSvcProject.ProjectDataSet.ProjectRow projectRow = 
                dsProject.Project.NewProjectRow();
    
            Guid projectGuid = Guid.NewGuid();
            projectRow.PROJ_UID = projectGuid;
            projectRow.PROJ_NAME = this.txtProjectName.Text;
            projectRow.PROJ_TYPE = 
                Convert.ToInt32(PSLibrary.Project.ProjectType.Project);
    
            dsProject.Project.AddProjectRow(projectRow);
    
            Guid jobGuid = Guid.NewGuid();
            bool validateOnly = false;
            project.QueueCreateProject(jobGuid, dsProject, validateOnly);
    
            // Wait 3 seconds (more or less) for Queue job to complete.
            // Or, add a routine that checks the QueueSystem for job completion.
            System.Threading.Thread.Sleep(3000);
    
            WebSvcProject.ProjectRelationsDataSet dsProjectRelations =
                new WebSvcProject.ProjectRelationsDataSet();
    
            jobGuid = Guid.NewGuid();
            // Set wssUrl = "" for the default WSS project workspace
            string wssUrl = "";
            bool fullPublish = true;
            dsProjectRelations = project.QueuePublish(jobGuid, 
                projectGuid, fullPublish, wssUrl);
        }
        // Add catch statements
    }
    

    Thanks & Regards, Krishna


    • Edited by krishna_2012 Wednesday, October 31, 2012 6:54 AM
    Wednesday, October 31, 2012 6:53 AM
  • Yes we are already using Wait for Queue jobs to complete., but I tried thread to sleep over 10 min but No use

    Thanks

    Wednesday, October 31, 2012 8:25 AM
  • hi hary,

    Try the below way its working fine in my Proejct server 2010 environmet.

         ArrayList Projects = new ArrayList();
                Projects.Add("testRPoject1");
                Projects.Add("testRPoject2");
               
               
                ProjectWebSvc.Project projectSvc;
              
                 ProjectWebSvc.ProjectDataSet.ProjectRow projectRow;
                Guid _projectGUID;      
                try
                {
                    foreach (string s in Projects)
                    {
                        projectSvc = new ProjectWebSvc.Project();
                        ProjectWebSvc.ProjectDataSet dsProjectDataSet = new ProjectWebSvc.ProjectDataSet();
                        projectSvc.Credentials = new System.Net.NetworkCredential("Username", "Passw0rd", "Domain");
                        _projectGUID= Guid.NewGuid();
                        projectRow = dsProjectDataSet.Project.NewProjectRow();
                        projectRow.PROJ_UID = _projectGUID;
                        projectRow.PROJ_NAME = s;
                        projectRow.PROJ_INFO_START_DATE = System.DateTime.Now;
                        projectRow.PROJ_TYPE = 0;
                        dsProjectDataSet.Project.AddProjectRow(projectRow);
                        projectSvc.QueueCreateProject(Guid.NewGuid(), dsProjectDataSet, false);
                        projectSvc.QueuePublish(Guid.NewGuid(), _projectGUID, true, string.Empty);
                        projectSvc.QueueCheckInProject(Guid.NewGuid(), _projectGUID, true, Guid.Empty, "Checking by system");
                        System.Threading.Thread.Sleep(3000);
                        Console.Write("Success");
                    }

                }
                catch (Exception ex)
                {


                }

            }


    Thanks & Regards, Krishna

    • Proposed as answer by krishna_2012 Thursday, November 1, 2012 11:11 AM
    Thursday, November 1, 2012 11:11 AM