本文介绍了我们如何实用地将文件从一台服务器添加到同一域中的另一台服务器文档库中?请帮忙 .的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 使用-Sharepoint.client.dll查找文件一对一服务器文档库SPFolder oldFolder = web.GetFolder(library.RootFolder.Url +"/" + item.Name +"/" +现有项目.Name +"/Shared"); SPFileCollection folderColBilling; folderColBilling = oldFolder.Files; foreach(SPC文件位于folderColBilling中) {//1.这是现有文件的网址(来自一台服务器)//2. 和 用于第二个服务器,在其中添加给定文件. using(ClientContext context = new ClientContext("http://clientinterface:27213")){ context.Credentials = new NetworkCredential("TCPL"), " Knsp @ rtner $ @!@#" ;," KNSPARTNERS"); //Microsoft.SharePoint.Client.List var oList = context.Web.Lists.GetByTitle(" Shared 文件"); // var fileInfo =新的FileCreationInformation { Url = System.IO.Path.GetFileName(file.Name.ToString()), Content = file.OpenBinary(), //System.IO.File.ReadAllBytes(file.Url), Overwrite = true }; var file1 = oList.RootFolder.Files.Add(fileInfo); var item1 = file1.ListItemAllFields; item1 ["Customer"] = item.Name; item1.Update(); context.ExecuteQuery(); 解决方案 Use - Sharepoint.client.dllfind file one one server document librarySPFolder oldFolder = web.GetFolder(library.RootFolder.Url + "/" + item.Name + "/" + existingitem.Name + "/Shared"); SPFileCollection folderColBilling; folderColBilling = oldFolder.Files; foreach (SPFile file in folderColBilling) {//1. this for url of existing file (from one server)//2 . and this for 2nd server where you add the given file. using(ClientContext context=new ClientContext("http://clientinterface:27213")){ context.Credentials=new NetworkCredential("TCPL", "Knsp@rtner$@!@#","KNSPARTNERS"); //Microsoft.SharePoint.Client.List var oList = context.Web.Lists.GetByTitle("Shared Documents"); // var fileInfo = new FileCreationInformation { Url = System.IO.Path.GetFileName(file.Name.ToString()), Content =file.OpenBinary(), //System.IO.File.ReadAllBytes(file.Url), Overwrite = true }; var file1 = oList.RootFolder.Files.Add(fileInfo); var item1 = file1.ListItemAllFields; item1["Customer"] = item.Name; item1.Update(); context.ExecuteQuery(); 解决方案 这篇关于我们如何实用地将文件从一台服务器添加到同一域中的另一台服务器文档库中?请帮忙 .的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!