Export (0) Print
Expand All

RetrieveBusinessHierarchyBusinessUnit Message

CRM 1.2
banner art

Retrieves all business units (including the specified business unit) in the business unit hierarchy.

The relevant classes are specified in the following table.

Type Class
Request RetrieveBusinessHierarchyBusinessUnitRequest
Response RetrieveBusinessHierarchyBusinessUnitResponse
Entity businessunit

Remarks

To perform this action, the caller must have access rights on the business unit entity instance. For a list of required privileges, see RetrieveBusinessHierarchyBusinessUnit Privileges.

Example

The following code example demonstrates how to use the RetrieveBusinessHierarchyBusinessUnit message.

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

// Create the column set.
ColumnSet cols = new ColumnSet();

// Set the properties of the column set.
cols.Attributes = new string [] {"name"};

// Create the request object.
RetrieveBusinessHierarchyBusinessUnitRequest retrieve = new RetrieveBusinessHierarchyBusinessUnitRequest();

// Set the properties of the request object.
retrieve.ColumnSet = cols;
retrieve.EntityId = new Guid("18ECA720-493E-4800-BBFD-638BD54EB325");

// Execute the request.
RetrieveBusinessHierarchyBusinessUnitResponse retrieved = (RetrieveBusinessHierarchyBusinessUnitResponse) service.Execute(retrieve);
[Visual Basic .NET]
' Set up the CRM Service.
Dim service As New CrmService()
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the column set.
Dim cols As New ColumnSet()

' Set the properties of the column set.
cols.Attributes = New String() {"name"}

' Create the request object.
Dim retrieve As New RetrieveBusinessHierarchyBusinessUnitRequest()

' Set the properties of the request object.
retrieve.ColumnSet = cols
retrieve.EntityId = new Guid("18ECA720-493E-4800-BBFD-638BD54EB325");

' Execute the request.
Dim retrieved As RetrieveBusinessHierarchyBusinessUnitResponse = CType(service.Execute(retrieve), RetrieveBusinessHierarchyBusinessUnitResponse)

Related Topics

CrmService Messages


© 2007 Microsoft Corporation. All rights reserved.


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft