1

I have a website that is not located within my SharePoint site. I want to collect the user data from the website and save it in a SharePoint list. is this possible?

user3902467
  • 87
  • 10
  • Yes, it is possible using Sharepoint REST API. What is your SharePoint environment? – Alex Chance Apr 19 '16 at 19:27
  • There is REST API available for SharePoint 2010. There a several ways to approach this depending on the setup of your site, and SharePoint environment, etc... Have at look at [this](https://msdn.microsoft.com/en-us/library/ff798339.aspx), and [this](http://stackoverflow.com/questions/17820779/sharepoint-2010-rest-api-jquery-insert-update-delete) for info about the REST API. The tricky part may be the authentication if the site is completely external from the domain. – Alex Chance Apr 19 '16 at 19:45
  • They are in the same domain. This was perfect!! I will mark it as the answer if you want to write it up. Thank you for the direction!! – user3902467 Apr 19 '16 at 21:04
  • I have posted an answer. Happy to help. – Alex Chance Apr 19 '16 at 21:18

1 Answers1

1

You can perform list operations including Add, Update, and Delete using the built-in SharePoint REST API.

Microsoft provides pretty good documentation for using the REST API.

Note: the api endpoints and features are noticeably different for SharePoint 2010 and 2013.

There are many variations to use the REST API. Here is a snippet of what a sample REST call might look like to add an item to an existing list using JavaScript:

    function addListItem() {
               var myListUrl= "mysite.sharepoint.com/_vti_bin/listdata.svc/myList";    
               var item= {};
               item.Title = "Adding an item using 2010 REST API";

               var itemEntry= JSON.stringify(item);

               $.ajax({
                   type: "POST",
                   url: myListUrl,
                   data: itemEntry,
                   contentType: "application/json; charset=utf-8",
                   success: function () {
                       //do stuff here

                   },

                  error: function() {
                     //do some error handling here
                  }

               });
           }
Alex Chance
  • 783
  • 4
  • 16