Reference to be used – using Microsoft.Crm.Sdk.Messages;
var response = ((InsertStatusValueResponse)service.Execute
(
new InsertStatusValueRequest
{
AttributeLogicalName = “statuscode”,
EntityLogicalName = “task”,
Label = new Microsoft.Xrm.Sdk.Label(“Auto Closed”, 1033),
StateCode = 1 //Status: 0 active & 1 inactive
}
)).NewOptionValue;
Happy Coding 😊