locked
REST differences between on premise and office 365 RRS feed

  • Question

  • Hi,

    Note: This is VERY simply example - but just want to show the problem

    Can someone tell me why this C# to connect to an on premise server works well...

    WebClient client = new WebClient();
    
    NetworkCredential creds = new NetworkCredential("jack", "<Jack's Password>");
    
    client.Credentials = creds;
    
    string result = client.DownloadString("http://<IP of a 2011 CRM Server>/<An Organisation Name>/XrmServices/2011/OrganizationData.svc/AccountSet");

    While this code to connect to CRM on Office 365 fails??

    WebClient client = new WebClient();
    
    NetworkCredential creds = new NetworkCredential("jack@testorg.onmicrosoft.com", "<Jack's Password>");
    
    client.Credentials = creds;
    
    string result = client.DownloadString("https://testorg.api.crm5.dynamics.com/XrmServices/2011/OrganizationData.svc/AccountSet");

    Note: Pasting the URL https://testorg.api.crm5.dynamics.com/XrmServices/2011/OrganizationData.svc/AccountSet into a browser where I've logged into CRM online does work (try it yourself - just change "testorg" to suit) so I suspect something about the credentials (or is it something else)?

    Thanks,

    JK



    • Edited by Johnathan Kahl Friday, September 5, 2014 1:45 AM additional clarification
    Friday, September 5, 2014 1:37 AM

All replies

  • Hi,

    While connecting to MS CRM Online you need to send your device credentials as well, you can utilize device manager utility to register your device, this utility comes with MS CRM SDK. 

    Check : http://msdn.microsoft.com/en-us/library/gg328147.aspx

    http://msdn.microsoft.com/en-us/library/hh675404.aspx


    Our Website| Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Friday, September 5, 2014 3:05 AM
    Moderator