CopyTo(String) method

CopyTo(String) method

Post by michae » Thu, 29 May 2003 01:26:13

I'm trying to copy some files from a top level sites
document library to a subsites dl and I'm running into
problems.  Here is my code:

Dim mySite As SPSite = SPControl.GetContextSite(Context)
Dim myWeb As SPWeb = mySite.AllWebs(Top Level Site Name)

Dim strSourceName As String
= "http://ServerName/sites/SiteName/Document

Dim strDestDocLib As String = mySite.Url.ToString
+ "/SubSiteName/Document Library/"

Dim files As SPFileCollection = myWeb.GetFolder

Dim i As Integer
For i = 0 To files.Count
files(i).CopyTo(strDestDocLib + files(i).Name)

I'm not sure I have the whole SPSite/SPWeb hierarchy
straight in my head or if I'm doing something else wrong.

Anyone have any ideas?