次の方法で共有


WinOpportunityRequest Class

Definition

Contains the data that is needed to set the state of an opportunity to Won.

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

Examples

The following example shows how to use this message. For this sample to work correctly, you must have an authenticated connection to the server with a client that implements the IOrganizationService interface instance.

/// <summary>
/// Closes an Opportunity as Won
/// </summary>
/// <param name="service">Authenticated client implementing the IOrganizationService interface</param>
/// <param name="opportunityId">The id of the open opportunity to close as won</param>
static void WinOpportunityExample(IOrganizationService service, Guid opportunityId) {

    var request = new WinOpportunityRequest
    {
        OpportunityClose = new Entity("opportunityclose")
        {
            Attributes = {
                {"opportunityid", new EntityReference
                ("opportunity", opportunityId) }
                // Add additional opportunityclose column 
                // data to provide more details.
            }
        },
        // Won is the default and only status.
        // Custom opportunity status options
        // can be created that also represent different types
        // of win.
        Status = new OptionSetValue(3) //Won
    };

    service.Execute(request);
}    

Remarks

This class supports a message that is part of the Dynamics 365 for Sales solution. That solution must be installed to use this message.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have privileges on the Opportunity entity.

Constructors

WinOpportunityRequest()

Initializes a new instance of the WinOpportunityRequest 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)
OpportunityClose

Gets or sets the opportunity close activity associated with this state change. Required.

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)
Status

Gets or sets a new status of the opportunity. Required.

Applies to

See also