Поделиться через


InsertStatusValueRequest Class

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Contains the data that is needed to insert a new option into a StatusAttributeMetadata attribute.

For the Web API use the InsertStatusValue Action.

Namespace:   Microsoft.Xrm.Sdk.Messages
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Inheritance Hierarchy

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

Syntax

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

Constructors

Name Description
System_CAPS_pubmethod InsertStatusValueRequest()

Initializes a new instance of the InsertStatusValueRequest class

Properties

Name Description
System_CAPS_pubproperty AttributeLogicalName

Gets or sets the logical name of the status attribute. Optional.

System_CAPS_pubproperty Description

Gets or sets a description for the option. Optional.

System_CAPS_pubproperty EntityLogicalName

Gets or sets the logical name of the entity that contains the attribute. Optional.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data. Optional.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Item[String]

Gets or sets the indexer for the Parameters collection.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Label

Gets or sets the label for the new status. Required.

System_CAPS_pubproperty OptionSetName

Reserved for future use. Optional.

System_CAPS_pubproperty Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestId

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

System_CAPS_pubproperty RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty SolutionUniqueName

Gets or sets the solution that this attribute should be added to. Optional.

System_CAPS_pubproperty StateCode

Gets or sets the state code for the new status. Required.

System_CAPS_pubproperty Value

Gets or sets the value for the new status. Optional.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

Message Availability

For this message to work, the caller must be connected to the server.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have privileges listed in InsertStatusValue message privileges.

Notes for Callers

Examples

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.


// Use InsertStatusValueRequest message to insert a new status 
// in an existing status attribute. 
// Create the request.
InsertStatusValueRequest insertStatusValueRequest =
    new InsertStatusValueRequest
{
    AttributeLogicalName = "statuscode",
    EntityLogicalName = Contact.EntityLogicalName,
    Label = new Label("Dormant", _languageCode),
    StateCode = 0
};

// Execute the request and store newly inserted value 
// for cleanup, used later part of this sample. 
_insertedStatusValue = ((InsertStatusValueResponse)_serviceProxy.Execute(
    insertStatusValueRequest)).NewOptionValue;

Console.WriteLine("Created {0} with the value of {1}.",
    insertStatusValueRequest.Label.LocalizedLabels[0].Label,
    _insertedStatusValue);

' Use InsertStatusValueRequest message to insert a new status 
' in an existing status attribute. 
' Create the request.
Dim insertStatusValueRequest As InsertStatusValueRequest = New InsertStatusValueRequest With {
 .AttributeLogicalName = "statuscode",
 .EntityLogicalName = Contact.EntityLogicalName,
 .Label = New Label("Dormant", _languageCode),
 .StateCode = 0}

' Execute the request and store newly inserted value 
' for cleanup, used later part of this sample. 
_insertedStatusValue = (CType(_serviceProxy.Execute(insertStatusValueRequest), InsertStatusValueResponse)).NewOptionValue

Console.WriteLine("Created {0} with the value of {1}.", insertStatusValueRequest.Label.LocalizedLabels(0).Label, _insertedStatusValue)

Thread Safety

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.Xrm.Sdk.Messages Namespace
Sample: Work with attribute metadata
Customize entity attribute metadata
Entity attribute metadata messages

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright