我开发了一个自定义应用程序,它能够使用CRM Web服务并从自定义.NET页面在CRM中执行Windows Live Id身份验证,创建,读取和更新操作。我能够从帐户中检索数据CRM使用以下代码:
public ArrayList GetAccounts(Microsoft.Crm.Sdk.Samples.ServerConnection.Configuration serverconfig)
{
try
{
using (_serviceProxy = Microsoft.Crm.Sdk.Samples.ServerConnection.GetOrganizationProxy(serverconfig))
{
_serviceProxy.EnableProxyTypes();
_service = (IOrganizationService)_serviceProxy;
ServiceContext svcContext = new ServiceContext(_service);
var accounts = from a in svcContext.AccountSet
select new Account
{
Name = a.Name,
EMailAddress1 = a.EMailAddress1,
Address1_City = a.Address1_City,
Address1_Country = a.Address1_Country,
Address1_Latitude = a.Address1_Latitude,
Address1_Longitude = a.Address1_Longitude,
AccountId=a.AccountId
};
foreach (var a in accounts)
{
en_names.Add(a.Name);
lat.Add(a.Address1_Latitude);
lon.Add(a.Address1_Longitude);
info1.Add(a.EMailAddress1);
info2.Add(a.Address1_City);
info3.Add(a.Address1_Country);
id.Add(a.AccountId);
}
en_det.Add(en_names);
en_det.Add(lat);
en_det.Add(lon);
en_det.Add(info1);
en_det.Add(info2);
en_det.Add(info3);
en_det.Add(id);
return en_det;
}
}
catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
{
throw;
}
}
同样,我想从CRM在线创建的自定义实体中检索数据,但我无法找到方法。
有人可以帮我吗?