다음을 통해 공유


AppointmentRequest Class

 

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

Provides the details of an appointment request for the AppointmentRequest class.

For the Web API the corresponding type is AppointmentRequest ComplexType.

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 NotInheritable Class AppointmentRequest
    Implements IExtensibleDataObject

Constructors

Name Description
System_CAPS_pubmethod AppointmentRequest()

Initializes a new instance of the AppointmentRequest class.

Properties

Name Description
System_CAPS_pubproperty AnchorOffset

Gets or sets the time offset in minutes, from midnight, when the first occurrence of the appointment can take place.

System_CAPS_pubproperty AppointmentsToIgnore

Gets or sets the appointments to ignore in the search for possible appointments.

System_CAPS_pubproperty Constraints

Gets or sets any additional constraints.

System_CAPS_pubproperty Direction

Gets or sets the direction of the search.

System_CAPS_pubproperty Duration

Gets or sets the appointment duration, in minutes.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data.

System_CAPS_pubproperty NumberOfResults

Gets or sets the number of results to be returned from the search request.

System_CAPS_pubproperty Objectives

Gets or sets the scheduling strategy that overrides the default constraints.

System_CAPS_pubproperty RecurrenceDuration

Gets or sets the time, in minutes, for which the appointment recurrence is valid.

System_CAPS_pubproperty RecurrenceTimeZoneCode

Gets or sets a value to override the time zone that is specified by the UserTimeZoneCode property.

System_CAPS_pubproperty RequiredResources

Gets or sets the resources that are needed for this appointment.

System_CAPS_pubproperty SearchRecurrenceRule

Gets or sets the recurrence rule for appointment recurrence.

System_CAPS_pubproperty SearchRecurrenceStart

Gets or sets the date and time for the first possible instance of the appointment.

System_CAPS_pubproperty SearchWindowEnd

Gets or sets the date and time to end the search.

System_CAPS_pubproperty SearchWindowStart

Gets or sets the date and time to begin the search.

System_CAPS_pubproperty ServiceId

Gets or sets the ID of the service to search for.

System_CAPS_pubproperty Sites

Gets or sets the sites where the requested appointment can take place.

System_CAPS_pubproperty UserTimeZoneCode

Gets or sets the time zone code of the user who is requesting the appointment.

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

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

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright