Hello Experts,
Can you please help me to downgrade this Business Central AL Code to NAV17 ?
procedure GetToken() Token: text Var TypeHelper: Codeunit "Type Helper"; client: HttpClient; cont: HttpContent; header: HttpHeaders; response: HttpResponseMessage; Jobject: JsonObject; tmpString: Text; granttype: text; clientid: text; ClientSecret: text; resources: text; RequestURI_L: Text; Jtoken: JsonToken; ResponseText: Text; tenant: Text; Begin SharepointSetup_L.Get(UserId); granttype := SharepointSetup_L."Grant Type"; clientid := SharepointSetup_L.Client_Id '@' SharepointSetup_L.Tenant; ClientSecret := SharepointSetup_L."Client Secret"; resources := SharepointSetup_L.Resources '/' SharepointSetup_L.Domain '.sharepoint.com@' SharepointSetup_L.Tenant; cont.WriteFrom('grant_type=' TypeHelper.UrlEncode(granttype) '&client_id=' TypeHelper.UrlEncode(clientid) '&client_secret=' TypeHelper.UrlEncode(ClientSecret) '&resource=' TypeHelper.UrlEncode(resources) ''); cont.GetHeaders(header); header.Add('charset', 'UTF-8'); header.Remove('Content-Type'); header.Add('Content-Type', 'application/x-www-form-urlencoded'); RequestURI_L := 'https://accounts.accesscontrol.windows.net/' SharepointSetup_L.Tenant '/tokens/oAuth/2'; client.Post(RequestURI_L, cont, response); response.Content.ReadAs(ResponseText); Jobject.ReadFrom(ResponseText); Jobject.Get('access_token', Jtoken); Token := Jtoken.AsValue().AsText(); end;