REST Methods

Below are all the currently implemented methods for access the REST services of SharePoint. All of these methods return a promise.

AddFileToLibrary

This method will add the file to the desired SharePoint library. This is helpful for HTML 5 file upload scenarios.
AddFileToLibrary(listName, webUrl, fileName, file)

Parameters

AddUsertoGroup

This method will add the specified user to a group.
AddUsertoGroup(groupId, loginName, webUrl)

Parameters

CreateListItem

This method will create a list item in the list specified.
CreateListItem(listName, webUrl, item)

Parameters
     var obj = { 
          Title: 'Test Title', 
          MyCustomField: 'Testing'
     }

CreateSubSite

This method will create a sub site under the specified site.
CreateSubSite(options, webUrl)

Parameters
     siteUrl: "UrlForSite",
     siteName: "NameOfTheNewSite",
     siteDescription: "DescriptionOfTheSite",
     siteTemplate: "TemplateOfTheNewSite",
     uniquePermissions: true|false

DeleteListItem

This method will delete a list item by ID from the list specified.
DeleteListItem(itemId, listName, webUrl)

Parameters

GetGroup

This method will get a SharePoint group by name.
GetGroup(groupName, includeMembers, webUrl)

Parameters

GetItemById

This method will get a list item by ID from the list specified.
GetItemById(itemId, listName, webUrl)

Parameters

GetListItems

This method will retrieve list items from the list specified.
GetListItems(listName, webUrl, options)

Parameters
     var options = {
          $filter: "Title eq 'Test'"
     }

GetListItemsByCAML

This method will retrieve list items from the list specified using a CAML query.
GetListItemsByCAML(listName, webUrl, camlQuery, options)

Parameters
     var options = {
          $filter: "Title eq 'Test'"
     }

GetSiteUsers

This method is will get all the users on the site.
GetSiteUsers(webUrl)

GetUpdateDigest

This method will retrieve either the cached digest information or will go get a new digest when needed.
GetUpdateDigest(webUrl)

Parameters

GetUserById

This method will retrieve a site user based on id.
GetUserById(userId, webUrl)

Parameters

GetWebData

This method will retrieve the properties of the requested site.
GetWebData(webUrl)

Parameters

SanitizeWebUrl

This method is used to ensure that we have a valid site URL to work with. If a null value or empty string is passed to this method then this will retrieve the site URL from the SharePoint context variable.
SanitizeWebUrl(url)

UpdateListItem

This method will update the list item in the list specified.
UpdateListItem(itemId, listName, webUrl, updateData)

Parameters
     var obj = { 
          Title: 'Test Title', 
          MyCustomField: 'Testing'
     }

UpdateWebData

This method will update the site with the data provided.
UpdateWebData(webUrl, updateData)

Parameters
     var obj = { 
          Title: 'Test Title'
     }


!!Search
The following methods are a grouping of methods related to using the SharePoint Search service

Search.Get

This method will update the site with the data provided.
Search.Get(webUrl, options)

Parameters
     var options = {
                    QueryText: 'SharePoint'
                }


!!Profile
The following methods are related to retrieving User data from the Profile Store

Profile.GetCurrentUser

This method will get the user profile data for the currently logged in user
Profile.GetCurrentUser(webUrl, options)

Parameters

Profile.GetForUser

This method will get the user profile data for the requested user
Profile.GetForUser(webUrl, userName, options)

Parameters