Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Web API returns Error "Unknown User Type"

Posted on by Microsoft Employee

I have the sales module with Financials for Dynamics 365 Online and I am trying to access the Web API using the starter code below.  I have entered my credentials according to this blog at: dynamicscrmcoe.com/using-new-web-api.    There is another 3rd party application using the api successfully, so I am presuming everything in Dynamics is setup correctly.  The only thing I have noticed is that the code below, from Feb 2017, is using version 2.2x of Microsoft.IdentityModel.Clients.ActiveDirectory.  The current version is 3.17.   If that is what's causing the problem, how do I correct the code so it will function properly? What am I missing?  

 

Thanks!

Starter Code:

https://code.msdn.microsoft.com/CRM-Web-API-Basic-27fcbf2e 

2260.untitled.png

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Web API returns Error "Unknown User Type"

    A ticket has been Opened with Microsoft.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Web API returns Error "Unknown User Type"

    Just an Update . . . . I have been trying to connect with xrm tooling as above and am now getting a different error: "Unable to Login to Dynamics CRMOrganizationServiceProxy is null"

    Still working on finding a solution.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Web API returns Error "Unknown User Type"

    The original code (with no updating) is not establishing a connection and throws the error in the try catch.

    code-sample-jpp.jpg

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Web API returns Error "Unknown User Type"

    Ok. Let me ask question in a different way - what kind of problem did you mention in your first post?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Web API returns Error "Unknown User Type"

    Hi Andrew,  Thanks for replying.   I am using version 2.2 of the IdentityModel and it is what is returning the error.   The program will not compile or run if I upgrade to version 3.

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Web API returns Error "Unknown User Type"

    Hello,

    Downgrade version of Microsoft.IdentityModel.Clients.ActiveDirectory to 2.2 version in NuGet references section. Check the last part of this article - butenko.pro/.../migrating-apps-microsoft-xrm-client-microsoft-xrm-tooling

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans