0
votes

newbie to c#

I inherited a c# vsto addin for outlook and within the code there is a method that searches for a mailitem by entryid. We also pass in either a NULL or a particular folder to search for the mailitem.

NOTE: for this addin, on the production server, the outlook mail client has access to several other email accounts, not just the user running outlook..

if we pass in a NULL for foldertype to static Outlook.MailItem FindMailitemByClientandEntryID(int argClientID, string argEntryID, string folderType)

we build an array of folders to loop through

        if (folderType == null)
        {
            theFolderTypes = new string[] {"ToBePrinted", "ClaimsCompleted", "Automated", "AutomatedPendingPrelog", "AutomatedPendingSplit", "AutomatedRejected" };
        }
        else
        {
            theFolderTypes = new string[1];
            theFolderTypes[0] = folderType;
        }

then we loop through each folder name in the array and get the folder path and StoreID,then try to find the mailitem using GetItemFromID

we are logging just about everything including the results of finding the storeid and find that no matter what the subfolder is (for the particularargclientid) the storeid is the same.

is that normal?

I would expect to get a different value for each subfolder Inbox Document Control Automated To be Printed Claims Completed

That may be the reason why the original programmer commented out the second line as it didn't matter.

theItem = Globals.ThisAddIn.Application.Session.GetItemFromID(argEntryID, null);
//theItem = Globals.ThisAddIn.Application.Session.GetItemFromID(argEntryID, theClientStoreID);

Thanks in advance Chris

1

1 Answers

0
votes

Yes, the StoreId is the same for all folders of one message store.

Each folder has an ID field called Folder.StoreID, the value of which is the same for all the folders in a particular message store. Each folder also has a unique Entry ID field. Source

If I remember correctly a message store is a mailbox or for that matter a PST file.