Hi, to Create a Task,
You can refer to this SDK Code :
msdn.microsoft.com/.../gg594416.aspx
In this part, especially :
' Create a task activity to follow up with the account customer in 7 days.
Dim followup As New Entity("task")
followup("subject") = "Send e-mail to the new customer."
followup("description") = "Follow up with the customer. " _
& "Check if there are any new issues that need resolution."
followup("scheduledstart") = Date.Now.AddDays(7)
followup("scheduledend") = Date.Now.AddDays(7)
followup("category") = context.PrimaryEntityName
' Refer to the account in the task activity.
If context.OutputParameters.Contains("id") Then
Dim regardingobjectid As _
New Guid(context.OutputParameters("id").ToString())
Dim regardingobjectidType As String = "account"
followup("regardingobjectid") =
New EntityReference(regardingobjectidType,
regardingobjectid)
End If
' Obtain the organization service reference.
Dim serviceFactory As IOrganizationServiceFactory =
CType(serviceProvider.GetService(GetType(IOrganizationServiceFactory)),
IOrganizationServiceFactory)
Dim service As IOrganizationService =
serviceFactory.CreateOrganizationService(context.UserId)
' Create the task in Microsoft Dynamics CRM.
tracingService.Trace("FollowupPlugin: Creating the task activity.")
service.Create(followup)
Hope it helps.
Thanks.