I am using late binding to connect to MS CRM using console application. My program.cs file looks like this
class Program
{
private static OrganizationServiceProxy _serviceProxy;
private static ClientCredentials _clientCreds;
static void Main(string[] args)
{
// Setup credential
_clientCreds = new ClientCredentials();
_clientCreds.Windows.ClientCredential.UserName = "userName";
_clientCreds.Windows.ClientCredential.Password = "Password";
_clientCreds.Windows.ClientCredential.Domain = "Domain";
Uri URL = new Uri("servername/.../Organization.svc");
// Connect to Crm WCF endpoint
using (_serviceProxy = new OrganizationServiceProxy(URL, null, _clientCreds, null))
{
OrganizationServiceContext orgContext = new OrganizationServiceContext(_serviceProxy);
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse response = (WhoAmIResponse)orgContext.Execute(request);
Console.WriteLine("Your Crm user Guid is {0}", , response.UserId);
Console.Read();
Can someone help me on what should I put in my app.config file. Everytime I run the program it gives me below error:
The type initializer for 'System.ServiceModel.Diagnostics.TraceUtility' threw an exception.
*This post is locked for comments
Thanks a lot Guido. It worked!
so can I delete the app.config file? Also, how to pass user name password in case of on premise?
Thank you!
Thanks Guido! What changes I need to make in app.config file?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156