AddMemberList Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

Works for all deployment types Works online only

Adds a member to a list. The member added must be one of the following entity types: account, contact, or lead.

The following table shows where this message can be used.

Message Availability
Microsoft Dynamics CRM 4.0
Microsoft Dynamics CRM Online
Connected to server
Disconnected from server

The relevant classes are specified in the following table.

Type Class
Request AddMemberListRequest
Response AddMemberListResponse
Entity list

Remarks

To use this message, pass an instance of the AddMemberListRequest class as the request parameter in the Execute method.

To perform this action, the caller must have access rights on the list (marketing list) entity instance. For a list of required privileges, see AddMemberList Privileges.

Example

The following code example demonstrates how to add a member to a list.

[C#]
// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0; 
token.OrganizationName = "AdventureWorksCycle";
 
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the request object.
AddMemberListRequest add = new AddMemberListRequest();

// Set the properties of the request object.
add.EntityId = new Guid("b050f053-yur3-dc31-bb3a-0003ffbad37a");
add.ListId = new Guid("C15AF217-C17E-DA11-B90F-000874DE7397");

// Execute the request.
AddMemberListResponse added = (AddMemberListResponse) service.Execute(add);

[Visual Basic .NET]
' Set up the CRM Service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory Authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the request object.
Dim add As New AddMemberListRequest()

' Set the properties of the request object.
add.EntityId = New Guid("b050f053-yur3-dc31-bb3a-0003ffbad37a")
add.ListId = New Guid("C15AF217-C17E-DA11-B90F-000874DE7397")

' Execute the request.
Dim added As AddMemberListResponse = CType(service.Execute(add), AddMemberListResponse)

See Also

Concepts

Reference

© 2010 Microsoft Corporation. All rights reserved.