sharepoint rest api 创建文档库 文件夹

时间:2024-01-19 09:01:56

function createFolder()
{

var requestHeaders = {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"Content-Type": "application/json;odata=verbose"

};

$.ajax({
url: "https://winourway.sharepoint.cn/sites/test01/_api/lists/getByTitle('t2')/rootfolder/folders/add(url=\'" + $("#childfolderName").val()+"\')",
method: "POST",
// body: "{ '__metadata': { 'type': 'SP.Folder' }, 'ServerRelativeUrl': 'Shared Documents/New Folder' }",
headers: requestHeaders,
success: function (data)
{
layer.msg("创建成功", {icon:1})
},
error: function (data)
{
console.log(data);
}
});

}