Wednesday, September 5, 2012

Error message on running SDK samples for CRM Online on Office 365

If you are trying to connect to CRM Online using Office 365 account  you will receive an error message “LDAP server is unavailable”.
Here is the screen shot.
image
The problem is the authentication process. I debugged the code and find out that SDK samples are using  the following code to the username.
//For OnlineFederation environments, initially try to authenticate with the current UserPrincipalName for single sign-on scenario.
                                        
else if (config.EndpointType == AuthenticationProviderType.OnlineFederation && config.AuthFailureCount == 0)
{
    config.UserPrincipalName = UserPrincipal.Current.UserPrincipalName;
    return null;
}
The value of "UserPrincipal.Current.UserPrincipalName" is always null and hence the error message. This code sits in CrmServiceHelpers.cs.
If we comment out the above mentioned code. The system will prompt you to enter your username and password and you are good to go.
You will receive the similar error message if you are trying to use developer’s toolkit with CRM Online on Office 365.The exact message is “Value Can not be null”. Here is the screen shot.
image
I don’t have a solution for this problem. I know  the Visual Studio stores the CRM connection string for developer toolkit in .suo file. I was hoping if I can create this file manually or update this file. But I don’t have a solution yet. If you guys have a solution, please let me know.
Thanks…

9 comments:

  1. Hi Amreek,

    We had the same problem, and it is because the O365 solution is expecting to login with your current user. What we did was comment the code you showed above (which is in a switch statement correct?) and replace it with the same code that is used for the AuthenticationProviderType.LiveId case. This basically always asks you for the credentials.

    Best Regards,
    Paulo

    ReplyDelete
    Replies
    1. That's what I did. I commented the above mentioned lines in the code and the code move execute the live Id credentials.

      Delete
  2. Hi All, I am trying to run this sample in my office machine,I received the following error messg:
    "An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail"

    Im getting this msg if I enter correct as well as incorrect user name & password. its seems that something is restricting the access of the services in my organization. I am able to run the same in my personal laptop without any issues.

    any idea how to overcome this?

    Thanks in Advance for your assistance
    Best Regards
    Mayil

    ReplyDelete
    Replies
    1. Add the crm5.dynamics.com as a server name. The discovery url for office 365 is https://disco.crm5.dynamics.com/XRMServices/2011/Discovery.svc. The hel[er class will add disco infront of the server name. I hope this helps.

      Delete
  3. Hello,
    I had the same problem few days ago. You need to get a new instance of credentials when you. Use the methode GetCredentials of the helper each time you need to authenticate on CRM Online office 365.
    Hope this helps

    ReplyDelete
  4. Replies
    1. Same here .. c as i am running the sample code that i debugged and commented out the Principal name code ... but while creating a new CRM Pakage or Workflow for CRM i am getting the same error how do i rectify that.

      Delete
  5. Excellent blog ,,,, its helps you to remove your rundll problem click this site How To Remove Rundll Error Free from error.
    Thank you
    Aalia lyon

    ReplyDelete
  6. Thanks for the answer

    ReplyDelete