ValidateRequest Class
Applies To: Microsoft Dynamics CRM 2013, Microsoft 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.
Namespace: Microsoft.Crm.Sdk.Messages
Assembly: Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy.dll)
Syntax
'Declaration
<DataContractAttribute(Namespace:="https://schemas.microsoft.com/crm/2011/Contracts")> _
Public NotInheritable Class ValidateRequest
Inherits OrganizationRequest
[DataContractAttribute(Namespace="https://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class ValidateRequest : OrganizationRequest
Example
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) && (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
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 Privileges.
Notes for Callers
Each activity record in the Activities property must have a valid Guid value for Id.
Inheritance Hierarchy
System.Object
Microsoft.Xrm.Sdk.OrganizationRequest
Microsoft.Crm.Sdk.Messages.ValidateRequest
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.
Platforms
Development Platforms
Windows Server 2008, Windows Server 2012, Windows 7 (All Versions), Windows 8 (All Versions)
Target Platforms
Windows Server 2008, ,Windows Server 2012, ,Windows 7 (All Versions),
Change History
See Also
Reference
ValidateRequest Members
Microsoft.Crm.Sdk.Messages Namespace
ValidateResponse
Other Resources
Sample: Validate an Appointment
ServiceAppointment Entity Messages and Methods
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.