您可以使用对象模型或SharePoint Web服务将文档上载到SharePoint库。
使用对象模型上传:
String fileToUpload = @"C:YourFile.txt";String sharePointSite = "http://yoursite.com/sites/Research/";String documentLibraryName = "Shared documents";using (SPSite oSite = new SPSite(sharePointSite)){ using (SPWeb oWeb = oSite.OpenWeb()) { if (!System.IO.File.Exists(fileToUpload)) throw new FileNotFoundException("File not found.", fileToUpload); SPFolder myLibrary = oWeb.Folders[documentLibraryName]; // Prepare to upload Boolean replaceExistingFiles = true; String fileName = System.IO.Path.GetFileName(fileToUpload); FileStream fileStream = File.OpenRead(fileToUpload); // Upload document SPFile spfile = myLibrary.Files.Add(fileName, fileStream, replaceExistingFiles); // Commit myLibrary.Update(); }}


