CrmCalloutBase.PreAssign Method

banner art

Specifies a method called before an assign operation.

Syntax

[Visual Basic .NET]
Overridable Public Function PreAssign(
  ByVal userContext As CalloutUserContext,
  ByVal entityContext As CalloutEntityContext,
  ByVal assignedToId As Guid,
  ByRef errorMessage As String
) As PreCalloutReturnValue

[C#]
public virtual PreCalloutReturnValue PreAssign(
  CalloutUserContext  userContext,
  CalloutEntityContext  entityContext,
  Guid  assignedToId,
  ref string  errorMessage
);
[JScript]
public virtual function PreAssign(
  userContext : CalloutUserContext,
  entityContext : CalloutEntityContext,
  assignedToId : Guid,
  errorMessage : String
) : PreCalloutReturnValue;

Parameters

userContext

Contains information about the user who is performing the assign operation. See CalloutUserContext.

entityContext

Contains information about the entity being assigned. See CalloutEntityContext.

assignedToId

The GUID of the user that the entity is to be assigned to.

errorMessage

[ref] A string that contains the error message to be returned to the application. The error message string should not exceed 1,500 characters in length.

Return Value

Returns a PreCalloutReturnValue type that specifies what action to take after this method completes.

Example

The following code example shows how to log an object assignment using a pre-callout.

public override PreCalloutReturnValue PreAssign(CalloutUserContext userContext
                     CalloutEntityContext entityContext,
                     Guid assignedToId,
                     ref string errorMessage)
{
   TextWriter log = TextWriter.Synchronized(
     File.AppendText(@"C:\CRM_SDK_Drop\Assign.txt"));
   log.WriteLine("PreAssign");
   log.WriteLine("ObjectType: " +
     entityContext.EntityTypeCode.ToString());
   log.WriteLine("ObjectId: " + entityContext.InstanceId.ToString());
   log.WriteLine("CreatorId: " + userContext.UserId.ToString());
   log.WriteLine();
   log.Close();

   return PreCalloutReturnValue.Continue;
}

Requirements

Namespace: Microsoft.Crm.Callout

Assembly: microsoft.crm.platform.callout.base.dll

See Also

© 2007 Microsoft Corporation. All rights reserved.