I am using OrganizationWebProxyClient to access organization service for CRM. I am getting an error message that does not make any sense.
I have nothing in my code that has to do with "_address". I thought the error message was referring to my URL.
Endpoint = Address=error CS0103: The name '_address' does not exist in the current context, ClientCredentials = {System.ServiceModel.Description.ClientCredentials}
var clientId = "YOUR_CLIENT_ID";
var clientSecret = "YOUR_CLIENT_SECRET";
var organizationUrl = "YOUR_ORGANIZATION_URL";
var tenantId = "YOUR_TENANT_ID";
//this specific scope means that application will default to what is defined in the application registration rather than using dynamic scopes
List<string> scopes = new List<string>();
scopes.Add("https://graph.microsoft.com/.default");
var cca = ConfidentialClientApplicationBuilder.Create(clientId)
.WithAuthority(authority)
.WithRedirectUri(organizationUrl)
.WithClientSecret(clientSecret)
.Build();
// Retrieve an access token for Microsoft Graph (gets a fresh token if needed).
var authResult = cca
.AcquireTokenForClient(scopes)
.ExecuteAsync();
var tokenKey = authResult.Result.AccessToken;
OrganizationWebProxyClient sdkService = null;
try
{
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
sdkService = new OrganizationWebProxyClient(GetServiceUrl(organizationUrl), new TimeSpan(0, 10, 0), false);
sdkService.HeaderToken = tokenKey;
}
catch (Exception ex)
{
log.LogInformation("There is issue while generating the token " + ex.Message);
}
return sdkService
