Question Status

Suggested Answer
Anthony Tan asked a question on 27 Jun 2012 12:28 AM

I have a big issue that I am trying to resolve for more than a week. Appreciate if you could enlighten me.

 

 

If I run the below code directly via VS 2010, it returns me with the correct result.

If I tried to run the same code directly from IIS 7.5 (using CRMAppPool) it reurns "SYSTEM"

If I'm trying to get the logged in User in crm 2011 using WhoAmIRequest class , it always return the system user instead of the logged in user I don't know why??

 

Thank and really hope to get good answer from you soonest.

 

 

 

 

 

 

My code as below: (I have use the latest DLL file from SDK)

======================================

Public _service As IOrganizationService

 

 

 

Public Function GetOrganization() As

IOrganizationService

 

 

Dim organizationUri As New Uri("http://company:81/XRMServices/2011/Organization.svc"

)

 

 

Dim cred As New

ClientCredentials

 

 

Dim _serviceproxy As New OrganizationServiceProxy(organizationUri, Nothing, cred, Nothing

)

 

 

Me

._service = _serviceproxy

 

 

Dim who As New WhoAmIRequest

()

 

 

Dim whoResp As WhoAmIResponse = CType(_serviceproxy.Execute(who), WhoAmIResponse

)

 

 

Dim currentUserId As Guid = whoResp.UserId

Response.Write(currentUserId)

 

 

Return Me

._service

 

 

End

Function

 

Reply
Suggested Answer
Scott Durow responded on 19 Aug 2013 4:40 AM

A bit of an old thread - but for anyone who has this problem - a common reason is you are logged in with the same user as the Dynamics CRM service account.

Scott Durow

Read my Blog   |  Follow Me on Twitter  |  Rockstar365

Reply
Suggested Answer
Scott Durow responded on 19 Aug 2013 4:40 AM

A bit of an old thread - but for anyone who has this problem - a common reason is you are logged in with the same user as the Dynamics CRM service account.

Scott Durow

Read my Blog   |  Follow Me on Twitter  |  Rockstar365

Reply