CrmService.Update Method

banner art

Updates an instance of an entity.

Syntax

[Visual Basic]
Public Sub Update(
  ByVal entity As BusinessEntity
)

[C#]
public void Update(
  BusinessEntity  entity
);

[JScript]
public function Update(
  entity : BusinessEntity
);

Parameters

entity

Specifies an instance of a class derived from BusinessEntity of a type that supports updating. The instance has one or more field values that are to be updated.

Return Value

No return value.

Remarks

Use this method to update any instance of a Microsoft CRM entity that supports the Update message.

To perform this action, the caller must have the Write privilege to the entity type and access rights on the entity instance specified in the request class.

Example

The following example demonstrates the use of the Update method.

[C#]
// Set up the CRM service.
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the contact object.
contact contact = new contact();

// Set the contact object properties to be updated.
contact.address1_line1 = "34 Market St.";

// The contactid is a key that references the ID of the contact to be updated.
contact.contactid = new Key();
// The contactid.Value is the GUID of the record to be changed.
contact.contactid.Value = new Guid("4D507FFE-ED25-447B-80DE-00AE3EB18B84");

// Update the contact.
service.Update(contact);

[Visual Basic .NET]
' Set up the CRM service.
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the contact object.
Dim contact As New contact()

' Set the contact object properties to be updated.
contact.address1_line1 = "34 Market St."

' The contactid is a key that references the ID of the contact to be updated.
contact.contactid = New Key()
' The contactid.Value is the GUID of the record to be changed.
contact.contactid.Value = new Guid("4D507FFE-ED25-447B-80DE-00AE3EB18B84");

' Update the contact.
service.Update(contact)

See Also

© 2007 Microsoft Corporation. All rights reserved.