cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SoporteAcorde
Level: Powered On

How to find custom Site WebTemplate ID in order to automate site creation Flow

Hi!

 

I´m working on a Flow that will allow me to create a new SharePoint subsite on a list´s item creation. So far I have managed to get the Flow to work using the standard team site WebTemplate (STS#0) and the project WebTemplate ids (PROJECTSITE#0).

 

I´m using the "Send HTTP request to SharePoint" action that looks like this:

 

site creation flow 3.png

 

However I want to be able to create such sites using my own custom site template which I have already created and saved as such.

 

Here is the question:

I need to be able to locate the correct WebTemplate ID in order to feed that information to the HTTP action, I have followed several articles including this one: https://jamesdiblasi.wordpress.com/2013/08/17/sharepoint-2013-finding-your-custom-site-template-id/ in order to do so.

 

By following that I was able to retrieve what I though was my site´s custom Webtemplate ID which reads: 

 

"{662D1818-F781-416B-8474-DE74B9917DE1}#Acorde_projectTmpA"

 

However, when I change my Web Template from PROJECTSITE#0 to 662D1818-F781-416B-8474-DE74B9917DE1}#Acorde_projectTmpA the flow runs into an error. The output of the error shows the following:

 

{
"message": "Invalid file or arguments for the site template '662D1818-F781-416B-8474-DE74B9917DE1#Acorde_projectTmpA'.\r\nParameter name: WebTemplate\r\nclientRequestId: bd8074ce-8f8a-48e9-b729-37ca40aef70c\r\nserviceRequestId: a5a81f9f-3084-0000-497c-336584773c12",
"status": 400,
"errors": [
"-2147024809",
"System.ArgumentException"
]
}
 
Which, if I´m not mistaken, means that I´m entering a wrong value for my custom site WebTemplate. I have also tried to get this ID using PowerShell but it appears that the sites I have created using this template are not showing any WebTemplate ID:
 
site creation flow 4.png
Please guide me on where to find the custom web template ID in order to use it in my flow.
 
Thanks in advance.
1 ACCEPTED SOLUTION

Accepted Solutions
SoporteAcorde
Level: Powered On

Re: How to find custom Site WebTemplate ID in order to automate site creation Flow

Thanks @Gristy  but I´ve just figured it out.

 

Here are the steps as a future reference:

 

  • First your need to run the following powershell in order to get your Template ID. Bear in mind that the list is affected by the language used when the template was saved, so change the language ID in case you use other languages besides English:

$Username = Read-Host -Prompt "Please enter your username"

$Password = Read-Host -Prompt "Please enter your password" -AsSecureString

$Site = "Site URL"

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)

$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)

$Context.Credentials = $Creds

#List Custom Templates

$Templates = $Context.Site.GetWebTemplates("1033","0")

$Context.Load($Templates)

$Context.ExecuteQuery()

$Templates | Where {$_.Name -like "*{*" } | Select Name, Description

 

Alternatively, you can used the method explained earlier, where you inspect the template from Site Contents in order to get the Template ID.

 

  • Second, update the Flow in order to match the language ID of your Template, in this case:

{ 'parameters':
{ '__metadata':
{ 'type': 'SP.WebInfoCreationInformation' },
'Url':'@{triggerBody()?['Title']}',
'Title':' @{triggerBody()?['Title']} ',
'Description':'@{triggerBody()?['Title']}',
'Language':'1033',
'WebTemplate':'{662D1818-F781-416B-8474-DE74B9917DE1}#TEMPLATE_projectA',
'UseUniquePermissions':false
}
}

 

In my case, I was using language ID 3082 (Spanish) whereas my Template language was 1033.

 

More information about this usefull Site Creation automation Flow can be found at

https://veenstra.me.uk/2018/05/02/microsoft-flow-create-a-new-sub-site-using-microsoft-flow/

 

Hope it helps somebody else.

Regards,

Alexander.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: How to find custom Site WebTemplate ID in order to automate site creation Flow

have you tried: {662D1818-F781-416B-8474-DE74B9917DE1}

SoporteAcorde
Level: Powered On

Re: How to find custom Site WebTemplate ID in order to automate site creation Flow

Hi,

 

I answered to this post a few days ago but today I´m noticing that my response is not there so here it is again.

 

I did try with {662D1818-F781-416B-8474-DE74B9917DE1} but the errors is the same. Today I talked to a Microsoft representative that told me that custom site template IDs are not supported which sounds weird to me since not been able to automate site creation with your own customized sites would be a big missed opportunity if you ask me.

 

Any suggestions are more than welcome.

 

Thanks

Super User
Super User

Re: How to find custom Site WebTemplate ID in order to automate site creation Flow

it is supported, i do not do it this way.

 

i use plumsail actions, look them up they are very cheap and take all this complexity away

SoporteAcorde
Level: Powered On

Re: How to find custom Site WebTemplate ID in order to automate site creation Flow

Thanks @Gristy  but I´ve just figured it out.

 

Here are the steps as a future reference:

 

  • First your need to run the following powershell in order to get your Template ID. Bear in mind that the list is affected by the language used when the template was saved, so change the language ID in case you use other languages besides English:

$Username = Read-Host -Prompt "Please enter your username"

$Password = Read-Host -Prompt "Please enter your password" -AsSecureString

$Site = "Site URL"

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)

$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)

$Context.Credentials = $Creds

#List Custom Templates

$Templates = $Context.Site.GetWebTemplates("1033","0")

$Context.Load($Templates)

$Context.ExecuteQuery()

$Templates | Where {$_.Name -like "*{*" } | Select Name, Description

 

Alternatively, you can used the method explained earlier, where you inspect the template from Site Contents in order to get the Template ID.

 

  • Second, update the Flow in order to match the language ID of your Template, in this case:

{ 'parameters':
{ '__metadata':
{ 'type': 'SP.WebInfoCreationInformation' },
'Url':'@{triggerBody()?['Title']}',
'Title':' @{triggerBody()?['Title']} ',
'Description':'@{triggerBody()?['Title']}',
'Language':'1033',
'WebTemplate':'{662D1818-F781-416B-8474-DE74B9917DE1}#TEMPLATE_projectA',
'UseUniquePermissions':false
}
}

 

In my case, I was using language ID 3082 (Spanish) whereas my Template language was 1033.

 

More information about this usefull Site Creation automation Flow can be found at

https://veenstra.me.uk/2018/05/02/microsoft-flow-create-a-new-sub-site-using-microsoft-flow/

 

Hope it helps somebody else.

Regards,

Alexander.

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,636)