Condividi tramite


AppointmentRequest Class

Definition

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

public ref class AppointmentRequest sealed : System::Runtime::Serialization::IExtensibleDataObject
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class AppointmentRequest : System.Runtime.Serialization.IExtensibleDataObject
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type AppointmentRequest = class
    interface IExtensibleDataObject
Public NotInheritable Class AppointmentRequest
Implements IExtensibleDataObject
Inheritance
AppointmentRequest
Attributes
Implements

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

This example expects that you have a plumber service and a van resource with the specified ID values.

/// <summary>
/// Demonstrates the SearchRequest message with AppointmentRequest class
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
static void SearchRequestExample(IOrganizationService service) {

      // The ID of a plumber service
      Guid plumberServiceId = new("61f2e2cc-005b-4585-b19a-36d74d169a43");

      // Create the van required resource object.
      RequiredResource vanReq = new()
      {
         ResourceId = new Guid("27cad8ab-5e46-4b34-9159-436a7475ac36"),
         ResourceSpecId = new Guid("001f0221-14e4-48e3-9256-11943533aa7f")
      };

      // Create the appointment request.
      AppointmentRequest appointmentReq = new()
      {
         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
      };

      // Compose the request         
      SearchRequest request = new()
      {
         AppointmentRequest = appointmentReq
      };
      // Send the request
      var reponse = (SearchResponse)service.Execute(request);

      if (reponse.SearchResults.Proposals.Length > 0)
      {
         Console.WriteLine("Openings are available to schedule the resource.");
      }
}

Remarks

For the Web API the corresponding type is AppointmentRequest complex type.

Constructors

AppointmentRequest()

Initializes a new instance of the AppointmentRequest class.

Properties

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.

Applies to

See also