401用于共享点列表项,带有附件的匿名用户使用rest API [英] 401 for sharepoint list item with attachment using rest API for anonmous users

查看:75
本文介绍了401用于共享点列表项,带有附件的匿名用户使用rest API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将附加项添加到具有attachmnet的列表,而该列表对我来说是有效的,但是当我通过错误添加附加项时.

I have to add item to list wiht attachmnet it worked for me wihtout attachmnet but when i add attahment throughing error.

401空无一物

下面是代码

以前有没有人经历过?

非常感谢您的建议和答案.

You suggestions and answers are much appreciated.

推荐答案

您好,

下面的代码在我的本地计算机上有效,您可以尝试一下(我在脚本编辑器Web部件中进行了测试).

<html>
<head>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script>
        function AddAttachments() {
            var digest = "";


.ajax( { 网址:"/_ api/contextinfo", 方法:"POST", 标头:{ "ACCEPT":"application/json; odata = verbose", "content-type":"application/json; odata = verbose"; }, 成功:功能(数据){ 摘要= data.d.GetContextWebInformation.FormDigestValue; }, 错误:函数(数据){ } }).done(function(){ var fileInput =
.ajax( { url: "/_api/contextinfo", method: "POST", headers: { "ACCEPT": "application/json;odata=verbose", "content-type": "application/json;odata=verbose" }, success: function (data) { digest = data.d.GetContextWebInformation.FormDigestValue; }, error: function (data) { } }).done(function () { var fileInput =


('#uploadFile'); var fileName = fileInput [0] .files [0] .name; var reader = new FileReader(); reader.onload =函数(e){ var fileData = e.target.result; var res11 =
('#uploadFile'); var fileName = fileInput[0].files[0].name; var reader = new FileReader(); reader.onload = function (e) { var fileData = e.target.result; var res11 =


这篇关于401用于共享点列表项,带有附件的匿名用户使用rest API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆