Version

List.Item.updateDocument

This method is used to modify an existing item in a SharePoint List. As parameter, it receives a JavaScript object that can include several properties. When the parameter has no properties with contextual information this method relies on user navigation to get the context. For example, after the user navigates to a specific list within a site and tries to modify an item, SharePlus can get the site URL, the list GUID, the content type, and the item’s ID. You can use List.Item.update in two different ways:

  1. From a Mobile Workspace, where you need to provide contextual information like the site URL and list name. In this case you can use List.getListMetadata to get the content types and required fields from the list. In the case that you need the GUID of the list, you can get it using the Web.getWebsAndLists method.

  2. From a Custom Form defined for a list, where you already have contextual information available from the user navigation through the UI.

Syntax

SPlus.List.Item.updateDocument (args, function (result){
        //TODO: Implement what to do when an item was successfully edited
}, function (eResponse){
        //TODO: Implement what to do with the error information
}, function (){
        //TODO: Implement how to handle a user’s cancel
});

List.Item.updateDocument Parameters

Parameter

Type

Description

args

JavaScript Object

The args Object includes a property with the file name and the attributes of the document. And, optionally, contextual information to be used by SharePlus to find the library and the existing document.

onSuccess callback function

Parameter

Description

function (result)

Success callback function to be implemented. When successful, result returns as an empty dictionary.

onError callback function

Parameter

Description

function (eResponse)

Error callback function to be implemented, which receives the eResponse JavaScript Object.

onCancel callback function

Parameter

Description

function (result)

Cancel callback function to be implemented.