locked
Use of "GetCrmService" RRS feed

  • Question

  • Hi!

    I have the problem that I can't find the GetCrmService method. It seems to be included in "microsoft.crm.tools.emailproviders". I added a reference to this dll in my project and added "using Microsoft.Crm.Tools;" in my project. But still can't use the GetCrmService, it is marked as unknown.

    What I did ad was the WSDL version of the CrmService (as Web service reference). This worked fine and I can use it.

    Thanks in advance
    CSN22

    Friday, June 18, 2010 9:38 AM

Answers

  • Hi,

    IF you are talking about ms crmwebservice,There is no GetCrmService method in crm webservice,

    but you can create this function to create ms crm service object

    public CrmService GetCrmService()

    {

    CrmAuthenticationToken token = new CrmAuthenticationToken();
    // You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
    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;

    return service;

    }


    Mahain
    • Proposed as answer by HIMBAPModerator Friday, June 18, 2010 9:44 AM
    • Marked as answer by CSN22 Friday, June 18, 2010 9:58 AM
    Friday, June 18, 2010 9:43 AM
    Moderator

All replies

  • Hi,

    IF you are talking about ms crmwebservice,There is no GetCrmService method in crm webservice,

    but you can create this function to create ms crm service object

    public CrmService GetCrmService()

    {

    CrmAuthenticationToken token = new CrmAuthenticationToken();
    // You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
    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;

    return service;

    }


    Mahain
    • Proposed as answer by HIMBAPModerator Friday, June 18, 2010 9:44 AM
    • Marked as answer by CSN22 Friday, June 18, 2010 9:58 AM
    Friday, June 18, 2010 9:43 AM
    Moderator
  • thanks, that's it!
    Friday, June 18, 2010 9:58 AM
  • I would highly recommend that you download the latest CRM SDK (4.0.0012) and look in the microsoft.xrm folder.  There is now an entire new xRM SDK that also includes CRM connectivity.  The new CrmConnection object takes a 'connection string' format and can connect to all deployment types.  The connection string can even be stored in your app.config file.  While you are looking at the new SDK, check out the other goodies that are there, like the LINQ-to-CRM provider.  This new xRM SDK brings CRM programming to the modern developer and will significantly reduce the complexity and lines of code that you have to write.

    Shan McArthur
    www.shanmcarthur.net

    Friday, June 18, 2010 11:11 PM
    Moderator
  • thanks, I got already the 4.0.0.12 version. But I did follow the description from some book, that does use an older version as the base of their descriptions. Your news sounds really good. Thanks!


    Viele Grüße / Best regards CSN22

    Thursday, June 24, 2010 6:43 AM