0

I am able to post files into folder using rest... but now I am trying to post files into a list and received

{"error":{"code":"-1, Microsoft.SharePoint.Client.ResourceNotFoundException","message":{"lang":"en-US","value":"Cannot find resource for the request files."}}}', cookies: [] }

I am trying to post using https://site/_api/web/lists(guid'03a7f359-f263-4353-a491-504c2d06cd79')/items(add(overwrite=true, url='filename'). Is the url the problem?

Thank you in advance

2 Answers 2

1

The ListItemCollection does not have a files collection, so you cannot call the Add method. You can only add files to a document library by using a folder in you URL. Here is an example URL:

http://site/_api/web/lists(guid 'guid')/rootfolder/files/add/(url='whatever.png',overwrite=true)

0

Check if you have loaded all the scripts that you need when you make your POST request. You can use the SP.SOD.executeOrDelayUntilScriptLoaded function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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