记一个调用_vti_bin/copy.asmx拷贝文件的代码例子
2011-11-04 17:35
459 查看
本例子已经博主测试通过.
注意这里的过认证的部分.
注意这里对CopyIntoItems方法的调用.
在Visual Studio 2010中添加Web Service的方法
代码如下
打开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'
http://stackoverflow.com/questions/1044034/wcftestclient-the-http-request-is-unauthorized-with-client-authentication-scheme
注意这里的过认证的部分.
注意这里对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'
http://stackoverflow.com/questions/1044034/wcftestclient-the-http-request-is-unauthorized-with-client-authentication-scheme
相关文章推荐
- HDFS的API调用,创建Maven工程,创建一个非Maven工程,HDFS客户端操作数据代码示例,文件方式操作和流式操作
- 如下代码中greater10函数调用时实参是如何传递的呢? 代码是MSDN中的一个例子
- 【ASP】ASP vbscript一个综合的例子,操作html文件添加、删除代码、删除文件。
- 一个初级例子讲述C和CPP在JNI中调用安卓Java代码
- mini学生管理系统。。。全部代码,4个java文件放在同一个包下面即可。用JDBC调用数据库取出数据。
- 如何在后台CS代码文件中调用前台JS文件中的某一个函数
- 将一个文件从一个文件夹拷贝到另一个文件夹的java代码
- VS C#工程【调用另外一个项目的类】【第一个工程:文件拷贝】
- 通过一个文件拷贝的例子了解二进制文件的读写
- 一个简单的调用脚本文件的例子
- 一个hex文件与bin文件相互转换的python代码
- 一个使用自定义命名空间的Schema文件,xml文件和castor生成的java代码的例子
- 求bat文件创建mysql数据库,并调用一个SQL文件的代码
- C++调用Lua读取配置文件的一个简单例子
- 网上只写了一个文件断点下载的例子! 我仿照别人得例子 自己增加了自己代码,异步下载文件 支持断点下载 多任务下载! 如有问题 请联系我
- 在页面里JS代码里onclick去调用后台文件中的一个方法
- 收录一个拷贝文件的经典例子
- 哪些年遇到过的Andriod问题(13)Mars的下载文件代码不知道是什么问题,在网上去新COPY了一个就可以下载了。
- iOS关于沙盒文件拷贝manager.copyItem的一个坑
- 一个例子秒懂动态库与静态库的调用【详解】(.so和.a文件的相互调用)