AddRecurrenceRequest AddRecurrenceRequest AddRecurrenceRequest AddRecurrenceRequest Class

Definition

Contains the data that is needed to add recurrence information to an existing appointment.

For the Web API use the AddRecurrence Action.

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

Examples


// Specify the recurrence information that needs to be added to the
// existing appointment.
// 1.  Define an anonymous type to define the possible recurrence pattern values.
     
var RecurrencePatternTypes = new
  {
    Daily = 0,
    Weekly = 1,
    Monthly = 2,
    Yearly = 3
};

// 2.  Define an anonymous type to define the possible values for days 
// of the week

 var DayOfWeek = new
{
    Sunday = 0x01,
    Monday = 0x02,
    Tuesday = 0x04,
    Wednesday = 0x08,
    Thursday = 0x10,
    Friday = 0x20,
    Saturday = 0x40
};

// 3.  Define an anonymous type to define the possible values  
// for the recurrence rule pattern end type.

var RecurrenceRulePatternEndType = new
{
    NoEndDate = 1,
    Occurrences = 2,
    PatternEndDate = 3
};

// 4.  Finally, use a recurring appointment master object to specify
//     the recurrence information. Other appointment details such as
//     'subject' and 'location' are copied from the existing appointment
//     to the recurring appointment master object.
 
 var newRecurringAppointmentInfo = new RecurringAppointmentMaster
    {
        StartTime = DateTime.Now.AddHours(2),
        EndTime = DateTime.Now.AddHours(3),
        RecurrencePatternType = new OptionSetValue(RecurrencePatternTypes.Weekly),
        Interval = 1,
        DaysOfWeekMask = DayOfWeek.Thursday,
        PatternStartDate = DateTime.Today,
        PatternEndType = new OptionSetValue(RecurrenceRulePatternEndType.Occurrences),
        Occurrences = 5
    };

// Use the AddRecurrence message to convert the existing appointment
// object to a recurring appointment master object. The existing
// appointment object is deleted thereafter.

var recurringInfoRequest = new AddRecurrenceRequest
{
    Target = newRecurringAppointmentInfo,
    AppointmentId = _appointmentId
};

    var recurringInfoResponse = (AddRecurrenceResponse)svc.Execute(recurringInfoRequest);
__recurringAppointmentMasterId = recurringInfoResponse.id;

// Verify that the newly created recurring appointment master has same 'subject' 
// as the existing appointment.
    RecurringAppointmentMaster retrievedMasterAppointment = (RecurringAppointmentMaster)svc.Retrieve(RecurringAppointmentMaster.EntityLogicalName, __recurringAppointmentMasterId, new ColumnSet(true));

if (retrievedMasterAppointment.Subject == "Sample Appointment")
{
    Console.WriteLine("Sample Appointment is converted to a recurring appointment.");
}

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.

ScheduleAndAppointment#ConvertAnAppointmenttoRecurringAppointment1

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(OrganizationRequest) method, which returns an instance of the AddRecurrenceResponse class.

Privileges and Access Rights

To perform this action, the caller must have privileges on the RecurringAppointmentMaster and Appointment entities, and access rights on the specified record in the Target property. For a complete list of the required privileges, see AddRecurrence message privileges.

Notes for Callers

When you convert an existing appointment to a recurring appointment by using this message, the data from the existing appointment is copied to a new recurring appointment master instance, and the existing appointment record is deleted.

Constructors

AddRecurrenceRequest() AddRecurrenceRequest() AddRecurrenceRequest() AddRecurrenceRequest()

Initializes a new instance of the AddRecurrenceRequest class.

Properties

AppointmentId AppointmentId AppointmentId AppointmentId

Gets or sets the ID of the appointment that needs to be converted into a recurring appointment. Required.

ExtensionData ExtensionData ExtensionData ExtensionData

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

(Inherited from OrganizationRequest)
Item[String] Item[String] Item[String] Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters Parameters Parameters Parameters

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

(Inherited from OrganizationRequest)
RequestId RequestId RequestId RequestId

Gets or sets the ID of an asynchronous operation (system job). Optional.

(Inherited from OrganizationRequest)
RequestName RequestName RequestName RequestName

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

(Inherited from OrganizationRequest)
Target Target Target Target

Gets or sets the target, which is a recurring appointment master record to which the appointment is converted. Required.

Applies to

See also