Search code examples
c#fileoutlookinventory

Inventory Remote Computers for PST's connected to Outlook?


I've been searching for a solution for a few days now, I've looked through the MSDN for Interop.Outlook and I think I've found what I need, but can't seem to implement it properly.

Here's the code I've came up with based on something similar I saw in VBA.

class Program
{
    Stores allstores = new Stores();
    Store store;

    static void Main(string[] args)
    {
        foreach (var store in allstores)
        {
            MessageBox.Show(store.FilePath);
        }

    }
}

`

This essentially needs to cycle through a list of computers, and run this code on their outlook(some 2003, some 2007) in order to inventory all connected PST's in each outlook profile. I'm sure there's more code to this, but I can't get this portion to work at all. There seems to be a lack of information on inventorying Outlook data files, most of it is reading e-mails from the mailboxes and not the data file itself.

If someone could shed some light on what I'm overlooking, It'd be greatly appreciated.

EDIT:

I've actually made a working piece of code now, however I have a problem with compatibility. The program works as designed in Office 2010/2007, however it crashes when accessing a 2003 version. I imagine I need to use the Microsoft Office Object 11.0, however I only have Microsoft Office Object 12.0 listed - is there a way to get the 11.0 reference?


Solution

  • This may be of use, pretty thorough object model comparison and development guide.