Uploading documents to a document library programmatically is pretty simple the code for it can be found below:
String filename = System.IO.Path.GetFileName(filepath);
SPFolder myLib = impersonatedWeb.Folders[documentLibraryName];
FileStream stream = File.Open(path, FileMode.Open);
SPFile file = myLib.Files.Add(filename, stream, true);
myLib.Update();
There you have it, its as that.
No comments:
Post a Comment