folder->get_Store fails

  • Thread starter tnemec78@googlemail.com
  • Start date
Status
Not open for further replies.
T

tnemec78@googlemail.com

Hi,

in my code I use folder->get_Store(&store); which crashes the app on

Outlook XP (Outlook 2007 works fine) Did anyone else experience this?

Am I doin anything wrong? The crash occurs inside of my

OnSelectionChange handler immediately after the Outlook starts.

Any hints?
 
Additional info:

After having explored the XP version of MSOUTL.OLB in OleView I

realise that there is no such method as get_Store. The _Namespace

property in this version does not have the GetStoreFromID method

either.

So how do I get from a MAPIFolder to _Store object in these early

versions of Outlook?
 
Are you talking about the Folder.Store() property in the Outlook 2007 object

model? Not only doesn't Folder exist in older versions of Outlook, but the

older MAPIFolder object has no Store property.

If you are going to develop for multiple versions of Outlook you can only

use methods that exist on the oldest version you plan to support. If you are

running on newer versions you can use Reflection or late binding to access

properties and methods on the newer version, but they still won't exist on

older versions of Outlook.

<tnemec78@googlemail.com> wrote in message

news:6afe43aa-37f4-4c56-9944-4f9598435035@q14g2000vbn.googlegroups.com...
> Hi,
> in my code I use folder->get_Store(&store); which crashes the app on
> Outlook XP (Outlook 2007 works fine) Did anyone else experience this?
> Am I doin anything wrong? The crash occurs inside of my
> OnSelectionChange handler immediately after the Outlook starts.

> Any hints?
 
Store objects are not exposed at all in the Outlook object model before

Outlook 2007. You can get a store from CDO 1.21 or from a 3rd party library

such as Redemption (www.dimastr.com/redemption).

What do you want to do with the Store object?

<tnemec78@googlemail.com> wrote in message

news:0ecace98-eb6f-429f-baba-7e89279dae99@n8g2000vbb.googlegroups.com...
> Additional info:
> After having explored the XP version of MSOUTL.OLB in OleView I
> realise that there is no such method as get_Store. The _Namespace
> property in this version does not have the GetStoreFromID method
> either.
> So how do I get from a MAPIFolder to _Store object in these early
> versions of Outlook?
 
I wanted to get to the Root Folder of a particular PST file. And I

found a Store->GetRootFolder() method. (2007 only)

So now I suppose I shall simple do something like

do

{

hr = folder->get_Parent(&folder2);

if(SUCCEEDED(hr))

folder = folder2;

}while(SUCCEEDED(hr));

once the call fails - I get out of the loop and that's when I will

have the root folder. correct?
 
I wanted to do 2 thing:

1stly: get to the Root Folder of a particular PST file.

I found a Store->GetRootFolder() method. (2007 only)

So now I suppose I shall simple do something like

while(true)

{

parent = NULL;

folder->get_Parent((IDispatch **)&parent);

dummy = NULL;

hr = parent->QueryInterface(__uuidof(MAPIFolder), (LPVOID *)&dummy);

if(FAILED(hr))

{

break;

}

folder.Release();

folder = parent;

}

once the call fails - I get out of the loop and that's when I will

have the root folder. correct?

2ndly: I wanted to call istore->GetReceiveFolder("IPM.Note", ...)

Here I am left clueless as to how to achieve this without the _Store

or IStore object ... Are there any tricks to use for Outlooks prior to

2007? (I am not using redemption or any other 3rd party tool right now)
 
I wanted to do 2 thing:

1stly: get to the Root Folder of a particular PST file.

I found a Store->GetRootFolder() method. (2007 only)

So now I suppose I shall simple do something like

while(true)

{

parent = NULL;

folder->get_Parent((IDispatch **)&parent);

dummy = NULL;

hr = parent->QueryInterface(__uuidof(MAPIFolder), (LPVOID *)

&dummy);

if(FAILED(hr))

{

break;

}

folder.Release();

folder = parent;

}

once the call fails - I get out of the loop and that's when I will

have the root folder. correct?

2ndly: I wanted to call get to the Inbox folder of a given PST file.

What I did again was to call folder->get_Store() then store-
> get_MAPIOBJECT() and finally istore->GetReceiveFolder


("IPM.Note", ...)

Here I am left clueless as to how to achieve this without the _Store

or IMsgStore objects ...

Are there any tricks to use for Outlooks prior to 2007? (I am not

using redemption or any other 3rd party tool right now)
 
NameSpace.Folders returns all the top level folders of stores that are

opened. Each MAPIFolder object in that top level collection is the

equivalent of the OutlookToday folder which corresponds to the IPM_SUBTREE

root folder.

An alternative is to get a folder as you say and keep traveling up the

hierarchy getting the parent folder until there are no more parents

available in the Outlook object model.

You can than iterate every top level folder under the IPM_SUBTREE hierarchy

looking for a folder where DefaultItemType == 5. The folder name would be

language dependent, if it's always English you can check the folder name for

"Notes". If language can vary then the above is the only way, but it doesn't

help you if the user has created another folder for note items at that same

top level.

With an alternate API you could read the PR_IPM_NOTE_ENTRYID (0x36D30102)

value from the Inbox folder properties and convert that PT_BINARY into a hex

string EntryID and use that to get the folder (NameSpace.GetFolderFromID)

for the default Notes folder. But you can do that only with other API's for

versions of Outlook earlier than 2007.

<tnemec78@googlemail.com> wrote in message

news:b4a5e990-3072-4bf2-922c-f5b120b2a792@37g2000yqp.googlegroups.com...
> I wanted to get to the Root Folder of a particular PST file. And I
> found a Store->GetRootFolder() method. (2007 only)
> So now I suppose I shall simple do something like
> do
> {
> hr = folder->get_Parent(&folder2);
> if(SUCCEEDED(hr))
> folder = folder2;
> }while(SUCCEEDED(hr));
> once the call fails - I get out of the loop and that's when I will
> have the root folder. correct?
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Search message, then (1) Jump to folder & (2) Select message that you searched for Outlook VBA and Custom Forms 2
G Search Folders and Jump to Folder Outlook VBA and Custom Forms 2
X Run macro automatically when a mail appears in the sent folder Using Outlook 5
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
P Yahoo/IMAP folder rename by Outlook desktop 365 Using Outlook 0
A Outlook 2019 folder counter Using Outlook 0
A Search folder and move the email Outlook VBA and Custom Forms 0
N Reply to Outlook messages by moving messages to a specific Outlook folder Outlook VBA and Custom Forms 1
T How to find or display the sub-folder name for an Archive Search Using Outlook 10
A Outlook 365 (OutLook For Mac)Move "On My Computer" Folder Items From Old To New Mac Computer Using Outlook 3
P Search folder: all emails sent to or from a domain Using Outlook 1
V Folder Properties - Gmail account can't switch Using Outlook 5
Victor_50 Outlook 2019 Jump to folder from search folder Outlook VBA and Custom Forms 0
HarvMan Outlook 365 - Rule to Move an Incoming Message to Another Folder Using Outlook 4
S Email Macros to go to a SHARED Outlook mailbox Draft folder...NOT my personal Outlook Draft folder Using Outlook 2
I Help with Smart Folder + Query Builder on IMAP Using Outlook 0
S Paperclip icon shows without attachment in email under Sent folder Using Outlook 0
Kika Melo Outlook Calendar deleted appointments not in Deleted Items folder Using Outlook 3
K vba code to auto download email into a specific folder in local hard disk as and when any new email arrives in Inbox/subfolder Outlook VBA and Custom Forms 0
Z Outlook 365 Automatically assign categories to incoming mail in a shared folder Round Robin Outlook VBA and Custom Forms 1
G Adding a contact to a specific folder Using Outlook 0
Witzker Outlook 2019 Macro GoTo user defined search folder Outlook VBA and Custom Forms 6
Rupert Dragwater Duplicate email in Folder Using Outlook 7
S Adding a recipient's column to Sent folder in Outlook 2010 Outlook VBA and Custom Forms 1
L "Insert Pictures" Button-Wrong Folder Using Outlook 5
C Outlook 365 Copy/Save Emails in Folder Outside Outlook to Show Date Sender Recipient Subject in Header Using Outlook 0
CWM550 Outlook 365 Hey Diane! MS 365 Biz Standard and "Potential Spam" addressed to others coming to my JUNK folder? Using Outlook 2
J Quick steps delete original email and move reply/sent email to folder Using Outlook 2
A manual rule sends mail to wrong folder Using Outlook 5
richardwing Auto forward email that is moves into a specific outlook folder Outlook VBA and Custom Forms 5
D This folder up to date vs all folders up to date Using Outlook 1
G Automatically delete messages in the synchronization folder Outlook VBA and Custom Forms 3
wayneame Changing the Form Used by Existing Task Items in a Folder Outlook VBA and Custom Forms 4
S Need code to allow defined starting folder and selection from there to drill down Outlook VBA and Custom Forms 10
P Emails assigned with a certain category (within a shared inbox) to be copied to a specific folder. Outlook VBA and Custom Forms 2
M Saving emails using Visual Basic - Selecting folder with msoFileDialogFolderPicker Outlook VBA and Custom Forms 6
B Search and Find Email by Folder Name Outlook VBA and Custom Forms 2
S Folder Pane Colour Categories Using Outlook 6
Victor.Ayala Automated way to check the option "Show this folder as an email Address Book" Outlook VBA and Custom Forms 2
NVDon Create new Move To Folder list Outlook VBA and Custom Forms 0
M Extract "Date sent" from emails (saved to folder using drag and drop) Outlook VBA and Custom Forms 1
O Cannot expand the folder. The set of folders cannot be opened. You do not have permission to log on. Using Outlook 1
F Jump to Inbox folder when click on Favorite Using Outlook 8
P Print attachments automatically and move the mail to an existing folder called "Ted" Outlook VBA and Custom Forms 4
lcarpay Stay in the mail folder pane after ctrl-1 Using Outlook 1
T Macro to move reply and original message to folder Outlook VBA and Custom Forms 6
F VBA to move email from Non Default folder to Sub folders as per details given in excel file Outlook VBA and Custom Forms 11
bhamberg Shortcuts in Folder Pane (Outlook 2016) Using Outlook 19
G VBA to save selected Outlook msg with new name in selected network Windows folder Outlook VBA and Custom Forms 1
P Posts in Folder No Longer Group by Conversation Column After Search Using Outlook 0

Similar threads

Back
Top