如何向 InsertOptionValueRequest 提供状态

How to provide a state to InsertOptionValueRequest

尝试使用 InsertOptionValueRequest 定义 statuscode 自定义值时,我收到以下消息:

When creating a new status value, you must provide what state value that status is associated with

我目前拥有的是:

var response = orgContext.Execute(new InsertOptionValueRequest
{
    AttributeLogicalName = "statuscode",
    EntityLogicalName = "op_employeragreement",
    Label = new Label("Under review", 1033),
    Value = 2
});

我应该如何提供关联的 state?这些是 class 属性(取自 Microsoft.Xrm.Sdk.dll, v7.0.0.0 (CRM 2015):

namespace Microsoft.Xrm.Sdk.Messages
{
    [DataContract(Namespace = "http://schemas.microsoft.com/xrm/2011/Contracts")]
    public sealed class InsertOptionValueRequest : OrganizationRequest
    {
        public InsertOptionValueRequest();

        public string AttributeLogicalName { get; set; }
        public Label Description { get; set; }
        public string EntityLogicalName { get; set; }
        public Label Label { get; set; }
        public string OptionSetName { get; set; }
        public string SolutionUniqueName { get; set; }
        public int? Value { get; set; }
    }
}

如您所见,它不包含 State 属性。

很确定你用错了东西; InsertOptionValueRequest 用于选项集(选择列表)。状态选择器不属于类别。

我想你想使用 InsertStatusValueRequest,请参阅 here