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?
 
T

tnemec78@googlemail.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?
 
K

Ken Slovak - [MVP - 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?
 
K

Ken Slovak - [MVP - Outlook]

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?
 
T

tnemec78@googlemail.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?
 
T

tnemec78@googlemail.com

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)
 
T

tnemec78@googlemail.com

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)
 
K

Ken Slovak - [MVP - Outlook]

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
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 1
wayneame Changing the Form Used by Existing Task Items in a Folder Outlook VBA and Custom Forms 3
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
Y Filter unread emails in a search folder vba help Outlook VBA and Custom Forms 0
N contact list seen in Contact folder but knot in Address book or when 'TO' button is clicked in new email Using Outlook 0
D How to remove a folder, option grayed out Using Outlook 4
D How To Combine Share Task Folders in just one Folder Using Outlook 0
G Retention Policy for Outlook.com Deleted Items folder Using Outlook 0
Z Outlook 365 delete reminder you can’t make change to contents of this-read only folder Using Outlook 4
O The Outlook API wrongfully shows an outlook folder to have zero sub-folders Outlook VBA and Custom Forms 1
O The Outlook API wrongfully shows an outlook folder to have zero sub-folders Outlook VBA and Custom Forms 2
S Outlook (2016 32bit; Gmail IMAP) - Save sent message to Outllook Folder Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
C VBA to prompt for Sent folder destination Outlook VBA and Custom Forms 3
G How to add a folder shortcut to outlook quick access toolbar? Using Outlook 6
G Add to Outlook Contacts - Point to non-default contacts folder Using Outlook 0
M Move to Folder Using Outlook 1
K Export Folder to PST Outlook VBA and Custom Forms 2
B Spam folder not showing in Outlook Using Outlook 5
D Is a sub folder under contacts necessary to be able to name an Address Book? Using Outlook 1
J Moved many emails to Outlook external folder, need to delete on Gmail server Using Outlook 14
A Going to folder using shortcuts Using Outlook 3
B Outlook 2016 Auto-archive creates new folder Using Outlook 3
B BCC issues after changing root folder path for gmail Using Outlook 1
Fozzie Bear Outlook 2016 Creating a shared local Contacts folder Using Outlook 2
A Cannot copy this folder because it may contain private items Using Outlook 0
A Unable to save recurring Meeting to Documents folder due to error Using Outlook 2
B Extracting email addresses from a folder - how to also get the name of the person the address is for? Using Outlook 5
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
J Moving Imported folder Using Outlook 2
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0

Similar threads

Top