crm 2011 の一部として使用したいカスタム mvc アプリケーションがあります (たとえば、mvc アプリケーションでアクションを呼び出すボタンが crm パネルにあります)。
crm にログインしてボタンを押すユーザー資格情報を取得できますか?
このコードを使用して組織サービスを実行します。ただし、WhoAmIRequest はシステムまたは null を返します (web.config の偽装プロパティに依存)
var organizationUri = new Uri(Configuration.OrganizationUri());
var credentials = new ClientCredentials();
credentials.Windows.ClientCredential = (DefaultCredentials != null) ? DefaultCredentials : CredentialCache.DefaultNetworkCredentials;
IServiceConfiguration<IOrganizationService> orgConfigInfo = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(organizationUri);
var service = new OrganizationServiceProxy(orgConfigInfo, credentials);
WhoAmIResponse response = (WhoAmIResponse)service.Execute(new WhoAmIRequest());
service.CallerId = response.UserId;