CreateOptionSetRequest Class
Applies To: Dynamics CRM 2015
Contains the data that is needed to create a new global option set.
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.CreateOptionSetRequest
Syntax
[DataContractAttribute(Namespace = "https://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class CreateOptionSetRequest : OrganizationRequest
[DataContractAttribute(Namespace = "https://schemas.microsoft.com/xrm/2011/Contracts")]
public ref class CreateOptionSetRequest sealed : OrganizationRequest
[<Sealed>]
[<DataContractAttribute(Namespace = "https://schemas.microsoft.com/xrm/2011/Contracts")>]
type CreateOptionSetRequest =
class
inherit OrganizationRequest
end
<DataContractAttribute(Namespace := "https://schemas.microsoft.com/xrm/2011/Contracts")>
Public NotInheritable Class CreateOptionSetRequest
Inherits OrganizationRequest
Constructors
Name | Description | |
---|---|---|
CreateOptionSetRequest() | Initializes a new instance of the CreateOptionSetRequest class. |
Properties
Name | Description | |
---|---|---|
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.) |
|
OptionSet | Gets or sets the definition of the global option set. 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 an asynchronous operation (system job). Optional. (Inherited from OrganizationRequest.) |
|
RequestName | Gets or sets the name of the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.) |
|
SolutionUniqueName | Gets or sets the name of the unmanaged solution you want to add this global option set to. Optional. |
Methods
Name | Description | |
---|---|---|
Equals(Object) | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetType() | (Inherited from Object.) |
|
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 CreateOptionSetResponse.
Privileges and Access Rights
To perform this action, the caller must have privileges listed in CreateOptionSet 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.
#region How to create global option set
// Define the request object and pass to the service.
CreateOptionSetRequest createOptionSetRequest = new CreateOptionSetRequest
{
// Create a global option set (OptionSetMetadata).
OptionSet = new OptionSetMetadata
{
Name = _globalOptionSetName,
DisplayName = new Label("Example Option Set", _languageCode),
IsGlobal = true,
OptionSetType = OptionSetType.Picklist,
Options =
{
new OptionMetadata(new Label("Open", _languageCode), null),
new OptionMetadata(new Label("Suspended", _languageCode), null),
new OptionMetadata(new Label("Cancelled", _languageCode), null),
new OptionMetadata(new Label("Closed", _languageCode), null)
}
}
};
// Execute the request.
CreateOptionSetResponse optionsResp =
(CreateOptionSetResponse)_serviceProxy.Execute(createOptionSetRequest);
' #Region "How to create global option set"
' Define the request object and pass to the service.
Dim createOptionSetRequest As CreateOptionSetRequest = New CreateOptionSetRequest()
Dim createOptionSetOptionSet As OptionSetMetadata = New OptionSetMetadata() With {
.Name = _globalOptionSetName,
.DisplayName = New Label("Example Option Set", _languageCode),
.IsGlobal = True,
.OptionSetType = OptionSetType.Picklist
}
createOptionSetOptionSet.Options.AddRange(
{
New OptionMetadata(New Label("Open", _languageCode), Nothing),
New OptionMetadata(New Label("Suspended", _languageCode), Nothing),
New OptionMetadata(New Label("Cancelled", _languageCode), Nothing),
New OptionMetadata(New Label("Closed", _languageCode), Nothing)
}
)
createOptionSetRequest.OptionSet = createOptionSetOptionSet
' Create a global option set (OptionSetMetadata).
' Execute the request.
Dim optionsResp As CreateOptionSetResponse =
CType(_serviceProxy.Execute(createOptionSetRequest), CreateOptionSetResponse)
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: Create a global option set
Customize global option sets
Return to top
© 2016 Microsoft. All rights reserved. Copyright