Answered by:
json to sharepoint list

Question
-
Hi,
I'm finding a lot of info on how to get a sharepoint list out to json. But I need it the other way around.
There are three "fields" in a json file that I need to import into three columns of a sharepoint list. Here is an example of what I use to get the json data. http://str/myrule2json.php?RULE=MYDATA&FIELD=MyField
Can anyone point me in the right direction? Thanks.
Friday, July 29, 2016 7:17 AM
Answers
-
Hi,
You can use jQuery ajax CRUD operation to address your need, you can make a POST call,
User below sample code,
jQuery.ajax({ url: "http://<site url>/_api/web/lists", type: "POST", data: JSON.stringify({ '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true, 'BaseTemplate': 100, 'ContentTypesEnabled': true, 'Description': 'My list description', 'Title': 'Test' } ), headers: { "accept": "application/json;odata=verbose", "content-type": "application/json;odata=verbose", "content-length": <length of post body>, "X-RequestDigest": $("#__REQUESTDIGEST").val() }, success: doSuccess, error: doError });
Reference link : https://msdn.microsoft.com/en-us/library/office/jj164022.aspx
Please let me know in case any further clarification required on the same.
Hope this help.
Vote - if you find this helpful
Marked as Answer - if you see this reply being an answer to the question of the thread
Regards,
Amjad Khan
Blog: https://amjadk.com- Proposed as answer by Jerry ZyMicrosoft contingent staff Sunday, August 7, 2016 8:28 AM
- Marked as answer by Jerry ZyMicrosoft contingent staff Monday, August 8, 2016 8:25 AM
Friday, July 29, 2016 7:31 AM
All replies
-
Hi,
You can use jQuery ajax CRUD operation to address your need, you can make a POST call,
User below sample code,
jQuery.ajax({ url: "http://<site url>/_api/web/lists", type: "POST", data: JSON.stringify({ '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true, 'BaseTemplate': 100, 'ContentTypesEnabled': true, 'Description': 'My list description', 'Title': 'Test' } ), headers: { "accept": "application/json;odata=verbose", "content-type": "application/json;odata=verbose", "content-length": <length of post body>, "X-RequestDigest": $("#__REQUESTDIGEST").val() }, success: doSuccess, error: doError });
Reference link : https://msdn.microsoft.com/en-us/library/office/jj164022.aspx
Please let me know in case any further clarification required on the same.
Hope this help.
Vote - if you find this helpful
Marked as Answer - if you see this reply being an answer to the question of the thread
Regards,
Amjad Khan
Blog: https://amjadk.com- Proposed as answer by Jerry ZyMicrosoft contingent staff Sunday, August 7, 2016 8:28 AM
- Marked as answer by Jerry ZyMicrosoft contingent staff Monday, August 8, 2016 8:25 AM
Friday, July 29, 2016 7:31 AM -
Wow, that's great Amjad. I will get going to see if I can get it working. Thanks so much. I'll vote and mark it as an answer as soon as I can get it working. Again, thank you.Friday, July 29, 2016 8:51 PM
-
Thanks IJ712,
For your respose, hope it should work.
Please mark these threads as Answered, once you through.
Hope this help.
Vote - if you find this helpful
Marked as Answer - if you see this reply being an answer to the question of the thread
Regards,
Amjad Khan
Blog: https://amjadk.comSaturday, July 30, 2016 9:46 AM