Const strValidUser = "andermc"; '<- My NT/Exchange username
Set objOutlook = CreateObject("Outlook.Application")
Set objNS = objOutlook.GetNamespace("MAPI")
Set objRecipient = objNS.CreateRecipient(strValidUser)
objRecipient.Resolve
If (False = objRecipient.Resolved ) Then '<- not return value from abo
+ve!
'need to exit nicely
Now we're resolved we need to get a default folder or whatever.
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders(a_Folder_UNDER_Inbox)
...
If the folder you really want isn't in YOUR default mailbox then you should check if that mailbox has a 'NT alias' or 'function ID' associated with it (Properties box from the GAL). Use that alias as the recipient name to get the default folder (olFolderInbox = 6) for that mailbox (Exchange will resolve it if your NT account has sufficient permissions) then use:
#Create a folder object from a subfolder of Inbox...
Set objFolder = objInbox.Folders(strMySubFolder)
#Or use the Parent property to move UP the hierarchy
HTH (and sorry I didn't take the time to convert my old code to Perl!) - Mark |