web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Fixing WS-Trust while ...
Power Apps
Unanswered

Fixing WS-Trust while using early bound classes

(0) ShareShare
ReportReport
Posted on by 4

Hello there!

 

  1. I refactored code to connect to Dynamics by using the Oauth CRMServiceClient(<connectionstring>) method as explained here:
    https://docs.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-office365-deprecation
  2. I also use early-bound classes generated by CrmSvcUtil/XrmToolbox as explained here: 
    https://docs.microsoft.com/en-us/power-apps/developer/data-platform/org-service/generate-early-bound-classes
  3. However, when you use generated early-bound classes, you have to enable proxy types as explained here (see the green tip):
    https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/gg328210(v=crm.8)?redirectedfrom=MSDN
    Which means, the generated early bound class file has this attribute at the top:
    [assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]
    And in the connection code, I enabled proxy types (explained later). The problem is, EnableProxyTypes is a method that exists only in the OrganizationServiceProxy class--which is a class that is now forbidden by link #1 above.

Therefore, I must obtain a connected client using this:

 

var CrmSvc = new CrmServiceClient(<OauthConnectionString>);

 

However, I get this error:

 

A proxy type with the name <entity name> has been defined by another assembly

 

I could try adding the below lines that EnableProxyTypes, but they are forbidden by the documentation (link #1 above says not to use OrganizationServiceProxy):

 

CrmSvc.OrganizationServiceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior(Assembly.GetExecutingAssembly()));
CrmSvc.OrganizationServiceProxy.EnableProxyTypes(Assembly.GetExecutingAssembly());

 

So my question is, what is the correct way to enable proxy types (or in general, use early-bound generated classes), while complying with the removal of WS-Trust?

 

Thank you!

 

I have the same question (0)
  • pavanmanideep Profile Picture
    576 Power Up Champ - 2025 on at

    Hi @somo, May I know what were you building, you could prefer organization service instead, do remember that you need to refractor your code a bit, I have written a blog post way back in 2020...please go through it here once https://ecellorscrm.wordpress.com/2020/06/09/are-you-still-using-ws-trust-auth-and-organizationserviceproxy-then-it-is-time-to-change/, do let me know if you have any further questions....

     

    Cheers,

    PMDY

  • somo Profile Picture
    4 on at

    Hello @Pavan_Mani_Deep Thank you for your response! I've edited my post to hopefully make it more clear that I've already taken the steps suggested in your blog post. In short: The new Oauth connection requirements are incompatible with early-bound generated classes, because Oauth does not have an allowed way to enable proxy types. At least, that's what it seems. Would love a definitive answer from Microsoft on this.

  • pavanmanideep Profile Picture
    576 Power Up Champ - 2025 on at

    Hi @somo ,

     

    Thanks, I am afraid as I am couldn't find a way too...could you pls raise to support ticket to Microsoft to see what they say....

     

    Thank you.

     

    Cheers,

    PMDY

  • eriksteinebach1 Profile Picture
    2 on at

    Were any of you ever able to figure this out? I am running into the same issue right now. Trying to enable ProxyTypes with the OAuth enabled Microsoft.PowerPlatform.Dataverse.Client.ServiceClient, but I am not able to find a way to do this.

  • somo Profile Picture
    4 on at

    @eriksteinebach1 unfortunately no. The error I get concerning this is intermittent. so even when I contacted Microsoft support about it, they weren't able to properly debug/reproduce the issue. Maybe you could have better luck contacting them?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard