Choosing a folder in Outlook

When looking around for samples about Outlook automation samples, it seems that most either create items only in the default folders or hardcode the path in the program code. However, in a real world application, the folder in which you create item often has to be configurable. Fortunately, there's actually a function build into MAPI that does this:
Local loOutlook, loNamespace, loFolder
loOutlook = CreateObject("outlook.application")
loNamespace = loOutlook.GetNamespace("MAPI")
loFolder = loNamespace.PickFolder()
If Vartype(m.loFolder) == "O"
* Do something with the folder item
? loFolder.FolderPath
EndIf

PickFolder automatically prompts the user for a profile, user name and password if the user hasn't logged on so far. There's one drawback of PickFolder(), though. If you have got an Outlook window visible, this window moves into the foreground and becomes the active one afterwards.