![]() |
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |