Skip to main content

How to get various item fields using Client Object Model Ecmascript – SharePoint 2010

Here is a list of Fields\Field Types that you would need while accessing SP.ListItem using ECMASCRIPT\JavaScript.

Field  – How to Get\set it

Title – SP.ListItem.get_item(‘Title‘);

ID – SP.ListItem.get_id();

Url -SP.ListItem.get_item(‘urlfieldname‘).get_url()

Description – SP.ListItem.get_item(‘descriptionfieldname‘).get_description();

Current Version – SP.ListItem.get_item(“_UIVersionString“);

Lookup field – SP.ListItem.get_item(‘LookupFieldName’).get_lookupValue();

Choice Field – SP.ListItem.get_item(‘ChoiceFieldName‘);

Created Date – SP.ListItem.get_item(“Created“);

Modified Date – SP.ListItem.get_item(“Modified“); -> case sensitive does not work with ‘modified’

Created By – SP.ListItem.get_item(“Author“).get_lookupValue());

Modified by – SP.ListItem.get_item(“Editor“).get_lookupValue());

File  – SP.ListItem.get_file();

File Versions -  File.get_versions();.

Content Type – SP.ListItem.get_contentType();

Parent List – SP.ListItem.get_parentList();



Read more: http://www.learningsharepoint.com/2011/07/06/how-to-get-various-item-fields-using-client-object-model-ecmascript-sharepoint-2010/#ixzz2dBD6a7T0

Comments