次の方法で共有


ExecuteMultipleRequest クラス

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

Contains the data that is needed to execute one or more message requests as a single batch operation, and optionally return a collection of results.

名前空間: Microsoft.Xrm.Sdk.Messages
アセンブリ: Microsoft.Xrm.Sdk (Microsoft.Xrm.Sdk.dll に含まれる)

構文

'宣言
<DataContractAttribute(Namespace:="https://schemas.microsoft.com/xrm/2011/Contracts")> _
Public NotInheritable Class ExecuteMultipleRequest
    Inherits OrganizationRequest
[DataContractAttribute(Namespace="https://schemas.microsoft.com/xrm/2011/Contracts")] 
public sealed class ExecuteMultipleRequest : OrganizationRequest

The following sample shows how to execute the ExecuteMultipleRequest message.

// Get a reference to the organization service.
using (_serviceProxy = new OrganizationServiceProxy(serverConfig.OrganizationUri, serverConfig.HomeRealmUri,serverConfig.Credentials, serverConfig.DeviceCredentials))
{
    // Enable early-bound type support to add/update entity records required for this sample.
    _serviceProxy.EnableProxyTypes();
    
    #region Execute Multiple with Results
    // Create an ExecuteMultipleRequest object.
    requestWithResults = new ExecuteMultipleRequest()
    {
        // Assign settings that define execution behavior: continue on error, return responses. 
        Settings = new ExecuteMultipleSettings()
        {
            ContinueOnError = false,
            ReturnResponses = true
        },
        // Create an empty organization request collection.
        Requests = new OrganizationRequestCollection()
    };

    // Create several (local, in memory) entities in a collection. 
    EntityCollection input = GetCollectionOfEntitiesToCreate();

    // Add a CreateRequest for each entity to the request collection.
    foreach (var entity in input.Entities)
    {
        CreateRequest createRequest = new CreateRequest { Target = entity };
        requestWithResults.Requests.Add(createRequest);
    }

    // Execute all the requests in the request collection using a single web method call.
    ExecuteMultipleResponse responseWithResults =
        (ExecuteMultipleResponse)_serviceProxy.Execute(requestWithResults);

    // Display the results returned in the responses.
    foreach (var responseItem in responseWithResults.Responses)
    {
        // A valid response.
        if (responseItem.Response != null)
            DisplayResponse(requestWithResults.Requests[responseItem.RequestIndex], responseItem.Response);

        // An error has occurred.
        else if (responseItem.Fault != null)
            DisplayFault(requestWithResults.Requests[responseItem.RequestIndex], 
                responseItem.RequestIndex, responseItem.Fault);
    }

備考

Message Availability

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

Usage

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

Privileges and Access Rights

There are no specific privileges required for this request. Refer to the required privileges and access rights of each message request you add to the Requests collection. Refer to Privileges by Message.

Notes for Callers

CallerId is honored for each message request. See the related topics for throttling limitations.

継承階層

System.Object
   Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Xrm.Sdk.Messages.ExecuteMultipleRequest

スレッド セーフ

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

プラットフォーム

開発プラットフォーム

Windows Vista、Windows Server 2003、および

対象プラットフォーム

Windows Vista、Windows XP

Change History

関連項目

参照

ExecuteMultipleRequest のメンバー
Microsoft.Xrm.Sdk.Messages 名前空間
ExecuteMultipleSettings クラス
ThrottleSettings.ExecuteMultiplePerOrgMaxConnectionsPerServer プロパティ
ThrottleSettings.ExecuteMultipleMaxConnectionsPerServer プロパティ

他のリソース

Use Messages (Request and Response Classes) with the Execute Method
Sample: Execute Multiple Requests

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