Thursday, March 22, 2012

[sharepointdiscussions] Digest Number 4415

Messages In This Digest (5 Messages)

Messages

1a.

Creating sites from custom template via powershell

Posted by: "brother.gabriel" brgabriel@sspx.org   brother.gabriel

Wed Mar 21, 2012 1:15 pm (PDT)



Salvete! I have spent three days of coding and scouring the net, trying to get this to work.

I have to build 200 subsites based on a custom site template.

From my research, I have seen that you can't use powershell to create the subsite initially with a custom site-template, but that you can apply the site-template after it is created.

#Here is my site-creation code:
$webTemplate = Get-SPWebTemplate | where { $_.Title -eq 'STS#1' }
$currentWeb = New-SPWeb `
-Url $SiteUrl `
-Name $SiteTitle `
-AddToTopNav:$true `
-UniquePermissions:$true `
-template $webTemplate `
-language 1033
-Description $SiteDescription

#Now I try to apply the template.
$currentWeb.ApplyWebTemplate('{F29E085-7F4D-444F-9AF0-981C67A3F073}#chapelsite')
$currentweb.update()

It gets hung up here - giving me this error:
There was a problem creating the site https://rch.sspxusa.org/chapels/chapel5 - Exception calling "ApplyWebTemplate" with "1" argument(s): "File or arguments not valid for site template '{F29E085-7F4D
-444F-9AF0-981C67A3F073}#chapelsite'.
Parameter name: WebTemplate"

Please help! I am supposed to have finished this project by this past Monday.

1b.

Re: Creating sites from custom template via powershell

Posted by: "brother.gabriel" brgabriel@sspx.org   brother.gabriel

Wed Mar 21, 2012 2:17 pm (PDT)



Also, if I do this, my script runs fine, but it does not build upon my template.

$currentWeb = New-SPWeb `
-Url $SiteUrl `
-Name $SiteTitle `
-AddToTopNav:$true `
-UniquePermissions:$true `
-template '{19A4FD98-3433-4BF8-87B1-8730D6837E0C}#chapelsitetemplate' `
-language 1033 `
-Description $SiteDescription

1c.

Re: Creating sites from custom template via powershell

Posted by: "brother.gabriel" brgabriel@sspx.org   brother.gabriel

Wed Mar 21, 2012 2:22 pm (PDT)



This runs too, but,like the other methods, does not finish building the site- it leaves me at the template-picker page.

How can I get a handle on that site-template? I created it by using the web-gui, and did a "save as site template" - which went into the solutions gallery as a wsp. It is activated, and I can use it manually through the gui or through spd, but not in powershell.

$webTemplate = Get-SPWebTemplate | where { $_.Title -eq '{19A4FD98-3433-4BF8-87B1-8730D6837E0C}#chapelsitetemplate' }
$currentWeb = New-SPWeb `
-Url $SiteUrl `
-Name $SiteTitle `
-AddToTopNav:$true `
-UniquePermissions:$true `
-template $webtemplate `
-language 1033 `
-Description $SiteDescription

--- In sharepointdiscussions@yahoogroups.com, "brother.gabriel" <brgabriel@...> wrote:
>
> Also, if I do this, my script runs fine, but it does not build upon my template.
>
> $currentWeb = New-SPWeb `
> -Url $SiteUrl `
> -Name $SiteTitle `
> -AddToTopNav:$true `
> -UniquePermissions:$true `
> -template '{19A4FD98-3433-4BF8-87B1-8730D6837E0C}#chapelsitetemplate' `
> -language 1033 `
> -Description $SiteDescription
>

1d.

Re: Creating sites from custom template via powershell

Posted by: "Daniel A. Galant" daniel@netdesignit.com   figment16@att.net

Wed Mar 21, 2012 2:41 pm (PDT)



You can't change the template of a site after it has been created.

Daniel A. Galant | 636-448-3240

MCITP - Enterprise Administrator | MCTS - SharePoint | MCTS - WSS v3 | MCTS
- OCS | MCSE+Messaging | MCSE+Security | MCT

daniel@netdesignit.com

Imagine what we could be... if we could just imagine.

From: sharepointdiscussions@yahoogroups.com
[mailto:sharepointdiscussions@yahoogroups.com] On Behalf Of brother.gabriel
Sent: Wednesday, March 21, 2012 1:16 PM
To: sharepointdiscussions@yahoogroups.com
Subject: [sharepointdiscussions] Creating sites from custom template via
powershell

Salvete! I have spent three days of coding and scouring the net, trying to
get this to work.

I have to build 200 subsites based on a custom site template.

From my research, I have seen that you can't use powershell to create the
subsite initially with a custom site-template, but that you can apply the
site-template after it is created.

#Here is my site-creation code:
$webTemplate = Get-SPWebTemplate | where { $_.Title -eq 'STS#1' }
$currentWeb = New-SPWeb `
-Url $SiteUrl `
-Name $SiteTitle `
-AddToTopNav:$true `
-UniquePermissions:$true `
-template $webTemplate `
-language 1033
-Description $SiteDescription

#Now I try to apply the template.
$currentWeb.ApplyWebTemplate('{F29E085-7F4D-444F-9AF0-981C67A3F073}#chapelsi
te')
$currentweb.update()

It gets hung up here - giving me this error:
There was a problem creating the site
https://rch.sspxusa.org/chapels/chapel5 - Exception calling
"ApplyWebTemplate" with "1" argument(s): "File or arguments not valid for
site template '{F29E085-7F4D
-444F-9AF0-981C67A3F073}#chapelsite'.
Parameter name: WebTemplate"

Please help! I am supposed to have finished this project by this past
Monday.

[Non-text portions of this message have been removed]

1e.

Re: Creating sites from custom template via powershell

Posted by: "brother.gabriel" brgabriel@sspx.org   brother.gabriel

Wed Mar 21, 2012 2:51 pm (PDT)



Okay, but how can I use the custom template to create the site with? I've tried everything and am about to do all 200 sites manually.

--- In sharepointdiscussions@yahoogroups.com, "Daniel A. Galant" <daniel@...> wrote:
>
> You can't change the template of a site after it has been created.
>
>
>
> Daniel A. Galant | 636-448-3240
>
> MCITP - Enterprise Administrator | MCTS - SharePoint | MCTS - WSS v3 | MCTS
> - OCS | MCSE+Messaging | MCSE+Security | MCT
>
>
>
> daniel@...
>
> Imagine what we could be... if we could just imagine.
>
>
>
> From: sharepointdiscussions@yahoogroups.com
> [mailto:sharepointdiscussions@yahoogroups.com] On Behalf Of brother.gabriel
> Sent: Wednesday, March 21, 2012 1:16 PM
> To: sharepointdiscussions@yahoogroups.com
> Subject: [sharepointdiscussions] Creating sites from custom template via
> powershell
>
>
>
>
>
> Salvete! I have spent three days of coding and scouring the net, trying to
> get this to work.
>
> I have to build 200 subsites based on a custom site template.
>
> From my research, I have seen that you can't use powershell to create the
> subsite initially with a custom site-template, but that you can apply the
> site-template after it is created.
>
> #Here is my site-creation code:
> $webTemplate = Get-SPWebTemplate | where { $_.Title -eq 'STS#1' }
> $currentWeb = New-SPWeb `
> -Url $SiteUrl `
> -Name $SiteTitle `
> -AddToTopNav:$true `
> -UniquePermissions:$true `
> -template $webTemplate `
> -language 1033
> -Description $SiteDescription
>
> #Now I try to apply the template.
> $currentWeb.ApplyWebTemplate('{F29E085-7F4D-444F-9AF0-981C67A3F073}#chapelsi
> te')
> $currentweb.update()
>
> It gets hung up here - giving me this error:
> There was a problem creating the site
> https://rch.sspxusa.org/chapels/chapel5 - Exception calling
> "ApplyWebTemplate" with "1" argument(s): "File or arguments not valid for
> site template '{F29E085-7F4D
> -444F-9AF0-981C67A3F073}#chapelsite'.
> Parameter name: WebTemplate"
>
> Please help! I am supposed to have finished this project by this past
> Monday.
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

Recent Activity
Visit Your Group
Yahoo! Groups

Mental Health Zone

Learn about issues

Find support

Ads on Yahoo!

Learn more now.

Reach customers

searching for you.

Yahoo! Groups

Parenting Zone

Family and home

Tips for mom

Need to Reply?

Click one of the "Reply" links to respond to a specific message in the Daily Digest.

Create New Topic | Visit Your Group on the Web

No comments: