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

时间:2016-06-01 09:03:49

标签: asp.net dynamics-crm

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

我不知道如何返回这个值,任何人都可以帮助我

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();
}

1 个答案:

答案 0 :(得分:2)

如果您的optionset是全局选项集,则可以使用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();