Sharepoint多个Ajax调用

编程入门 行业动态 更新时间:2024-10-27 04:36:56
本文介绍了Sharepoint多个Ajax调用-需要一个示例,以通过REST API将附件上传到列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,

请任何人帮我完成以下任务.

Could you please any of you help me on getting the below task done.

我正在尝试将附件上传到同一列表中的各个项目.当我尝试使用客户端脚本+ rest api方法时,便能够添加附件.

I am trying to upload the attachments to various items on the same list. As i am trying client side scripting + rest api method am able to add the attachment.

但是我有多个文件要上传,需要一个示例来实现.

But i have multiple files to upload and need an example to achieve this.

代码:

加纳

Dhana-Chennai-India

Dhana-Chennai-India

推荐答案

I根据您的代码做了一些更新,您可以检查代码以供参考.

(在页面上添加内容编辑器Web部件,并在其中添加以下代码)

<script type="text/javascript" src="code.jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript">

(function(){ (function () {

(#uploadDocumentButton").click(功能 () { if(document.getElementById("inputFile").files.length === 0){ alert(选择文件!"); 返回; } var parts = document.getElementById("inputFile").value.split("\\"); var filename = parts [parts.length-1]; var file = document.getElementById("inputFile").files [0]; uploadFile("ListA","1",文件名,文件); } ) }) 函数uploadFile(listName,listId,fileName,file){ uploadFileSP(listName,listId,fileName,file) .然后( 功能(文件){ alert(成功上传"); }, 功能(发送方,参数){ alert(args.get_message()); } ); } 函数getFileBuffer(file){ var deferred = ("#uploadDocumentButton").click(function () { if (document.getElementById("inputFile").files.length === 0) { alert("Select a file!"); return; } var parts = document.getElementById("inputFile").value.split("\\"); var filename = parts[parts.length - 1]; var file = document.getElementById("inputFile").files[0]; uploadFile("ListA", "1", filename, file); } ) }) function uploadFile(listName, listId, fileName, file) { uploadFileSP(listName, listId, fileName, file) .then( function (files) { alert("Uploaded successfully"); }, function (sender, args) { alert(args.get_message()); } ); } function getFileBuffer(file) { var deferred =

更多推荐

Sharepoint多个Ajax调用

本文发布于:2023-10-29 12:57:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539751.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   Sharepoint   Ajax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!