我是Sharepoint Server的新手,我们是否有任何实用程序可以从ASP.NET应用程序上传文件.
你能提供宝贵的答案吗?
您可以编写一些自定义代码来执行此操作.如果您位于同一服务器上或使用WebServices,则可以使用SharePoint API
下面是示例代码,假设您知道文档库的URL并且您正在将文档上载到根文件夹.您必须添加Microsoft.SharePoint.dll作为ASP.NET项目的参考
using (SPSite siteCollection = new SPSite(url)) { using (SPWeb spWeb = siteCollection.OpenWeb()) { SPList spList = spWeb.GetList(url); string fileName = "XXXX"; FileStream fileStream = null; Byte[] fileContent = null; try { string docPath = XXXX; //physical location of the file fileStream = File.OpenRead(docPath + fileName); fileContent = new byte[Convert.ToInt32(fileStream.Length)]; fileStream.Read(fileContent, 0, Convert.ToInt32(fileStream.Length)); spList.RootFolder.Files.Add(spList.RootFolder.Url + "/" + fileName, fileContent, true); spList.Update(); } catch(Exception ex) { } finally { if (fileStream != null) { fileStream.Close(); } } } }