Programming and Web Development Forums - crm - Microsoft Customer Relationship Manager
We are writing a callout for a project and we would like to use the Microsoft Enterprise Library (MEL) for configuration, logging, and data access. It is our enterprise standard to utilize those blocks for those activities on all of our efforts. The problem is that I don't see a readily available app.config or web.config file for which I can add the configuration context necessary to utilize those features. I also am very averse to modifying any core Microsoft Dynamics CRM 3.0 app.config or web.config file because it has the potential of being wiped out during any future upgrades. So far we have envisioned two options but would like some community feedback to help us define a best practice. Option 1: Use the MEL ConfigurationManager to load context from a file and execute against that context PRO: It seems as if it may get us closer CON: Externally loaded context does not become the "current context". Existing in-house libraries hard-wired to execute against the "current context" may not be utilized. Option 2: Add the configuration context to the machine.config PRO: We may utlize all existing in-house libraries CON: We have a standard to not use the machine.config for anything to avoid potential maintenance headaches. We are leaning towards [Option 2] and changing our standard to allow authorized modifications to the machine.config only. This is because we enjoy leveraging the current context in our core libraries to avoid having to pass context and configuration information through every layer of our code.
I am using this code to retrive GUID but it's always return same GUID of system user(named SYSTEM in the systemuserbase table). CrmService service = new CrmService(); service.Credentials = System.Net.CredentialCache.DefaultCredentials; WhoAmIRequest userRequest = new WhoAmIRequest(); WhoAmIResponse user = (WhoAmIResponse) service.Execute(userRequest); String loggedInUserId = user.UserId.ToString(); I think it is the case of setting the impersonation in the CRM web.config and the corresponding application web.config. Any suggestion would be helpful.
Hi Tibor, Thanks for your reply. As you written in step 1 impersonate your user that i already done through web.config(<identity impersonate="true" />) Please explain these steps in some more detail. If you have any sample code regarding to this thats is very helpful for me. Many thanks for your help. Kedar N. Kumar "Tibor" wrote: > Hi Kumar, > > you can use service.caller.callerguid to get/set this property. > But the call-outs are running under the name of NT AUTHORITY\Network Service > = (SYSTEM) > You can do the following: > - imersonate your user user using the Credentialcache > - find you user through crm webservice in the database > - retrieve the id of your user > - log this id. > > Regards, > Tibor > > "Kedar Nath Kumar" wrote: > > > I am using this code to retrive GUID but it's always return same GUID of > > system user(named SYSTEM in the systemuserbase table). > > > > CrmService service = new CrmService(); > > service.Credentials = System.Net.CredentialCache.DefaultCredentials; > > > > WhoAmIRequest userRequest = new WhoAmIRequest(); > > WhoAmIResponse user = (WhoAmIResponse) service.Execute(userRequest); > > String loggedInUserId = user.UserId.ToString(); > > > > I think it is the case of setting the impersonation in the CRM web.config > > and the corresponding application web.config. > > > > Any suggestion would be helpful.
Users browsing this forum: No registered users and 5 guest