Domanda

I developed a Custom application that is able to consume the CRM Web services and perform Windows Live Id authentication, create, read and update operation in the CRM from the custom .NET page.I am able to retrieve data from the Accounts from the CRM using the following code:

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

Similarly, I want to retrieve data from a custom entity created by me in the CRM online,But I am unable to find a way to do that.

Can anyone please help me with it?

È stato utile?

Soluzione

Use Early bound entities. You should generate classes and include in your project. Than you will be able to work with your custom entities.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top