AppointmentRequest Class
Applies To: Dynamics CRM 2015
Provides the details of an appointment request for the SearchRequest class.
Namespace: Microsoft.Crm.Sdk.Messages
Assembly: Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy.dll)
Inheritance Hierarchy
System.Object
Microsoft.Crm.Sdk.Messages.AppointmentRequest
Syntax
[DataContractAttribute(Namespace = "https://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class AppointmentRequest : IExtensibleDataObject
[DataContractAttribute(Namespace = "https://schemas.microsoft.com/crm/2011/Contracts")]
public ref class AppointmentRequest sealed : IExtensibleDataObject
[<Sealed>]
[<DataContractAttribute(Namespace = "https://schemas.microsoft.com/crm/2011/Contracts")>]
type AppointmentRequest =
class
interface IExtensibleDataObject
end
<DataContractAttribute(Namespace := "https://schemas.microsoft.com/crm/2011/Contracts")>
Public NotInheritable Class AppointmentRequest
Implements IExtensibleDataObject
Constructors
Name | Description | |
---|---|---|
AppointmentRequest() | Initializes a new instance of the AppointmentRequest class. |
Properties
Name | Description | |
---|---|---|
AnchorOffset | Gets or sets the time offset in minutes, from midnight, when the first occurrence of the appointment can take place. |
|
AppointmentsToIgnore | Gets or sets the appointments to ignore in the search for possible appointments. |
|
Constraints | Gets or sets any additional constraints. |
|
Direction | Gets or sets the direction of the search. |
|
Duration | Gets or sets the appointment duration, in minutes. |
|
ExtensionData | Gets or sets the structure that contains extra data. |
|
NumberOfResults | Gets or sets the number of results to be returned from the search request. |
|
Objectives | Gets or sets the scheduling strategy that overrides the default constraints. |
|
RecurrenceDuration | Gets or sets the time, in minutes, for which the appointment recurrence is valid. |
|
RecurrenceTimeZoneCode | Gets or sets a value to override the time zone that is specified by the UserTimeZoneCode property. |
|
RequiredResources | Gets or sets the resources that are needed for this appointment. |
|
SearchRecurrenceRule | Gets or sets the recurrence rule for appointment recurrence. |
|
SearchRecurrenceStart | Gets or sets the date and time for the first possible instance of the appointment. |
|
SearchWindowEnd | Gets or sets the date and time to end the search. |
|
SearchWindowStart | Gets or sets the date and time to begin the search. |
|
ServiceId | Gets or sets the ID of the service to search for. |
|
Sites | Gets or sets the sites where the requested appointment can take place. |
|
UserTimeZoneCode | Gets or sets the time zone code of the user who is requesting the appointment. |
Methods
Name | Description | |
---|---|---|
Equals(Object) | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetType() | (Inherited from Object.) |
|
ToString() | (Inherited from Object.) |
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.
// Create the van required resource object.
RequiredResource vanReq = new RequiredResource
{
ResourceId = _vanId,
ResourceSpecId = _specId
};
// Create the appointment request.
AppointmentRequest appointmentReq = new AppointmentRequest
{
RequiredResources = new RequiredResource[] { vanReq },
Direction = SearchDirection.Backward,
Duration = 60,
NumberOfResults = 10,
ServiceId = _plumberServiceId,
// The search window describes the time when the resouce can be scheduled.
// It must be set.
SearchWindowStart = DateTime.Now.ToUniversalTime(),
SearchWindowEnd = DateTime.Now.AddDays(7).ToUniversalTime(),
UserTimeZoneCode = 1
};
// Verify whether there are openings available to schedule the appointment using this resource
SearchRequest search = new SearchRequest
{
AppointmentRequest = appointmentReq
};
SearchResponse searched = (SearchResponse)_serviceProxy.Execute(search);
if (searched.SearchResults.Proposals.Length > 0)
{
Console.WriteLine("Openings are available to schedule the resource.");
}
' Create the van required resource object.
Dim vanReq As RequiredResource = New RequiredResource With {.ResourceId = _vanId, .ResourceSpecId = _specId}
' Create the appointment request.
Dim appointmentReq As AppointmentRequest = New AppointmentRequest With { _
.RequiredResources = New RequiredResource() {vanReq}, .Direction = SearchDirection.Backward, _
.Duration = 60, .NumberOfResults = 10, .ServiceId = _plumberServiceId, _
.SearchWindowStart = Date.Now.ToUniversalTime(), .SearchWindowEnd = Date.Now.AddDays(7).ToUniversalTime(), _
.UserTimeZoneCode = 1}
' The search window describes the time when the resouce can be scheduled.
' It must be set.
' Verify that the resources have been scheduled
Dim search As SearchRequest = New SearchRequest With {.AppointmentRequest = appointmentReq}
Dim searched As SearchResponse = CType(_serviceProxy.Execute(search), SearchResponse)
If searched.SearchResults.Proposals.Length > 0 Then
Console.WriteLine("Scheduled the resources sucessfully.")
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
SearchRequest
Microsoft.Crm.Sdk.Messages Namespace
Sample: Search for openings to schedule a resource
Return to top
© 2016 Microsoft. All rights reserved. Copyright