Hi Archana,

There is an unideal solution for this. Use "RunAS" feature to change 
the user login.
Create a short cut on your desktop or wherever. In the Target 
property, set it as 
------------------------------------------------------------------
C:\WINXP\system32
\runas.exe /savecred /user:domainName\userName "C:\Program 
Files\Microsoft Dynamics AX\40\Client\Bin\Ax32.exe" 
------------------------------------------------------------------
Because RunAs does not accept a password on the command line, you 
got to run this command to let the system cache the user's 
credential.
In your code, use WinAPI::ShellExecute() to run this shortcut, then 
shutdown your current AX client session (xInfo::Shutdown).

Have a look at 
http://blogs.msdn.com/oldnewthing/archive/2004/11/29/271551.aspx, it 
discussed about the solution to accept a password on the command 
line.

Hope it helps,

Martin

[EMAIL PROTECTED]

http://www.OutsourceAX.com
Delivering cost-effective, high quality and scalable Dynamics AX 
Development outsourcing services.
 
--- In [email protected], Malcolm Burtt 
<[EMAIL PROTECTED]> wrote:
>
> Hi
> 
> This was possible in Axapta 3.0 using the methods xSession.newUser
() and xCompany.reloadRights(), but Microsoft have removed these an 
Ax 4.0 even though it should have been possible to provide 
implementation for them despite the AD authentication model. Oh well.
> 
> Regards
> 
> 
> Malcolm Burtt
> Touchstone
> People, Partnerships, Solutions
> 
> 
> From: [email protected] [mailto:development-
[EMAIL PROTECTED] On Behalf Of archana.lakhotiya
> Sent: 20 September 2007 12:02
> To: [email protected]
> Subject: [development-axapta] Changing user through code
> 
> 
> Hi All,
> 
> I want to change the current user to another user at runtime.
> Just like we change company through changecompany(), is there any 
way
> through which we can change user?
> 
> Thanks...
> 
> 
> 
> [Non-text portions of this message have been removed]
>


Reply via email to