我在 asp.net 中添加了一个列表框,我需要从 ms crm 获取选项设置值到列表框

i added a list box in asp.net , i need to get the option set values from ms crm to list box

我是新手 ASP.Net 我在 asp.net 中添加了一个列表框,我需要从 ms crm 获取选项设置值到列表框

我不知道如何 return 这个值 谁能帮我

public static string GetMtefrecord()
{ 
    var service = CRMWrapper.GetCRMService();

    RetrieveEntityRequest retrieveBankAccountEntityRequest = new RetrieveEntityRequest
    {
        EntityFilters = EntityFilters.Entity,
        LogicalName = "tec_new_mtfmtir",
    };
    RetrieveEntityResponse retrieveBankAccountEntityResponse = (RetrieveEntityResponse)service.Execute(retrieveBankAccountEntityRequest);
    //return retrieveBankAccountEntityResponse.LogicalName.ToString();
}

如果您的选项集是全局选项集,您可以使用 RetrieveOptionSetRequest 消息检索它。这是一些示例代码

RetrieveOptionSetRequest retrieveOptionSetRequest =
new RetrieveOptionSetRequest
{
    Name = _globalOptionSetName //Put your optionsetname here
};

// Execute the request.
RetrieveOptionSetResponse retrieveOptionSetResponse =
    (RetrieveOptionSetResponse)_serviceProxy.Execute(
    retrieveOptionSetRequest);

OptionMetadata[] optionList =
     ((OptionSetMetadata) retrieveOptionSetResponse.OptionSetMetadata).Options.ToArray();