次の方法で共有


DeleteOpenInstancesRequest クラス

適用対象: CRM 2015 on-prem, CRM Online

Contains the data that is needed to delete instances of a recurring appointment master that have an “Open” state.

名前空間: 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 DeleteOpenInstancesRequest
    Inherits OrganizationRequest
[DataContractAttribute(Namespace="https://schemas.microsoft.com/crm/2011/Contracts")] 
public sealed class DeleteOpenInstancesRequest : 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.


// Retrieve a recurring appointment series
RecurringAppointmentMaster retrievedRecurringAppointmentSeries = (RecurringAppointmentMaster)_serviceProxy.Retrieve(RecurringAppointmentMaster.EntityLogicalName, _recurringAppointmentMasterId, new ColumnSet(true));

// Use the DeleteOpenInstances message to end the series to the
// last occurring past instance date w.r.t. the series end date
// (i.e., 20 days from today). Effectively, that means that the 
// series will end after the third instance (day 14) as this
// instance is the last occuring past instance w.r.t the specified 
// series end date (20 days from today).
// Also specify that the state of past instances (w.r.t. the series 
// end date) be set to 'completed'.
DeleteOpenInstancesRequest endAppointmentSeries = new DeleteOpenInstancesRequest
{
    Target = retrievedRecurringAppointmentSeries,
    SeriesEndDate = DateTime.Today.AddDays(20),
    StateOfPastInstances = (int)AppointmentState.Completed
};
_serviceProxy.Execute(endAppointmentSeries);

Console.WriteLine("The recurring appointment series has been ended after the third occurrence.");

備考

Message Availability

このメッセージは、呼び出し元がサーバーに接続されているか、オフラインであるかに関係なく機能します。

Usage

Pass an instance of this class to the Execute method, which returns an instance of DeleteOpenInstancesResponse.

Privileges and Access Rights

To perform this action, the caller must have privileges on the entity specified in the Target property and access rights on the record specified in the Target property. For a list of the privileges required, see DeleteOpenInstances Privileges.

Notes for Callers

Using this message does the following:

  • Deletes all the “open” and “scheduled” future instances of the specified series from the date specified in the SeriesEndDate property. However, if the state of the future instances is changed to “completed” or “canceled”, they are not deleted.

  • Sets the status of the past instances to the specified value in the StateOfPastInstances property. However, the past instances are not deleted.

  • Terminates the series to the last occurring past instance date with respect to the date specified in the SeriesEndDate property, and sets the state of the series to “canceled”.

This allows you to preserve the instances of a recurring appointment series even if you have decided to end it prematurely. This is useful if you have attached notes or attachments to past instances of a recurring appointment series that contain important information about the customer or business.

継承階層

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

スレッド セーフ

この種類のパブリックな静的 (Visual Basic では Shared) メンバーはスレッド セーフです。インスタンス メンバーがスレッド セーフであることは保証されません。

プラットフォーム

開発プラットフォーム

Windows Vista、Windows Server 2003、および

対象プラットフォーム

Windows Vista、Windows XP

Change History

関連項目

参照

DeleteOpenInstancesRequest のメンバー
Microsoft.Crm.Sdk.Messages 名前空間

他のリソース

Delete or End a Recurring Appointment Series or Instance
RecurringAppointmentMaster Entity Messages and Methods
Sample: End a Recurring Appointment Series

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