471,337 Members | 1,070 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Trying to impersonate

I'm trying to impersonate a admin user when retrieving picklist items in
Microsoft CRM. When
a windows 2000 user is opening the code it is getting a popup asking the
username, password, and domain.

Can someone please help??

The coce i am using is this,

System.Net.CredentialCache MyCredentials = new System.Net.CredentialCache();

System.Net.NetworkCredential MyNetCred =

new System.Net.NetworkCredential(@"user",@"password",@ "CRM");

MyCredentials.Add

(new Uri(strDir + "BizUser.srf"), "NTLM", MyNetCred);

MyCredentials.Add

(new Uri(strDir + "CRMCustomization.srf"), "NTLM", MyNetCred);

MyCredentials.Add

(new Uri(strDir + "CRMContact.srf"), "NTLM", MyNetCred);

MyCredentials.Add

(new Uri(strDir + "CRMQuery.srf"), "NTLM", MyNetCred);

//BizUser object

bizUser = new Microsoft.Crm.Platform.Proxy.BizUser();

bizUser.Credentials = MyCredentials;

bizUser.Url = strDir + "BizUser.srf";

// CRMCustomization proxy object

Microsoft.Crm.Platform.Proxy.CRMCustomization customization = new
Microsoft.Crm.Platform.Proxy.CRMCustomization();

customization.Credentials = MyCredentials;

customization.Url = String.Concat(strDir, "CRMCustomization.srf");

//create CRM Contact proxy object

Microsoft.Crm.Platform.Proxy.CRMContact contact = new
Microsoft.Crm.Platform.Proxy.CRMContact();

contact.Credentials = MyCredentials;

contact.Url = String.Concat(strDir, "CRMContact.srf");
//create CRM Account proxy object

Microsoft.Crm.Platform.Proxy.CRMAccount account = new
Microsoft.Crm.Platform.Proxy.CRMAccount();

account.Credentials = System.Net.CredentialCache.DefaultCredentials;

account.Url = String.Concat(strDir, "CRMAccount.srf");
// Query proxy object

Microsoft.Crm.Platform.Proxy.CRMQuery query = new
Microsoft.Crm.Platform.Proxy.CRMQuery ();

query.Credentials = MyCredentials;

query.Url = strDir + "CRMQuery.srf";
try

{

Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

userAuth = this.bizUser.WhoAmI();

}
Dec 22 '05 #1
0 1419

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by moemeelaung | last post: by
14 posts views Thread by Ian Frawley | last post: by
1 post views Thread by Svein Terje Gaup | last post: by
2 posts views Thread by rockdale | last post: by
4 posts views Thread by =?Utf-8?B?QXZhRGV2?= | last post: by
2 posts views Thread by =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.