2
我有一個自定義mvc應用程序,我想用作crm 2011的一部分 (例如,我在crm面板上有一個按鈕,它在我的mvc應用程序中調用動作)Crm 2011.如何獲得mvc應用程序中的當前用戶
我可以獲取用戶憑證,該憑證以crm登錄並按下按鈕?
我使用此代碼來運行組織服務。但WhoAmIRequest迴流系統或爲空(取決於冒充物業在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;
你可以添加一個如何調用你的MVC應用程序的例子嗎?我會想象你可以從CRM – glosrob 2013-02-22 15:17:35
傳遞當前用戶的Id。例如,http://host/ISV/ApplicationWeb/CustomController.mvc/CustomAction?userGuid = 123&param2 = 123。而'是',我把userguid放在鏈接上。但是,我認爲這很糟糕,因爲用戶可以在瀏覽器中更改GUID。我試圖找到更好的方法,它是如何在代碼中 – 2013-02-23 12:20:00