Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Con risposta Help in SDK code

  • giovedì 11 settembre 2008 07:28
     
     

    Hi,

    I'm trying to use this SDK sample code in order to use create and retrieve methods.

    // Set up the CRM Service.
    CrmAuthenticationToken token = new CrmAuthenticationToken();
    token.AuthenticationType = 0; 
    token.OrganizationName = "AdventureWorksCycle";
     
    CrmService service = new CrmService();
    service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
    service.CrmAuthenticationTokenValue = token;
    service.Credentials = System.Net.CredentialCache.DefaultCredentials;
    
    // Create an account entity and assign data to some attributes.
    account newAccount = new account();
    newAccount.name = "Greg Bike Store";
    newAccount.accountnumber = "123456";
    newAccount.address1_postalcode = "98052";
    newAccount.address1_city = "Redmond";
    
    // Call the Create method to create an account.
    Guid accountId = service.Create(newAccount);
    
    Guid contactId = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");
    
    // Call the Retrieve method to retrieve an existing contact.
    ColumnSet myColumnSet = new ColumnSet();
    myColumnSet.Attributes = new string[] { "firstname" };
    contact myContact = (contact) service.Retrieve ("contact", contactId, myColumnSet)

    But it's missing the using part.

    I need to know what classes should i add in the using part?

    Thanks you

Tutte le risposte

  • giovedì 11 settembre 2008 08:23
     
     Con risposta

    Create a web reference to CrmService called CrmSdk and add the following using statement

    using <MyApplicationName>.CrmSdk;