Pregunta

Is there a way to retrieve/identify the user that is currently logged into MS Dynamics CRM 2011 Online?

What i'm trying to accomplish here is kind of like the facebook login except with MS Dynamics. I need to somehow detect whether the user has logged into the MS Dynamics website. If the user is logged into the MS Dynamics website, i'll have to grab the UserId and authenticate it with Kentico CMS.

I've tried messing with the WhoAmIRequest, but unfortunately it needs a credential to properly execute.

Any help would be great!

¿Fue útil?

Solución 2

You can get userid from context. Recheck this article.

Otros consejos

You can get the Currently Logged in User Id by

 WhoAmIRequest request = new WhoAmIRequest();
            WhoAmIResponse response = (WhoAmIResponse)Service.Execute(request);
            if (response != null)
                return response.UserId;

You can create a default service like:

ClientCredentials Credentials = new ClientCredentials();
Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
//This URL needs to be updated to match the servername and Organization for the environment.


Uri OrganizationUri = new Uri("http://crm/XRMServices/2011/Organization.svc");

Uri HomeRealmUri = null;

//OrganizationServiceProxy serviceProxy; 

OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, null)

IOrganizationService service = (IOrganizationService)serviceProxy;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top