Export (0) Print
Expand All

Client Objects, Value Objects, and Scalar Properties

SharePoint 2010

Last modified: July 15, 2010

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.

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.

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 []

Show:
© 2014 Microsoft