AddRecurrenceRequest 类

应用到: CRM 2015 on-prem, CRM Online

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

命名空间: Microsoft.Crm.Sdk.Messages
程序集: Microsoft.Crm.Sdk.Proxy (在 Microsoft.Crm.Sdk.Proxy.dll 中)

语法

声明
<DataContractAttribute(Namespace:="https://schemas.microsoft.com/crm/2011/Contracts")> _
Public NotInheritable Class AddRecurrenceRequest
    Inherits OrganizationRequest
[DataContractAttribute(Namespace="https://schemas.microsoft.com/crm/2011/Contracts")] 
public sealed class AddRecurrenceRequest : OrganizationRequest

示例

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.


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

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

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

AddRecurrenceResponse recurringInfoResponse = (AddRecurrenceResponse)_serviceProxy.Execute(recurringInfoRequest);
__recurringAppointmentMasterId = recurringInfoResponse.id;

// Verify that the newly created recurring appointment master has same 'subject' 
// as the existing appointment.

RecurringAppointmentMaster retrievedMasterAppointment = (RecurringAppointmentMaster)_serviceProxy.Retrieve(RecurringAppointmentMaster.EntityLogicalName, __recurringAppointmentMasterId, new ColumnSet(true));
if (retrievedMasterAppointment.Subject == "Sample Appointment")
{
    Console.WriteLine("Sample Appointment is converted to a recurring appointment.");
}

备注

Message Availability

无论调用方是连接到服务器还是处于脱机状态,此消息都可正常工作。

Usage

Pass an instance of this class to the Execute 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 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.

继承层次结构

System.Object
   Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Crm.Sdk.Messages.AddRecurrenceRequest

线程安全性

此类型的所有公共静态(Visual Basic 中的 Shared)成员都是线程安全成员。不保证任何实例成员是线程安全成员。

平台

开发平台

Windows Vista、Windows Server 2003 和

目标平台

Windows Vista,Windows XP

Change History

另请参阅

参考

AddRecurrenceRequest 成员
Microsoft.Crm.Sdk.Messages 命名空间
AddRecurrenceResponse

其他资源

Create a Recurring Appointment Series, Instance or Exception
RecurringAppointmentMaster Entity Messages and Methods
AddRecurrence Privileges
Sample: Convert an Appointment to a Recurring Appointment

Send comments about this topic to Microsoft.
© 2014 Microsoft Corporation. All rights reserved.