Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

CreateActivitiesList Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online only

Creates the activities for a list.

The relevant classes are specified in the following table.

TypeClass
RequestCreateActivitiesListRequest
ResponseCreateActivitiesListResponse
Entitylist

Remarks

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

To perform this action, the caller must have access rights on the entity instance specified in the request class. For a list of required privileges, see CreateActivitiesList Privileges.

Example

The following code example demonstrates how to create a business entity.

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

account account = new account();
account.name = "Fourth Coffee";

TargetCreateAccount targetCreate = new TargetCreateAccount();
targetCreate.Account = account;

CreateRequest createAccount = new CreateRequest();
createAccount.Target = targetCreate;

CreateResponse createdAccount = (CreateResponse) service.Execute(createAccount);

list list = new list();
list.listname = "Test";
list.createdfromcode = new Picklist();
list.createdfromcode.Value = 1;

Guid createdList = service.Create(list);

email email = new email();
email.description = "email test";
email.subject = "test";

// Create the request.
CreateActivitiesListRequest create = new CreateActivitiesListRequest();
create.Activity = email;
create.ListId = createdList;
create.FriendlyName = "Test List";
create.Propagate = false;

// The owner property is a REQUIRED property.
WhoAmIRequest systemUserRequest = new WhoAmIRequest();
WhoAmIResponse systemUser = (WhoAmIResponse)service.Execute(systemUserRequest);

// Set the owner property
create.Owner = new Moniker();
create.Owner.Name = "systemuser";
create.Owner.Id = systemUser.UserId;

// Execute the request.
CreateActivitiesListResponse created = (CreateActivitiesListResponse) service.Execute(create);
[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

Dim account As New account()
account.name = "Fourth Coffee"

Dim targetCreate As New TargetCreateAccount()
targetCreate.Account = account

Dim createAccount As New CreateRequest()
createAccount.Target = targetCreate

Dim createdAccount As CreateResponse = CType(service.Execute(createAccount), CreateResponse)

Dim list As New list()
list.listname = "Test"
list.createdfromcode = New Picklist()
list.createdfromcode.Value = 1

Dim createdList As Guid = service.Create(list)

Dim email As New email()
email.description = "email test"
email.subject = "test"

' Create the request.
Dim create As New CreateActivitiesListRequest()
create.Activity = email
create.ListId = createdList
create.FriendlyName = "Test List"
create.Propagate = False

' Execute the request.
Dim created As CreateActivitiesListResponse = CType(service.Execute(create), CreateActivitiesListResponse)

See Also

Reference


© 2010 Microsoft Corporation. All rights reserved.


Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.