locked
Manipulate records in CRM 2011 using SDK. RRS feed

  • Question

  • Hello people.

    Please give me a help with this code. 

    My code has: NET 4. Framework. 

    DLLS:

    Microsoft.Crm.Sdk.Proxy
    Microsoft.Crm.Sdk.Sdk
    Microsoft.Runtime.Serialization
    Microsoft.ServiceModel.

    I´m testing this code, which is OK. But I want to refer to:

    Account myaccount = new Account();   Instead of      Entity myAccount = new Entity("account");  

     

    Here the code:

     Uri organizationUri = new Uri("http://crmservername/orgname/XRMServices/2011/Organization.svc"); 

    Uri homeRealmUri = null; 

    ClientCredentials credentials = new ClientCredentials(); 

    // set default credentials for OrganizationService 

     credentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;   

    OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null); 

    IOrganizationService _service = (IOrganizationService)orgProxy; 

    try { 

         Entity myAccount = new Entity("account"); 

         myAccount["name"] = "Test Account"; 

         _service.Create(myAccount); 

     }   catch (Exception ex)   { 

         MessageBox.Show(ex.Message); 

     } 

     }

    THANKS in advanced!


    Roxana Cevallos Q. Microsoft CRM 4.0
    Friday, September 16, 2011 8:12 PM

Answers