Hello,
I got an email about "D365 Platform Modernization: Deprecate legacy authentication-WS-Trust" last week. I compared my code with the one mentioned in that email about how to determine that my code is using WS-trust, I found that I was using the OrganizationServiceProxy class,It belongs to ws-trust.
I found an article published in 2019 on the official website about how to use CrmServiceClient to connect to organizational services. Please see the following code. But I feel like this code also belongs to ws-trust, not Office 365.
I just want to make sure that the way I connect to the organization service given in the following code belongs to wstrust, and if it still belongs to ws-trust, if I want to change it based on the code in it, how do I need to change this code to change my security protocol from ws-trust to office 365?
static void Main(string[] args) { // e.g. https://yourorg.crm.dynamics.com string url = ""; // e.g. you@yourorg.onmicrosoft.com string userName = ""; // e.g. y0urp455w0rd string password = ""; string conn = $@" Url = {url}; AuthType = Office365; UserName = {userName}; Password = {password}; RequireNewInstance = True"; using (var svc = new CrmServiceClient(conn)) { WhoAmIRequest request = new WhoAmIRequest(); WhoAmIResponse response = (WhoAmIResponse)svc.Execute(request); Console.WriteLine("Your UserId is {0}", response.UserId); Console.WriteLine("Press any key to exit."); Console.ReadLine(); } }