System.IO.FileInfo file = //create or define file info object
System.IO.FileStream stream = file.Open(System.IO.FileMode.Open);
System.IO.BinaryReader myReader = new BinaryReader (stream);
SPFolder myFolder = //define SPFolder
myFolder.Files.Add(file.Name, myReader.ReadBytes((int)(stream.Length)),
myWeb.CurrentUser, myWeb.CurrentUser, file.CreationTime,
file.LastWriteTime);
--
James Edelen
Microsoft MVP - SharePoint Portal Server
Microsoft MVP - Windows XP Media Center
Microsoft Associate Expert
Expert Zone - http://www.microsoft.com/windowsxp/expertzone
"Pai" <sp...@immunetolerance.org> wrote in message
news:5332f465.0308...@posting.google.com...
SPFile libraryFile = destinationFolder.Files.Add(destinationFolder.Url
+ "/" + Path.GetFileName(strFilePath), fileData,
currentWebArea.CurrentUser, currentWebArea.CurrentUser, dateCreated,
dateModified);
If I use this code it works fine:
SPFile libraryFile = destinationFolder.Files.Add(destinationFolder.Url
+ "/" + Path.GetFileName(strFilePath), fileData, true);
Anyone know why? It works fine if we copy the files to the root
document library or a WSS site, but not a document library not in the
root.
Any help would be appreciated.
Mike
"James Edelen [MVP]" <j...@mvps.org> wrote in message news:<uDsaaMEa...@TK2MSFTNGP10.phx.gbl>...
For example: if you root was http://localhost and your document library was
under http://localhost/marketing, you would do something like this
SPSite site = new SPSite(http://localhost);
SPWeb web = site.AllWebs["Marketing"]; //where Marketing is the name of the
site
then run my original code.
--
James Edelen
Microsoft MVP - SharePoint Portal Server
Microsoft MVP - Windows XP Media Center
Microsoft Associate Expert
Expert Zone - http://www.microsoft.com/windowsxp/expertzone
"Michael Linster" <mi...@mikelinster.com> wrote in message
news:8b0b1f2.03090...@posting.google.com...