Client Objects, Value Objects, and Scalar Properties

Applies to: SharePoint Foundation 2010

Available in SharePoint Online

A client object is any object that inherits from the ClientObject class (JavaScript: ClientObject). To access the SharePoint Foundation object model, you can return a client object that represents a site collection or Web site through the Site (JavaScript: site) or Web (JavaScript: web) property of the ClientContext class (JavaScript: ClientContext). You can then use these objects to return other client objects through object properties or methods. For example, the Lists property (JavaScript: lists) of the Web class (JavaScript: Web) returns the lists in the Web site, or the GetItems(CamlQuery) method (JavaScript: getItems(query)) of the List class (JavaScript: List) returns the items in the list. When you return objects by using these members, the client objects have no data until you perform data retrieval on the objects to get their associated data. For information about data retrieval, see Data Retrieval Overview.

Value Objects

A value object is any object that inherits from the ClientValueObject class (JavaScript: ClientValueObject). For example, ListItem (JavaScript: ListItem) is a client object, but FieldUrlValue (JavaScript: FieldUrlValue) and other field value objects are value objects. You might think of a value object as a .NET class or structure that is marshaled by value, while a client object is a class or structure that is marshaled by reference. Value objects have properties but do not have methods. SharePoint Foundation treats all primitive types, such as string or int, as value objects.

Scalar Properties

While an object property returns a client object, value properties return property values that are associated with a client object. For example, Title (JavaScript: title) is a value property that contains a string or scalar value, but RootFolder (JavaScript: rootFolder) is an object property that returns a folder. A scalar property is any property that contains one of the .NET value types and includes any class that is derived from ClientValueObject (JavaScript: ClientValueObject). The following is a list of scalar properties.

  • bool

  • bool[]

  • byte

  • byte[]

  • char

  • char[]

  • DateTime

  • DateTime[]

  • double

  • double[]

  • enum

  • enum[]

  • float

  • float[]

  • Guid

  • Guid[]

  • int

  • int[]

  • Int16

  • Int16 []

  • Int64

  • Int64 []

  • string

  • string[]

  • UInt16

  • UInt16 []

  • UInt32

  • UInt32 []

  • UInt64

  • UInt64 []

See Also

Concepts

SharePoint 2010 Client Object Model Hierarchy and Identity

Client Context as Central Object

SharePoint Client Object Creation

SharePoint 2010 Client Object Model Guidelines

Differences Between Managed and JavaScript Object Models

Common Programming Tasks in the Managed Client Object Model

Other Resources

Client Class Library

JavaScript Class Library

Using the SharePoint Foundation 2010 Managed Client Object Model

Client Object Model Resource Center