次の方法で共有


BookRequest Class

Definition

Contains the data that is needed to schedule or "book" an appointment, recurring appointment, or service appointment (service activity).

public ref class BookRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class BookRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type BookRequest = class
    inherit OrganizationRequest
Public NotInheritable Class BookRequest
Inherits OrganizationRequest
Inheritance
Attributes

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. For a complete sample, see Sample: Book an appointment

/// <summary>
/// Demonstrates the Book message
/// </summary>
/// <param name="service">The authenticated IOrganizationService instance</param>
static void BookExample(IOrganizationService service)
{
      // Get the current user information
      var userResponse = (WhoAmIResponse)service.Execute(new WhoAmIRequest());

      // Create the ActivityParty instance.
      Entity party = new("activityparty");
      party["partyid"] = new EntityReference("systemuser", userResponse.UserId);

      // Create the appointment instance.
      Entity appointment = new("appointment")
      {
         Attributes = {
            {"subject","Test Appointment" },
            {"description","Test Appointment created using the BookRequest Message." },
            {"scheduledstart", DateTime.Now.AddHours(1) },
            {"scheduledend", DateTime.Now.AddHours(2) },
            {"location","Office" },
            {"requiredattendees", new Entity[]{ party } },
            {"organizer", new Entity[]{ party } }
         }
      };

      // Use the Book request message.
      BookRequest request = new()
      {
         Target = appointment
      };
      var response = (BookResponse)service.Execute(request);

      Guid appointmentId = response.ValidationResult.ActivityId;

      // Verify that the appointment has been scheduled.
      if (appointmentId != Guid.Empty)
      {
         Console.WriteLine($"Successfully booked {appointment["subject"]}.");
      }
}

Remarks

For the Web API use the Book action.

Usage

Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of the BookResponse class.

Privileges and Access Rights

To perform this action, the caller must have privileges on the specified table and access rights on the specified record in the Target property. The following table lists the privileges the caller must have on specific tables:

Primary tablePrivilege
appointment prvSearchAvailability
appointment prvCreateActivity
appointment prvShareActivity
recurringappointmentmaster prvCreateActivity
recurringappointmentmaster prvShareActivity
recurringappointmentmaster prvSearchAvailability
serviceappointment prvSearchAvailability

Supported Tables

See Message support for tables for an example query you can use to get the list of tables you can use with the BookRequest message.

Constructors

BookRequest()

Initializes a new instance of the BookRequest Class.

Properties

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
ReturnNotifications

For internal use only.

Target

Gets or sets the record that is the target of the book operation. Required.

Applies to

See also