2

I am using this code for adding a custom field (column) in a sharepoint list

   executor = new SP.RequestExecutor(shptService.appWebUrl);
                var data = "{ '__metadata': { 'type': 'SP.Field' }, 'Title': 'Col', 'FieldTypeKind': 3 }";
                executor.executeAsync({
                    url: shptService.appWebUrl + "/_api/SP.AppContextSite(@target)/web/Lists/getbytitle(\'mylist\')/fields?@target='" + shptService.appWebUrl + "'",
                    method: "POST",
                    body: data,
                    headers: {
                        "content-type": "application/json; odata=verbose"
                    }, success: function (data) { console.log('Success creating custom Field'); },
                    error: function (err) { conosole.log('Failed for creating custom Field !' + err); }

                });

it's working though, i want to create two or more fields at the same time.. is it possible in REST ??

2
  • hosted app or provider hosted app? Oct 12, 2015 at 3:51
  • sharepoint hosted application sir.
    – Looytawon
    Oct 12, 2015 at 4:10

1 Answer 1

4

Batch requests were not supported in SharePoint REST until recently. However, SharePoint Online has now got support for batch requests. You can find more details about it in the following links.

http://www.andrewconnell.com/blog/part-1-sharepoint-rest-api-batching-understanding-batching-requests

http://www.andrewconnell.com/blog/part-2-sharepoint-rest-api-batching-exploring-batch-requests-responses-and-changesets

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.