Connect.Collaborate.SharePoint

Creating SharePoint document library folders from CSV file

I had to create hundreds of folders in an Enterprise Document Library template based site based on a CSV extract from a CRM system.

I did not have server access to had to think of a remote solution. Creating local folders and then using the drag and drop method into the library explorer view did cross my mind but I knew there must be a better way.

A simple WSH script (old habits die hard) calling the document workspace web service (create folder method) was all that was required.

Just run this on a Windows XP machine which includes MSSOAP.SOAPClient (don't think this comes with W2K3 or Vista).

set SOAPClient = createobject("MSSOAP.SOAPClient")
SOAPClient.mssoapinit http://nz/customers/_vti_bin/dws.asmx?WSDL
On Error Resume Next
Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\accounts2.csv", ForReading)

Wscript.Echo vbCrLf & "creating Folders"

Do While objTextFile.AtEndOfStream <> True
strLine = objtextFile.ReadLine
If inStr(strLine, ",") Then
arrCustomer = split(strLine, ",")
Wscript.Echo vbCrLf & "Customer :" & arrCustomer(1)
Set result = SOAPClient.CreateFolder("Documents/" & arrCustomer(1))
i = i + 1
End If
Loop

Posted by Ian Morrish on Tuesday, 10 Jul 2007 10:28 | 2 Comments
SharePoint

Links to this post

Trackback from Blog on 12 Apr 2008 08:58

Name

Url

Email

Comments

CAPTCHA Image Validation