zoukankan      html  css  js  c++  java
  • ECMA 上传文件到SHarePoint 文档库

    <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script><script type="text/javascript">
        function uploadFile() {
            var filePath = "c:\test.pdf";
            var soapEnv =
            "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> 
                <soap:Body>
                    <CopyIntoItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
                        <SourceUrl>" + filePath + "</SourceUrl>
                            <DestinationUrls>
                                <string>http://ghy/Shared Documents/test.pdf</string>
                            </DestinationUrls>
                            <Fields>
                                <FieldInformation Type='Text' DisplayName='Title' InternalName='Title' Value='Test' />
                            </Fields>
                        <Stream>base64Binary</Stream>
                    </CopyIntoItems>
                </soap:Body>
            </soap:Envelope>";
            $.ajax({
                url: "http://sharepointsite/_vti_bin/copy.asmx",
                beforeSend: function (xhr) { xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"); },
                type: "POST",
                dataType: "xml",
                data: soapEnv,
                complete: processResult,
                contentType: "text/xml; charset="utf-8""
            });
        }
        function processResult(xData, status) {
            alert("Uploaded SuccessFully");
        }</script><input name="Upload" onclick="uploadFile()" type="button" value="Upload"/> 
  • 相关阅读:
    01 背包问题
    神奇的口袋[dp]
    2019考研西交大软件工程
    计算机考研有哪些值得推荐的院校?
    考研-政治经验贴***
    考研-英语经验贴2.0
    考研-作息时间安排表(总结)
    考研-英语经验贴(总结)
    考研-数学经验贴(总结)
    考研-专业课经验贴
  • 原文地址:https://www.cnblogs.com/ahghy/p/3149373.html
Copyright © 2011-2022 走看看