none
Bulk create Project Site using template RRS feed

  • Question

  • Hi,

    We have around 1000 projects in our PS2013 environment, and project site is not associated any of them. We have created a new template for project site.

    To now create and associate this template with each project (without having to manually publish), we have to use option of managing connected site, but here we can create only one site at a time.

    Is there a way for bulk create for multiple projects in one shot? 

    Thanks in advance

    Atul Sharma


    Wednesday, February 19, 2014 11:03 AM

All replies

  • Hello,

    No bulk way to create sites for each project using the UI, if no sites exist for projects to could create a PowerShell script to create the sites using the CreateWSSSite method:

    http://msdn.microsoft.com/en-us/library/gg212174(v=office.15).aspx

    You would need to get all of the project GUIDs first then call the CreateWSSSite method and pass in the projectUID along with the other parameters.

    Alternatively you could try the script below:

    http://gallery.technet.microsoft.com/scriptcenter/Server-2010-Publish-all-45ba385b

    Pass String.Empty to the last parameter on the QueuePublish method. This should create a site for the projects on publish. This will take the default site template. Hopefully by default this is the site template associated with the default EPT and not the default Project Site template. Test this on a test farm before production. For details on the QueuePublish method see: http://msdn.microsoft.com/en-us/library/gg177147(v=office.15).aspx

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS



    Wednesday, February 19, 2014 11:50 AM
    Moderator
  • Thank you Paul.

    We have used the CreateWSSSite method, and it works perfectly in PS 2010. However, in PS 2013 we use similar method, we are unable to find the custom template. The site gets created using the default template itself. Do we need to register the custom template somewhere?

    Thanks

    Atul

    Wednesday, February 19, 2014 12:24 PM
  • Hi Atul,

    The template will need to a valid Project Server 2013 site template and it will need to be active in the PWA site collection. Do sites create ok when you create sites for a project manually from Connected SharePoint sites page or when you create a new project (choose the EPT that has the new site template)?

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS

    Wednesday, February 19, 2014 12:32 PM
    Moderator
  • Hi Paul,

    Sites create perfectly well(using custom template) when done manually. On creating new as well, project site gets created.

    In PS 2010, in addition to associating template with EPT, there was another setting where we had set default template. However in 2013, we are unable to find the 2nd option.

    Thanks

    Atul

    Wednesday, February 19, 2014 1:24 PM
  • Hello,

    The default project site template (Default Project Site template:) option in Project Site Provisioning Settings in 2010 didn't actually do anything, this was just carried over from 2007. The default project site template is the same as the site template that is set on the default EPT in 2010 and 2013.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS

    Wednesday, February 19, 2014 1:40 PM
    Moderator
  • Hi,

    I suspected the same. Here what is happening then:

    While to trying to get the Template ID from table Web_Admin, using PSI, then it returns only the default template ID. We were expecting it to return the custom template ID as well, which we could use.

    Thanks

    Atul

    Wednesday, February 19, 2014 2:08 PM
  • You can try this powershell script

    #Configure with your PWA URL
    $pwaURL = "http://project.server.local/PWA"

    $EMPTYGUID = [system.guid]::empty
    $svcPSProxy = New-WebServiceProxy -uri "$pwaURL/_vti_bin/PSI/Project.asmx?wsdl" -useDefaultCredential

    $ProjectList = $svcPSProxy.ReadProjectStatus("$EMPTYGUID","WorkingStore","", "0").Project | format-table proj_uid -hidetableheaders | out-string -stream
    foreach ($projectUid in $ProjectList)
    {
        if ($projectUid -ne "")
        {
     $G = [System.Guid]::NewGuid()


     $svcPSProxy.QueuePublish("$G", $projectUid, "true","")
        }
    }


    Thanks Gaurav Wason MCITP, PMP

    Thursday, February 20, 2014 4:42 AM
  • Hello,

    Using the CreateWSSSite method, just pass through an empty string to the template parameter and the site template associated to that EPT should be used for site creation.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS

    Monday, March 3, 2014 9:07 AM
    Moderator
  • Hi Atul

    It might be a little late for this answer but given that template names are fixed most of the time and don't change often, i use powershell to obtain the template ID and simply pass it on in the code to be used at the time of creation

    //////// Powershell to get Template Name/////
    $url = “https://servername/pwa”
    $site= new-Object Microsoft.SharePoint.SPSite($url )
    $loc= [System.Int32]::Parse(1033)
    $templates= $site.GetWebTemplates($loc)
    foreach ($child in $templates){ write-host $child.Name “  ” $child.Title}
    ////////
    ID should look something like this -- {7E3D804F-0EB0-46E1-8D12-1FC4C441DF99}#Custom Project Site Template V15
    

    Once i get the desired ID's i use them in code to create the site

       SvcWssInterop.WssInteropClient WsClient = SetWSSInteropClientEndPoints();
                    SvcWssInterop.ProjectWSSInfoDataSet WssProjInfoDS = new SvcWssInterop.ProjectWSSInfoDataSet(); WssProjInfoDS = WsClient.ReadWssData(PrjUID);
                    SvcWssInterop.WssSettingsDataSet WssSettingDS = new SvcWssInterop.WssSettingsDataSet(); WssSettingDS = WsClient.ReadWssSettings();
                    SvcWssInterop.WssSettingsDataSet.WssAdminRow adminRow = WssSettingDS.WssAdmin[0];
    
                    string siteCollection = adminRow.WADMIN_DEFAULT_SITE_COLLECTION;
                    string templateName = "{7E3D804F-0EB0-46E1-8D12-1FC4C441DF99}#Custom Project Site Template V15";//adminRow.WADMIN_STS_TEMPLATE_ID; 
                    Guid wssWebAppUid = adminRow.WADMIN_CURRENT_STS_SERVER_UID;
                    int templateLCID = adminRow.WADMIN_STS_TEMPLATE_LCID;
                    System.Threading.Thread.Sleep(5000);
                    WsClient.CreateWssSite(PrjUID, adminRow.WADMIN_CURRENT_STS_SERVER_UID, string.Empty, adminRow.WADMIN_STS_TEMPLATE_LCID, templateName);
                    PrjClient.QueuePublish(Guid.NewGuid(), PrjUID, true, "");




    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Monday, March 10, 2014 1:59 PM
    Moderator