Condividi tramite


AddToQueueRequest Class

Definition

Contains the data that is needed to move an entity record from a source queue to a destination queue.

public ref class AddToQueueRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class AddToQueueRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type AddToQueueRequest = class
    inherit OrganizationRequest
Public NotInheritable Class AddToQueueRequest
Inherits OrganizationRequest
Inheritance
AddToQueueRequest
Attributes

Examples

The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface instance.

/// <summary>
/// Demonstrates adding an item to a queue
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
/// <param name="letterId">The ID of a letter activity to add to the destination queue</param>
/// <param name="destinationQueueId">The ID of the queue to add the letter to.</param>
static void AddToQueueExample(IOrganizationService service,
      Guid letterId,
      Guid destinationQueueId)
{
      // Compose the request
      AddToQueueRequest request = new()
      {
         Target = new EntityReference("letter", letterId),
         DestinationQueueId = destinationQueueId
      };

      // Send the Request
   var response = (AddToQueueResponse)service.Execute(request);

      //The ID of the queue item created in the destination queue
      Console.WriteLine($"QueueItemId: {response.QueueItemId}");
}

Remarks

For the Web API use the AddToQueue action.

Usage

Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of the AddToQueueResponse class.

Privileges and Access Rights

To perform this action, the caller must have privileges on the Queue and QueueItem tables and on the entity that is referred to in the Target property. You must also have access rights on the source and destination queue records and on the specified record in the Target property.

Notes for Callers

Specifying the SourceQueueId property is optional. If the record that is specified by the Target property is not in a queue, it is added to the destination queue. If the record is already in a queue, it is moved from the queue to the destination queue. The records cannot be added to multiple queues, except for email records that have the status Received. However, a Received email record cannot be added multiple times to the same queue.

Specifying the QueueItemProperties property is optional. The minimally required data for creating a queue item is provided in the DestinationQueueId and Target properties. However, if you want to include additional data, such as who works on the case (QueueItem.WorkerId), or to add custom fields, you have to use the QueueItemProperties property.

Constructors

AddToQueueRequest()

Initializes a new instance of the AddToQueueRequest class.

Properties

DestinationQueueId

Gets or sets the ID of the destination queue. Required.

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
QueueItemProperties

Gets or sets the properties that are needed to create a queue item in the destination queue. Optional.

RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
SourceQueueId

Gets or sets the ID of the source queue. Optional.

Target

Gets or sets the target record to add to the destination queue. Required.

Applies to

See also