【问题标题】:How to save a list item into specific folder in SharePoint list using REST API?如何使用 REST API 将列表项保存到 SharePoint 列表中的特定文件夹中?
【发布时间】:2020-12-17 22:58:26
【问题描述】:

我必须将项目保存到其中包含特定文件夹的 SharePoint 列表中,并且我必须根据该项目将项目保存到该特定文件夹中。我已经从特定文件夹中检索了项目,但是如何使用 REST API 将列表项保存到 SharePoint 列表中的特定文件夹中?

【问题讨论】:

  • 欢迎来到 SO,请在提问时更具体一点:您尝试过什么,您期望什么等。请参阅how to ask
  • 对,你想要 JavaScript、C# 还是其他示例?
  • @Arcan.NET 找到了使用 listdata.svc 的解决方案,请查看...感谢您的回复

标签: sharepoint-2013 sharepoint-online office365-restapi


【解决方案1】:

使用 listdata.svc

var metadata={Title: "Title", Path: "/ServerRelativeUrl of your folder in the list"};
$.ajax({
                url: url + "/_vti_bin/ListData.svc/[List Name]",
                type: "POST",
                contentType: "application/json;odata=verbose",
                data: JSON.stringify(metadata),
                headers: {
                    "Accept": "application/json;odata=verbose",
                    "X-RequestDigest": $("#__REQUESTDIGEST").val()
                },
                success: function (data) {
                    self.options.success(data);
                },
                error: function (data) {
                    self.options.error(data);
                }
            });

【讨论】:

  • 辛苦了先生..!!非常感谢。你救了我的一天..!! :-)
猜你喜欢
  • 2023-02-17
  • 1970-01-01
  • 1970-01-01
  • 2016-07-15
  • 2015-12-20
  • 2020-09-11
  • 2019-06-02
  • 2019-06-06
  • 1970-01-01
相关资源
最近更新 更多