Outlook.Selection: determine what type of item is selected.

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Aug 2008
Posts: 169
Reputation: murderotica is an unknown quantity at this point 
Solved Threads: 2
murderotica's Avatar
murderotica murderotica is offline Offline
Junior Poster

Re: Outlook.Selection: determine what type of item is selected.

 
0
  #11
Nov 27th, 2008
This is what I meant
Outlook.Application app = new Outlook.Application();
Outlook.Selection oSel;
Outlook.Explorer oEx = app.ActiveExplorer;

oSel = oEx.Selection;

Object oItem;

oItem = oSel.Item;

String msgClass = oItem.MessageClass;

I want to know the item selected to filter if it is the item that I want. But it seems the line in red it gives me an error.
An Avalanche In D Minor
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Outlook.Selection: determine what type of item is selected.

 
0
  #12
Nov 27th, 2008
Because (DUH) Object is not an outlook class that has that property.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 169
Reputation: murderotica is an unknown quantity at this point 
Solved Threads: 2
murderotica's Avatar
murderotica murderotica is offline Offline
Junior Poster

Re: Outlook.Selection: determine what type of item is selected.

 
0
  #13
Nov 27th, 2008
That is what the link exactly did only in VB. I think there is a way in C# but can't just find it.
An Avalanche In D Minor
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Outlook.Selection: determine what type of item is selected.

 
0
  #14
Nov 27th, 2008
But VB is lazy and allows you to do hiddeous things like adding characters and integers and setting strings to numbers if you let it. That doesnt make it right.

if you declare object as o you could test if o is Outlook.MailItem that seems to work.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 169
Reputation: murderotica is an unknown quantity at this point 
Solved Threads: 2
murderotica's Avatar
murderotica murderotica is offline Offline
Junior Poster

Re: Outlook.Selection: determine what type of item is selected.

 
0
  #15
Nov 27th, 2008
Thanks for the reply, can you show a snippet how to implement?
An Avalanche In D Minor
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Outlook.Selection: determine what type of item is selected.

 
0
  #16
Nov 27th, 2008
Good god, no offense but that sounds as lazy as it gets

  1. Outlook.Application app = new Outlook.Application();
  2. Outlook.Selection oSel;
  3. Outlook.Explorer oEx = app.ActiveExplorer;
  4.  
  5. oSel = oEx.Selection;
  6.  
  7. Object oItem;
  8.  
  9. oItem = oSel.Item;
  10. if (oItem is Outlook.MailItem)
  11. {
  12. Outlook.MailItem oMail = (Outlook.MailItem)Oitem;
  13. label1.Text = oMail.Subject;
  14. }

all you had to do was paste in the info given..
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 169
Reputation: murderotica is an unknown quantity at this point 
Solved Threads: 2
murderotica's Avatar
murderotica murderotica is offline Offline
Junior Poster

Re: Outlook.Selection: determine what type of item is selected.

 
0
  #17
Nov 27th, 2008
I now understand, thank you. I'm sorry for letting you post a snippet because I cannot understand well what you mean. Thanks again.
An Avalanche In D Minor
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC