ValidateRequest Class

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

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.

For the Web API use the Validate Action.

Namespace:   Microsoft.Crm.Sdk.Messages
Assembly:  Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy.dll)

Inheritance Hierarchy

System.Object
  Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Crm.Sdk.Messages.ValidateRequest

Syntax

[DataContractAttribute(Namespace = "http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class ValidateRequest : OrganizationRequest
<DataContractAttribute(Namespace := "http://schemas.microsoft.com/crm/2011/Contracts")>
Public NotInheritable Class ValidateRequest
    Inherits OrganizationRequest

Constructors

Name Description
System_CAPS_pubmethod ValidateRequest()

Initializes a new instance of the ValidateRequest class.

Properties

Name Description
System_CAPS_pubproperty Activities

Gets or sets the activities to validate.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data. Optional.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Item[String]

Gets or sets the indexer for the Parameters collection.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestId

Gets or sets the ID of an asynchronous operation (system job). Optional. (Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

Message Availability

This message works regardless whether the caller is connected to the server or offline.

Usage

Pass an instance of this class to the Execute 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. For a list of the required privileges for this message, see Validate message privileges.

For the Web API use the RenewContract Action.

For the Web API use the RenewContract Action.

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

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. For the complete sample, see the link later in this topic.



// Retrieve the appointment to be validated
ColumnSet cols = new ColumnSet("scheduledstart", "scheduledend", "statecode", "statuscode");
Appointment retrievedAppointment = (Appointment)_serviceProxy.Retrieve(Appointment.EntityLogicalName,
                                           _appointmentId, cols);

// Use the Validate message
ValidateRequest validatedReq = new ValidateRequest();
validatedReq.Activities = new EntityCollection();
validatedReq.Activities.Entities.Add(retrievedAppointment);
validatedReq.Activities.MoreRecords = false;
validatedReq.Activities.PagingCookie = "";
validatedReq.Activities.EntityName = Appointment.EntityLogicalName;

ValidateResponse validateResp = (ValidateResponse)_serviceProxy.Execute(validatedReq);

// Verify success
if ((validateResp.Result != null) &amp;&amp; (validateResp.Result.Length > 0))
{
    Console.WriteLine("Validated the appointment.");                        
}


' Retrieve the appointment to be validated
Dim cols As New ColumnSet("scheduledstart", "scheduledend", "statecode", "statuscode")
Dim retrievedAppointment As Appointment = _
    CType(_serviceProxy.Retrieve(Appointment.EntityLogicalName, _appointmentId, cols), Appointment)

' Use the Validate message
Dim validatedReq As New ValidateRequest()
validatedReq.Activities = New EntityCollection()
validatedReq.Activities.Entities.Add(retrievedAppointment)
validatedReq.Activities.MoreRecords = False
validatedReq.Activities.PagingCookie = ""
validatedReq.Activities.EntityName = Appointment.EntityLogicalName

Dim validateResp As ValidateResponse = CType(_serviceProxy.Execute(validatedReq), ValidateResponse)

' Verify success
If (validateResp.Result IsNot Nothing) AndAlso (validateResp.Result.Length > 0) Then
    Console.WriteLine("Validated the appointment.")
End If

Thread Safety

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

ValidateResponse
Microsoft.Crm.Sdk.Messages Namespace
Sample: Validate an appointment
ServiceAppointment entity messages and methods

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright