Options

NAV 2015 - Get USER PROFILE

SYLV1GSYLV1G Member Posts: 93
edited 2015-01-09 in NAV Three Tier
Dear All,

I would like to replace this instruction : Path := ENVIRON('USERPROFILE') because the ENVIRON function is no more avalaible in NAV 2015.

Does anybody know how i can do this?

Thanks SG

Comments

  • Options
    Jan_VeenendaalJan_Veenendaal Member Posts: 206
    Since all code is executed on the server, using the same service-account(probably) this would not make much sense...
    Jan Veenendaal
  • Options
    vytjakvytjak Member Posts: 36
    This translates very nicely to a little bit of .NET interop:
    Path = Env.GetEnvironmentVariable('USERPROFILE');
    
    Env here is of type DotNet (System.Environment.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')

    Do not forget to put the RunOnClient property for the variable appropriately.
    Vytenis Jakas
    B3 Technologies - Making Technology Serve the People
  • Options
    Jan_VeenendaalJan_Veenendaal Member Posts: 206
    Please be aware that this DotNet code will only work in the windows client, not the web client nor the tablet client
    Jan Veenendaal
  • Options
    SYLV1GSYLV1G Member Posts: 93
    Hello,

    Thank you for your help. I will test and give you my feedback
Sign In or Register to comment.