记一个调用_vti_bin/copy.asmx拷贝文件的代码例子
本例子已经博主测试通过.
注意这里的过认证的部分.
注意这里对CopyIntoItems方法的调用.
在Visual Studio 2010中添加Web Service的方法
代码如下
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace WebServiceCallTest { class Program { static void Main(string[] args) { sps2010.FieldInformation myfieldInfo = new sps2010.FieldInformation(); string oSourceUrl = @"http://null"; string[] oDestinationUrls = { @"http://sps2010/lauradoc/Testing3.doc" }; sps2010.FieldInformation[] oFields = { myfieldInfo }; byte[] oStream = new byte[2048]; sps2010.CopyResult[] oResults; using(sps2010.Copy oCopy = new sps2010.Copy()) { oCopy.Credentials = System.Net.CredentialCache.DefaultCredentials; oCopy.Url = "http://sps2010/_vti_bin/copy.asmx"; oCopy.Timeout = 600000; uint documentid = oCopy.CopyIntoItems(oSourceUrl, oDestinationUrls, oFields, oStream, out oResults); } } } }
打开Fiddler, 可以发现成功的结果.
参考资料
================
How do you copy a file into SharePoint using a WebService?
http://stackoverflow.com/questions/787610/how-do-you-copy-a-file-into-sharepoint-using-a-webservice
Upload a file to SharePoint through the built-in web services
http://ithoe.com/Question/31868/upload-a-file-to-sharepoint-through-the-built-in-web-services
A POST or PUT request may fail when you use the HttpWebRequest class to send lots of data on a computer that is running the .NET Framework
http://support.microsoft.com/KB/908573
WCFTestClient The HTTP request is unauthorized with client authentication scheme 'Anonymous'
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
2010-11-04 解决SharePoint 2003的爬网性能问题- 之二
2010-11-04 解决SharePoint 2003的爬网性能问题- 之一
2009-11-04 汇编语言基础之八- 动手练习,将前面的知识用于实践
2009-11-04 汇编语言基础之七- 框架指针的省略(FPO)