locked
CRM 4.0 - CrmService and Multi-tenancy / IFD RRS feed

  • Question

  • I have a custom aspx page installed in the ISV folder as per the SDK. I'm trying to use impersonation to get access to a custom entity that is in the current organisation (and not the default), but the

    ExtractCrmAuthenticationToken generated token only gives me access to the CrmService running on localhost (http://localhost:5555/MSCRMServices/2007/CrmService.asmx), but not the one for the current organisation (http://org1.litwareinc.com:5555/MSCRMServices/2007/CrmService.asmx).

     

    Can I use CrmImpersonator with a Multi-tenancy / Internet Facing Deployment? If, not how do I access CRM via the embedded aspx page?

     

     

     

    Some more info, when using:

     

    http://localhost:5555/CEM/... – On-premise deployment

    orgname: CEM

    token.OrganizationName: CEM

    token.CallerId: 9bf5e0df-65c1-dc11-b67a-0003ffbb057d

    crmService.Url:http://localhost:5555/MSCRMServices/2007/CrmService.asmx

    SOAP ERROR: Server was unable to process request.

    The organization id of the user being verified does not match the organization id of the execution context passed to VerifyUser.

     

    http://cem.litwareinc.com:5555/... – Internet Face deployment

    orgname: CEM

    token.OrganizationName: CEM

    token.CallerId: bbd61ec6-c1f3-dc11-b3b5-0003ff20badf

    crmService.Url:http://localhost:5555/MSCRMServices/2007/CrmService.asmx

    ERROR: There is an error in XML document (1, 467).

    ERROR (Inner Exception): The specified type was not recognized:
      name='cem_configuration',
       namespace='http://schemas.microsoft.com/crm/2007/WebServices', at

     

    9bf5e0df-65c1-dc11-b67a-0003ffbb057d is a user (LITWAREINC/Administrator) in the initial organisation.

    bbd61ec6-c1f3-dc11-b3b5-0003ff20badf is the same user (LITWAREINC/Administrator) in the CEM organisation.

     

    Why is it pickup different users, when it is using the same AD login and CRM organisation?

     

    Friday, March 28, 2008 12:25 AM

Answers

  •  

    Assuming you are displaying the page in an IFrame then this should work for you:

     

    Code Snippet

    using (new Microsoft.Crm.Sdk.CrmImpersonator())

    {

    Microsoft.Crm.SdkTypeProxy.CrmService crmService = new Microsoft.Crm.SdkTypeProxy.CrmService();

    Microsoft.Crm.Sdk.CrmAuthenticationToken token = Microsoft.Crm.Sdk.CrmAuthenticationToken.ExtractCrmAuthenticationToken(Context, orgName);

    crmService.CrmAuthenticationTokenValue = token;

    crmService.Url = ConfigurationManager.AppSettings["CrmService"].ToString();

    crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;

     

    // if required

    //Microsoft.Crm.SdkTypeProxy.Metadata.MetadataService metadataService = new Microsoft.Crm.SdkTypeProxy.Metadata.MetadataService();

    //metadataService.CrmAuthenticationTokenValue = token;

    //metadataService.Url = ConfigurationManager.AppSettings["MetaService"].ToString();

    //metadataService.Credentials = System.Net.CredentialCache.DefaultCredentials;

     

    // Do Work

     

    }

     

     

     

    Anne

    Friday, June 20, 2008 1:31 AM

All replies

  •  

    Fix the XML error by using dynamic entities.

     

    Any one know why we cannot access the CrmService for the organisation so we can use strong types ?

     

     

    Friday, March 28, 2008 6:07 AM
  • Dear Anne

     

    Organization myOrg = new Organization();

    myOrg.UniqueName = "TestOrg";

    myOrg.FriendlyName = "Display Name for TestOrg";

    myOrg.SqlServerName = "testsql"; // Replace this with the name of your sql server.

    myOrg.SrsUrl = "http://localhost/ReportServer"; // Replace this with the name of your SRS Server URL.

    myOrg.BaseCurrencyCode = "USD";

    myOrg.BaseCurrencyName = "US Dollar";

    myOrg.BaseCurrencySymbol = "$";

     

     

    http://blogs.msdn.com/crm/archive/2008/01/18/multi-tenancy-in-crm-4.aspx

     

    Regards,

    Imran

     

    http://microsoftcrm3.blogspot.com

     

     

    Monday, April 7, 2008 1:46 PM
    Moderator
  • I am facing the same kind of problem.

    I am unable to authenticate the custom web page in CRM..

     

    Please cau help me resolve the error.

     

     

    Thanks In advance

     

    Wednesday, June 18, 2008 9:23 AM
  •  

    Assuming you are displaying the page in an IFrame then this should work for you:

     

    Code Snippet

    using (new Microsoft.Crm.Sdk.CrmImpersonator())

    {

    Microsoft.Crm.SdkTypeProxy.CrmService crmService = new Microsoft.Crm.SdkTypeProxy.CrmService();

    Microsoft.Crm.Sdk.CrmAuthenticationToken token = Microsoft.Crm.Sdk.CrmAuthenticationToken.ExtractCrmAuthenticationToken(Context, orgName);

    crmService.CrmAuthenticationTokenValue = token;

    crmService.Url = ConfigurationManager.AppSettings["CrmService"].ToString();

    crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;

     

    // if required

    //Microsoft.Crm.SdkTypeProxy.Metadata.MetadataService metadataService = new Microsoft.Crm.SdkTypeProxy.Metadata.MetadataService();

    //metadataService.CrmAuthenticationTokenValue = token;

    //metadataService.Url = ConfigurationManager.AppSettings["MetaService"].ToString();

    //metadataService.Credentials = System.Net.CredentialCache.DefaultCredentials;

     

    // Do Work

     

    }

     

     

     

    Anne

    Friday, June 20, 2008 1:31 AM
  • Anne,

    what page does the code above need to be placed on?

    Thursday, March 25, 2010 11:45 PM