Hi there I have a function to open outlook and read emails in my own inbox based on subject line, which works fine, BUT I need to be able to access a shared inbox (everyone here goes to Other users Folder and has our UATA and B mailbox open in their outlook) and I need the script to be able to access this folder's inbox, not my inbox. How do I do this as everywhere I've searched it just says GetDefaultFolder and will only accept (6). GetSubFolders wont work cos that gets the folders under my own inbox. If anyone can help I would greatly appreciate it. Also need to move the emails to another folder under the shared inbox if thats possible? [img]/images/graemlins/confused.gif[/img]
These are special folders when used with outlook application. As Raj has mentioned you need to create an object and retrieve the namespace associated. Then navigate to one of these special folders, which have a unique index/value for each distinct folder.
I would suggest, first you have to naviagte to the required root mail folder. I mean you might be having personal, mail folders in outlook. So choose where to search for this email i.e. either in the personal inbox or the regular mail inbox etc.
This is just a quick & dirty snippet. You should change the hardcoded values. The folders will definitely differ for you.
Set olookApp = CreateObject("Outlook.Application")
Set olookSpace = olookApp.GetNameSpace("MAPI")
Set MsgObject = olookSpace.Folders(2).Folders(3).Items(4) ' Folders(2) here refers to my Shared Folder. Folders(3) -> a Sub Folder under the chosen Shared folder. Items(4) -> Fourth message from the latest.
MsgObject.Move(olookSpace.Folders(2).Folders(2)) ' I am moving the selected message another sub folder Folders(2) from Folders(3)
This is the problem I am having - how do I construct a command to search for the email in the shared mail inbox? I've got everything else working up until then. What is the index for a shared mailbox? Is there a special command for it?
thanks but its not working for me - the problem I'm having is that I dont know what the index is for the shared mailbox I need and then the inbox of that shared mailbox. Every index I try either doesnt do anything or gives me an error. How did you work out that folder 2 is your shared mailbox? It doesnt work for me.