A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

OOM 2003: can't identify selected folder from Selection



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 24th 07, 09:16 AM posted to microsoft.public.outlook.program_addins
Kelmen
external usenet poster
 
Posts: 1
Default OOM 2003: can't identify selected folder from Selection

Greeting, I'm working on add-in using C# and Outlook Object Model.

At one event I need to identify the selection items. But for case when
I selected a folder:
- the Selection.Count give me 1, ok.
- but getting the item out, I can't type cast it to MAPIfolder!
- I have no problem if the items are ContactItem!

Am I missing something, or its another OOM bug again?

  #2  
Old July 24th 07, 09:48 AM posted to microsoft.public.outlook.program_addins
SvenC
external usenet poster
 
Posts: 11
Default OOM 2003: can't identify selected folder from Selection

Hi,

At one event I need to identify the selection items. But for case when
I selected a folder:
- the Selection.Count give me 1, ok.
- but getting the item out, I can't type cast it to MAPIfolder!
- I have no problem if the items are ContactItem!

Am I missing something, or its another OOM bug again?


I do not think that the Selection collection will contain folder elements.
Whenever you select a folder you can see that the topmost element of that
folder is also selected. I guess that causes the count property to be 1 from
the beginning.
Depending on the view of the folder you might have no visual feedback that
one element of that folder is selected.

To get the folder of the selection you could use the Parent property of the
first element of the selection.
Try this in VBA:

Dim o As Object
Set o = ActiveExplorer.Selection.Item(1)
Debug.Print TypeName(o)
Debug.Print TypeName(o.Parent)

That should display an item type like MailItem, followed by MAPIFolder

--
SvenC

  #3  
Old July 24th 07, 03:27 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default OOM 2003: can't identify selected folder from Selection

ActiveExplorer.CurrentFolder would also return the MAPIFolder that's
current.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"SvenC" wrote in message
...
Hi,

At one event I need to identify the selection items. But for case when
I selected a folder:
- the Selection.Count give me 1, ok.
- but getting the item out, I can't type cast it to MAPIfolder!
- I have no problem if the items are ContactItem!

Am I missing something, or its another OOM bug again?


I do not think that the Selection collection will contain folder elements.
Whenever you select a folder you can see that the topmost element of that
folder is also selected. I guess that causes the count property to be 1
from the beginning.
Depending on the view of the folder you might have no visual feedback that
one element of that folder is selected.

To get the folder of the selection you could use the Parent property of
the first element of the selection.
Try this in VBA:

Dim o As Object
Set o = ActiveExplorer.Selection.Item(1)
Debug.Print TypeName(o)
Debug.Print TypeName(o.Parent)

That should display an item type like MailItem, followed by MAPIFolder

--
SvenC


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
created contact is seen in contacts folder but not in distribution list's member selection [email protected] Outlook - Using Contacts 4 October 27th 06 05:09 AM
IMPORTANT Software-Development: How to identify the body/sender/recipient when the selected message is changed Kevin Stumpf Outlook Express 1 June 20th 06 12:46 PM
Identify Outlook 2003 mail delivery location BY Outlook and VBA 1 May 16th 06 04:34 PM
Create a search folder to look at all emails in one folder and selected criteria in other folders [email protected] Outlook - General Queries 1 April 10th 06 10:40 AM
How to identify pst file format wether outlook 2000 or 2003 Prakash Tulsiani Outlook - Installation 1 April 6th 06 10:02 PM


All times are GMT +1. The time now is 12:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.