SharePoint can refer to one or more products from the Microsoft SharePoint family.
Office 365 is a separate Microsoft offering that includes the SharePoint Online service, although not all plans support all SharePoint features.
The following links provide extensive feature comparisons between available SharePoint versions:
Background
The JavaScript Object Model was introduced in SharePoint 2010. It exposes on the client side many of the objects that were previously only accessible through server-side code or through dedicated web services.
Embedding JavaScript in SharePoint Pages
In SharePoint 2013 you can put your JavaScript in a Script Editor web part.
In SharePoint 2010 you can use the "content link" property of a Content Editor web part to link to an HTML file that contains your embedded script.
Object Reference
The constructors, methods, and properties of all objects found in the SP
namespace are documented in the SharePoint 2013 client object model reference here.
The SharePoint 2010 JavaScript client object model reference is available here.
JSOM's Asynchronous Programming Pattern
When using the JavaScript client object model, code generally takes the following pattern:
ClientContext
object.ClientContext
object to retrieve objects representing entities in the SharePoint object model, such as lists, folder, views.load
function to tell the ClientContext
what information you want to receive back from the server.ClientContext
object's executeQueryAsync
function to send the queued instructions to the server, passing two callback functions to run on success or failure.Alternatives
Client-side alternatives to the JSOM include SharePoint's web services, REST endpoints, and the .NET client object model.
The REST client access API was first introduced in SharePoint 2010, but was greatly expanded in SharePoint 2013. The REST API in SharePoint 2010 is accessed through the ListData web service at the /_vti_bin/ListData.svc
url. SharePoint 2013 introduced the /_api/lists/
and /_api/web
endpoint URLs, which behave slightly differently.
The above endpoint URLs should be preceded by http://server/site
where server
represents the name of the server, and site
represents the name of, or path to, the specific site.
Example URL for... | SharePoint 2010 | SharePoint 2013 |
---|---|---|
Fetching a List: | /_vti_bin/ListData.svc/ListName | /_api/lists('ListGuid') |
Fetching an Item: | /_vti_bin/ListData.svc/ListName(1) | /_api/lists('ListGuid')/items(1) |
Fetching a Web: | (no equivalent) | /_api/web |
Despite the differences in accessing lists and list items, working with those results is very similar in both versions.
Note that the ListData.svc
service is still available in SharePoint 2013 for backwards compatibility.
A REST request can be submitted via a native JavaScript XMLHttpRequest or via the jQuery AJAX wrapper construct.
var xhr = new XMLHttpRequest();
xhr.open(verb, url, true);
xhr.setRequestHeader("Content-Type","application/json");
xhr.send(data);
$.ajax({
method: verb,
url: url,
headers: { "Content-Type":"application/json" },
data: data
});
For more details on sending requests via AJAX, see the JavaScript AJAX documentation.
The SP.UI.ModalDialog
namespace was introduced to the JavaScript Object Model with SharePoint 2010, and is available in subsequent SharePoint versions 2013, Office365, and 2016.
Additional reference materials:
In the SharePoint conceptual hierarchy, site collections contain sites, which in turn contain lists. A site collection (SPSite
) has no explicit UI but always contains one root level site (accessible through the RootWeb
property) and possibly additional subsites under that root site. A site or web (SPWeb
) has a UI and contains lists/document libraries (SPList
), pages with webparts, and items/documents (SPListItem
).
Reference required from site: http://www.letsharepoint.com/what-is-user-information-list-in-sharepoint-2013/