none
Create multiple projects at the same time? RRS feed

  • Question

  • Hi everybody,

    I'm writting a console application to get data from SQL and insert it into different projects through PSI.

    At time I read data, I'm going inserting it in a project data set. First I add the projects rows and after the tasks rows. All seems to be ok, but at the end when I call the QueueCreateProject method I get the error: ProjectMultipleProjectInvalid.

    Is there no way to create multiple projects at the same time or do I have to create them one by one?

    Thanks.

    LyE

    Tuesday, May 15, 2012 3:43 PM

All replies

  • Projects need to be created first so you can user their GUIDs to add the correct tasks. A loop to do one project and its tasks at a time should be simple enough.

    Rod Gill

    The one and only Project VBA Book

    Rod Gill Project Management

    Wednesday, May 16, 2012 3:27 AM
    Moderator
  • Hi Rod,

    Thanks for answer, I' doing a loop to add the project and its tasks to a project data set.

    The question is, have I got to do the QueueCreateProject and QueuePublish methods in the loop? Is there no way to create and publish all together?

    Regards.

    LyE

    Wednesday, May 16, 2012 8:37 AM
  • Hi LyE--

    Just to make it clear, that once you call QueueCreateProject and QueuePublish methods, this requires a job guid for the same. Each project save/publish/create fires asynchronous job on server with a specfic job uid. You can have both the methods inside the loop & whenever your code execute, It will create a new JobGuid & create a project.

    Using the PSI in Powershell script, you can publish all projects at once. Just a sample - please see that all operation inside a loop.

    $url = "http://project.contoso.com/pwa_new";
    # Get the list of projects.
    $projectList = psi-ReadProjectList $url | format-table proj_uid -hidetableheaders | out-string -stream;
    # Loop through all the projects publish.
    foreach ($projectUid in $projectList) 
    {
    	if ($projectUid -ne "")
    	{ 
    		"Publishing project guid = " + $projectUid
    		$sessionUid = [System.Guid]::NewGuid();
    		psi-CheckOutProject $url $projectUid $sessionUid "PS Check out"
    		$jobUid = [System.Guid]::NewGuid()
    		psi-QueuePublish $url $jobUid $projectUid $true 
    		$jobUid = [System.Guid]::NewGuid()
    		psi-QueueCheckInProject $url $jobUid $projectUid $true 
    $sessionUid "PS Check In"
    	}
    }
    I hope that helps you bit more.

    If you found this post helpful, Please "Vote as Helpful";. If it answered your question, Please "Mark as Answer".
    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82


    Wednesday, May 16, 2012 11:48 AM