Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Creating a subsite programmatically

  Asked By: Mackenzie    Date: Jun 24    Category: Sharepoint    Views: 3657

I am trying to create a subsite programmatically on a document
library event. The site i have the document library on is:
http://server/sites/TestSite.

I want to create a subsite at: http://server/sites/TestSite/subSite.

Here's my code (vb.NET), it's not working. Am I doing something wrong
code-wise, or do I need to pass credentials? I am a domain admin
where I am running this, so I think I should be alright. Thanks, Chris


Dim siteURL As String = "TestSite/subSite"

Dim siteTitle As String = "subSite"

Dim siteDesc As String = "this is a test"

Dim nLCID As System.UInt32

nLCID = Convert.ToUInt32(1033)

Dim site As New SPSite("http://server/sites/TestSite")

Dim webcoll As SPWebCollection = site.AllWebs

Dim newweb As SPWeb = webcoll.Add(siteURL, siteTitle, siteDesc,
nLCID, SPWebTemplate.WebTemplateSTS, False, False)

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Creating a subsite programmatically Or get search suggestion and latest updates.