开发者

SharePoint 2010 - Performance (New-SPWeb $Url).ApplyWebTemplate("{GUID}#MyCustomTemplate")

开发者 https://www.devze.com 2023-02-11 16:53 出处:网络
I want to create new SPWebs with a Custom Template. $web = New-SPWeb $Url $web.ApplyWebTemplate(\"{GUID}#MyCustomTemplate\")

I want to create new SPWebs with a Custom Template.

$web = New-SPWeb $Url
$web.ApplyWebTemplate("{GUID}#MyCustomTemplate")

My problem is now that the creation from one SPWeb with the Custom Templat开发者_JS百科e takes about 40 s on my VM. Is there a other and faster way to create SPWebs with a Custom Template?


Why not use -template parameter. For example,

New-SPWeb -url $url -template "{GUID}#MyCustomTemplate"

I did not have a custom template to use but this took 2 seconds on my system.


@LaPhi, you'll get an exception when your custom WebTemplate is not yet activated on your Site (Collection).

I, too, cannot get "New-SPWeb $Url -template "TemplateName" to provision with the Template. You'll likely need to wait until the site is provisioned.


My Solution: First create the new Web:

$web = New-SPWeb $UrlFull

After this, apply the Web template

$web.ApplyWebTemplate("{GUID}#NameCustomTemplate")

The reason is, that the Custom Template is not global.


You have to use this syntax

New-SPWeb -url $url -template "MyCustomTemplateName#0"

You can find these values in Configuration tag of your webtemp_*.xml

<Configuration ID="0" Title="MyCustomTemplateName" ...
0

精彩评论

暂无评论...
验证码 换一张
取 消