ShrarePoint moveto操作标志问题

时间:2017-06-06 15:53:50

标签: javascript ajax sharepoint

我正在尝试使用SharePoint REST API方法moveto(newurl, flags)将文档库移动到Archived库。但是,我遇到了一些问题。

$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/GetFolderByServerRelativeUrl('" + path + "')/moveto(newurl='Archived',flags=1)",
        method: "POST",
        headers: {
             "Accept": "application/json; odata=verbose",
                       "X-RequestDigest" : $('#__REQUESTDIGEST').val()
             },
            success: function (data) {
                    console.log("Moved");
            },
            error: function (error) {
                    console.log("Error");
            }
});

path只是文档库的路径。

我得到的错误回复是

  

{ “错误”:{ “代码”:“ - 1,   Microsoft.SharePoint.Client.InvalidClientQueryException “ ”消息“:{ ”郎“: ”EN-US“, ”值“:” 其   参数名称标志无效。“}}}

我不确定请求中的标志有什么问题。

1 个答案:

答案 0 :(得分:0)

我意识到文件夹没有moveto或copyto操作,因此我必须将内容复制到新文件夹中。

使用它:

https://sharepoint.stackexchange.com/questions/105460/spfolder-moveto-functionality-in-javascript