簡體   English   中英

通過 api rest 更新 sharepoint 文檔的屬性

[英]Update the properties of a sharepoint document via api rest

通過 api rest 更新 sharepoint 文檔的屬性。 圖片比如我要在文件test.html中編輯test一欄

如果要更新文檔名稱,請嘗試以下示例。

function CreateListItemWithDetails(listName) {
    
    var item = {
        "__metadata": { "type": "SP.Data.Shared_x0020_DocumentsItem" },
        "FileLeafRef": "NBA2.PNG"           
    };

    $.ajax({
        url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(9)",
        type: "POST",
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(item),
        headers: {
            "IF-MATCH": "*",
                   "X-HTTP-Method": "PATCH",
                   // Accept header: Specifies the format for response data from the server.
                   "Accept": "application/json;odata=verbose",
                   //Content-Type header: Specifies the format of the data that the client is sending to the server
                   "Content-Type": "application/json;odata=verbose",
                   // X-RequestDigest header: When you send a POST request, it must include the form digest value in X-RequestDigest header
                   "X-RequestDigest": $("#__REQUESTDIGEST").val()
        },
        success: function (data) {
            console.log(data);
        },
        error: function (data) {
            console.log(data);
        }
    });
}

更新: 在此處輸入圖像描述 在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM