Accessing Entities and Attributes

banner art

The Microsoft CRM 3.0 SDK programming model is centered on Microsoft CRM entities. To work with a Microsoft CRM entity, an instance of the entity is created. All the entities exposed in the SDK are a subclass of BusinessEntity. This is a new concept in this version and a change from the previous versions where entity properties were represented as XML strings.

Note   When referring to entity names in the SDK you always use the schema name, which is all lowercase. This name can be found in the Schema Name column in System > Customization > Customize Entities view in the application. It is also visible in the Entity column in the metadata browser found at https://<servername>/sdk/list.aspx.

Access to the attributes of an entity is provided through the 'dot' (.) operator. Microsoft IntelliSense is supported for the attributes of all entities through the dynamically generated WSDL.

Example

The following code example shows how to access an attribute of the account entity.

// Using a core entity.
account newAccount = new account();
newAccount.name = "The Bike Store";
newAccount.accountnumber = "123456";
newAccount.address1_postalcode = "98052";
newAccount.address1_city = "Redmond";
newAccount.telephone1 = "(206) 555-0123";
newAccount.websiteurl = "https://www.contoso.com/";

// Using a custom entity.
isv_bankaccount newBankAccount = new isv_bankaccount();
newBankAccount.isv_number = "934-012-4456";
newBankAccount.isv_branch = "Redmond Town Center";

Related Topics

Naming Conventions

Working with Custom Entities

© 2007 Microsoft Corporation. All rights reserved.