Споделяне чрез


ValidateRequest Class

Definition

Contains the data that is needed to verify that an appointment or service appointment (service activity) has valid available resources for the activity, duration, and site, as appropriate.

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

Examples

The following example shows how to use this message. For this sample to work correctly, you must have an authenticated connection to the server with a client that implements the IOrganizationService interface instance.

/// <summary>
/// Validates an appointment
/// </summary>
/// <param name="service">Authenticated client implementing the IOrganizationService interface</param>
/// <param name="appointmentId">The id of the appointment to be validated.</param>
static void ValidateExample(IOrganizationService service, Guid appointmentId) {

    // Retrieve the appointment to be validated
    Entity retrievedAppointment = service.Retrieve(
        entityName: "appointment",
        id: appointmentId,
        columnSet: new ColumnSet("scheduledstart", "scheduledend", "statecode", "statuscode")
        );

    // Use the Validate message
    var request = new ValidateRequest {
        Activities = new EntityCollection
        {
            Entities = {
                { retrievedAppointment }
            },
            EntityName = "appointment"
        }
    };

    var response = (ValidateResponse)service.Execute(request);

    // Verify success
    response.Result.ToList().ForEach(appt => {
        Console.WriteLine($"ValidationSuccess:{appt.ValidationSuccess}");                
    });
}      

Remarks

For the Web API use the Validate action.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have access rights on the specified entities in the Activities property.

Each activity record in the Activities property must have a valid Guid value for Id.

Constructors

ValidateRequest()

Initializes a new instance of the ValidateRequest class.

Properties

Activities

Gets or sets the activities to validate.

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)
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)

Applies to

See also