Chaitanya Krishna
Chaitanya Krishna

Reputation: 97

How to save a list item into specific folder in SharePoint list using REST API?

I have to save items into SharePoint list where I have specific folders in it and I have to save the item into that particular folder based on the item. I've retrieved the items from specific folders but how to save a list item into specific folder in SharePoint list using REST API?

Upvotes: 1

Views: 1740

Answers (1)

Chaitanya Krishna
Chaitanya Krishna

Reputation: 97

use 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);
                }
            });

Upvotes: 2

Related Questions