![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I need to know how to get the top-level folder for the store that I
just opened/created with AddStore. My code looks like this right now: .... (create olApp object) ... CNameSpace olNs(olApp.GetNamespace("MAPI")); olNs.AddStore(COleVariant(CString("C:\\plhtest.pst "))); CFolders folders = olNs.get_Folders(); CMAPIFolder folder = folders.GetLast(); .... (do stuff with folder) ... olNs.RemoveStore(folder); Is that the correct way to get the folder? I read somewhere that you aren't guaranteed that the last folder is the right one for the store you just added, but if not, what is the right way? The AddStore function doesn't have a return value! Thanks, Phillip Hellewell |
Ads |
#2
|
|||
|
|||
![]()
You shouldn't assume that the latest added will the "last." Instead, maintain an array of the StoreID values for all the current stores, then use GetLast and see if its StoreID is in the array. If it isn't, then you have the right store. If it is in the array, try again with GetPrevious.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx wrote in message oups.com... I need to know how to get the top-level folder for the store that I just opened/created with AddStore. My code looks like this right now: ... (create olApp object) ... CNameSpace olNs(olApp.GetNamespace("MAPI")); olNs.AddStore(COleVariant(CString("C:\\plhtest.pst "))); CFolders folders = olNs.get_Folders(); CMAPIFolder folder = folders.GetLast(); ... (do stuff with folder) ... olNs.RemoveStore(folder); Is that the correct way to get the folder? I read somewhere that you aren't guaranteed that the last folder is the right one for the store you just added, but if not, what is the right way? The AddStore function doesn't have a return value! Thanks, Phillip Hellewell |
#3
|
|||
|
|||
![]()
Sue Mosher [MVP-Outlook] wrote:
You shouldn't assume that the latest added will the "last." Instead, maintain an array of the StoreID values for all the current stores, then use GetLast and see if its StoreID is in the array. If it isn't, then you have the right store. If it is in the array, try again with GetPrevious. Thank you. While this isn't as straightforward as I had hoped for, it is doable. Phillip |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Having trouble getting my newly added email account to work | Cary, NC | Outlook - Installation | 5 | September 6th 06 10:40 PM |
1000 Messages deleted from sent folder (PST File) | Benabd | Outlook - General Queries | 5 | September 2nd 06 02:42 AM |
Scheduling-tab needs a "Month" zoom level added. | J3 | Outlook - Calandaring | 0 | July 14th 06 06:38 AM |
Creating a PST file at the server level | Amwendwa | Outlook - General Queries | 8 | February 10th 06 02:01 PM |
getting error: this .pst file is not a valid personal folder file | jen98 | Outlook - Installation | 1 | February 2nd 06 12:37 AM |