Thursday, April 2, 2009

Sharepoint Auto-Create Folders

This is a modified version of Chris Auld's auto root folder creation module.
It allows you in a single click, to create all folder structure to represent the 12 hive so you can add files to the layouts, images, 1033 and all other folders using the wsp package.

Just by pasting files in those folders with visual studio, they will be copied to the corresponding folder on client's 12 hive.

(MS VS 2005/2008) Tools -> Macros -> Macro IDE

(You need to create a new C# SharePoint project and then create a rootitem folder called something like "Rootfiles". Update wsp and delete rootitem and any readmes)

Sub TemporaryMacro()
Dim themeName As String = InputBox("Enter the template name")
Dim rootItem As ProjectItem = DTE.Solution.Projects.Item(1).ProjectItems.Item(2)
Dim templateItem As ProjectItem = rootItem.ProjectItems.AddFolder("TEMPLATE")
templateItem.ProjectItems.AddFolder("LAYOUTS").ProjectItems.AddFolder("1033") _
End Sub

Chris Auld's Blog

No comments:

Post a Comment