Get account name / user name

Hello, just a fundamental question.
How can I programmatically get the current account (short) user-name and the actual (long) user name?
Thank you

You're welcome!
I'm also a newbie in the Objective-C world, and in the general programming world too. So my ANSI C knowledge basically stopped after 'for' and 'while'
But It takes time to understand the NSObject world... Usually with Cocoa, most of the elementary tasks are already written by Apple. The trick is to know where to look and find them...
For example, I was writing methods that were working with the files' path until I found that there were this kind of tools in NSString
So basically we first have to read a lot about the fundamental Cocoa stuff before writing 'definitive' code

Similar Messages

  • How to get logged in user name from windows service c#

    i use the below code to get logged in user name.
    private string GetLoggedInUser()
    string userName = "";
    if (System.Security.Principal.WindowsIdentity.GetCurrent() != null)
    userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
    return userName;
    just do not understand why it is not giving a logged in user name rather it is return data in this format
    NT AUTHORITY\SYSTEM but i want to get user name.
    i try to run my service as Local Service and local system account but in every case i am getting this string
    NT AUTHORITY\SYSTEM instead of logged in user name.
    so please guide me what to change in code. thanks

    System is the account the service is running under.
    There can be none or many interactive users be logged in. What if none or multiple are logged in? Which one are you referring to then?
    Armin

  • Get last logon + user name

    Hi Everyone 
    first on all where is the powershell forum ?
    I need help with powershell,
    we have file ( Excel -CSV )  that contains names of 70  computers name ,
    I want to know which user did logon and  who is now is login.
    NOTE :
    I succeed to get the last login but I do not know which user did logon
    I will happy if someone help me , thank you and i appreciate you
    My Website:www.Pelegit.co.il Mcitp /Mcsa 2012

    Hi Meir,
    >>Get last logon + user name
    Regarding this question, the following thread can be referred to for more information.
    How to display last login user account in active directory ?
    https://social.technet.microsoft.com/Forums/en-US/8609ce4d-b15f-447b-bc37-142021b9e00c/how-to-display-last-login-user-account-in-active-directory-?forum=winserverDS
    >>first on all where is the powershell forum ?
    Windows PowerShell
    https://social.technet.microsoft.com/Forums/Windows/en-US/home?forum=winserverpowershell
    Best regards,
    Frank Shen
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Iphone 4 "cannot get mail" as user name or password incorrect.

    I have an iphone 4 and it has stopped updating mail.  Three days ago I incorrectly typed in my mobile me password and had to reset it.  I have updated my mac account details for my mobile me account on my phone but I keep getting "cannot get mail" as user name or password for.mac account is incorrect.  Im not sure what to do and this is very frustrating as Im sure it is something very simple!  Any help gratefully appreciated. 

    Did you try to delete the MobileMe account on the phone and set it up again after that?
    You can also try to replace the account info on the phone during the next sync, if you select this option in the info pane, Advanced Section, with your phone connected to iTunes.

  • TS1398 Cannot get mail the user name or password for xtra.co .nz is incorrect

    Cannot get mail
    The user name or password  xtra.co.nz is incorrect

    Hello dkmorgan,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Log in to your email provider's website to ensure that the account is active and the password is correct.
    Restart your iOS device.
    Delete the affected email account from your device.
    Tap Settings > Mail, Contacts, Calendars.
    Choose the affected email account, then tap Delete Account.
    Add your account again.
    Have a nice day,
    Mario

  • Bummer Message:  Cannot Get Mail  The user name or passowrd for "

    I have had the iPad 2 for one week and was able to access two gmail accounts (mine and my wife's). . . until this morning when one of them (mine) starting giving me the message:  "Cannot Get Mail  The user name or password for "####" is incorrect."  The other gmail account is still accessible. So what is the solution--if any?

    If your having problems sending email - go into your email settings and see if you can enter a password for your outgoing mail server same password as your incoming mail server.

  • Hello, I have this problem on updating applications on my iPhone 4s 5.1.1 i dont know if you can help me with. when ever i want to update an application on apple store i get a different user name then mine(slamdance@cracked.by) this user name is not mine

    Hello,
    I have this problem on updating applications on my iPhone 4s 5.1.1 (jail broken) i dont know if you can help me with.
    when ever i want to update an application on apple store i get a different user name then mine([email protected]) this user name is not mine but its always there only on updating my app's.
    thanking you in advance for your kind help.

    Under the Terms of Use of this forum it is prohibited to discuss jail breaking. By jail breaking your iPhone you void any warranty you may have and forfeit any support from this forum.

  • I want to get all the user name form LOGIN table ... how help me ?

    hi all
    I have table in MS Access databse called Login with two coulmn (User, Password),
    I want to get all the User Name in a string[] called USER,
    (LIKE USER = {"AA","BB","CC",........"zz"};)
    can anybody send me the code to get the USERNAMES form Login Table, i tried lots of way but bad luck
    so plz someone send me a code.
    Thanx
    Regards
    Satinder

    I made something like this as He pasted the the code above and u know this works for me atleast thanx
    kind regards
    satinderjit
    String User[] = new String[1000];
    try
    //Load Driver
    Class.forName(driver);
    // Make Connection
    connection=DriverManager.getConnection(url,user,password);
    // Create Statement
    statement = connection.createStatement();
    sql = "SELECT User FROM Login" ;
    // Create Resultset
    rs = statement.executeQuery(sql);
    int j=0;
    while(rs.next())
    User[j]= rs.getString("User");
    j=j+1;
    for(int i=0 ;i<J;i++)
    Form.C_Manager.addItem(User);
    statement.close();
    //rs.close();
    connection.close();
    catch(ClassNotFoundException cnfex) {
    //show message
    JOptionPane.showMessageDialog((Component) null,
    "Failed to load driver..."+
    "\n"+cnfex.getMessage(),
    "Error...",
    JOptionPane.ERROR_MESSAGE);
    catch(SQLException sqlex){
    //show message
    JOptionPane.showMessageDialog((Component) null,
    "Unable to connect to Database..."+
    "\n"+sqlex.getMessage(),
    "Error...",
    JOptionPane.ERROR_MESSAGE);
    catch(ArrayIndexOutOfBoundsException e){
    //show message
    JOptionPane.showMessageDialog((Component) null,
    "Unable to Load User Name..."+
    "\n"+e.getMessage(),
    "Error...",
    JOptionPane.ERROR_MESSAGE);

  • I want to get all the User Name in a string[ ], but How..... don't know

    hi all
    I have table in MS Access databse called Login with two coulmn (User, Password),
    I want to get all the User Name in a string[] called USER,
    (LIKE USER = {"AA","BB","CC",........"zz"};)
    can anybody send me the code to get the USERNAMES form Login Table, i tried lots of way but bad luck
    so plz someone send me a code.
    Thanx
    Regards
    Satinder

    Well, the biggest problem is that you don't know (probably) a head of time how many names are in the table.
    So i'd first stuff them into a managed array such as ArrayList
    So you'd
    (1) Iterate over the resultset
    (1.1) for each row call getString() on the user field
    (1.1) call add on the ArrayList to add the string
    (2) Call toArray on the ArrayList to convert it to a plain array
    (NOTE: you will have to pass a String[] {""} arg as a parm to
    toArray() to get the right type of array.)

  • Keep getting error message "user name or password for aol is incorrect". I have reset both username and password and still can't get my mail.  This problem only seems to exist in the evening.

    Keep getting error message "user name or password for aol is incorrect
    ". Have reset both and problem still exists.  Problem appears to be in the evening hours only.

    reset the password to re confirm that that isn't the issue

  • TS3899 Cannot get mail  the user name or password for Suddenlink is incorrect

    I have not once had an issue with this. I have not changed my password or anything. I have the iPhone 4. All of a sudden, the message error pops up that says " Cannot get Mail"  The User name or Password for Suddenlink is incorrect. Please help!!!!!!

    All customers should now have the ability to send and receive email through Suddenlink’s email service, and the vast majority should have full service, including access to all mail, folders, contacts, and settings. We will continue working until the remainder of customers have full email service restored. I'm very sorry for the inconvenience and thank you for your patience as we continue to work to restore full email service for all customers.

  • TS3058 Cannot Get Mail The user name or password for "gmail" is incorrect.

    Cannot Get Mail
    the user name or password for "gmail" is incorrect.

    did you do this
    http://support.google.com/mail/bin/answer.py?hl=en&answer=77702
    http://echeng.com/journal/2010/04/05/how-to-properly-set-up-gmail-with-your-ipad /

  • Getting the NT user name (Windows user name)

    Hello,
    I am trying to get the windows user name in ABAP program but
    I can not find any useful function.
    Thanks in advance,
    Eitan Iluzz.

    you can use the following code to get the windows logged on user
    data: username type string .
    CALL METHOD cl_gui_frontend_services=>get_user_name
      CHANGING
        user_name            = username
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        NOT_SUPPORTED_BY_GUI = 3
        others               = 4 .
        CALL METHOD cl_gui_cfw=>flush
          EXCEPTIONS
            CNTL_SYSTEM_ERROR = 1
            CNTL_ERROR        = 2
            others            = 3 .

  • Hi, My problem is I cannot connect my apple tv to my account, the user name and password are definitely correct, I upgraded the software, reset the device, but no chance. What should I do?

    Hi, My problem is I cannot connect my apple tv to my account, the user name and password are definitely correct, I upgraded the software, reset the device, but no chance. What should I do?

    Try this:
    Reboot device by pressing both the home button and sleep/wake (power) buttons at the same time for 10-15 seconds until the apple logo appears on the screen, then let go.
    If that doesn't work then reset the device by going to settings/general/reset/reset all settings  (or for network connection issues 'reset network settings').
    (no media or data will be deleted from the device, this will only take a minute).

  • HT2155 Ive been trying for days now to set up gmail.  I always get the message "user name or password for imap.gmailcom is in correct" I know for a fact that my onfo is correct.

    I have been trying for a long time to set up my gmail account.  So far to no avail.  I get a message that says "User name or password for Imap.gmail.com is incorrect.  Any sugesstions?
    thanks

    Try unlocking your account here: https://accounts.google.com/DisplayUnlockCaptcha.

Maybe you are looking for