-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: HarryPotterInIndia
Message 3 in Discussion
This is a bug in MS Services.. when u work out a Windows Service and try using VB
style coding of ... CreateObject or getActiveObject it does not allow u to get the
instance of the Outlook .. but if u do that in Windows Application then it will not be
a probem ... My suggestion to u is that u do not use the "CreateObject " way of
doing things ... use the "ApplicationClass" class instead ... it will work for Windows
Service .. I have faced the same thing .. and I found it is quite managable like this
... 1) add a reference in ur project to the MSOUTL9.OLB or create a typelibrary go
to the command promt and type :-
change to the C:\Program Files\Microsoft.NET\FrameworkSDK\bin directory and then type:
tlbimp "C:\Program Files\Microsoft Office\Office\msoutl9.olb" /out:"C:\Office
Sample\msoutl9.dll" This will create an interop dll for Outlook 2) Start an Outlook
Session by using the ApplicationClass instance and using its logon() function call.
using Outlook; Outlook.Application outlookApp = new Outlook.ApplicationClass();
Outlook.NameSpace outlookSes = outlookApp.GetNamespace("MAPI");
outlookSes.Logon ("exchtest","net",false,true); Here the ApplicationClass will create
an instance of the outlook and the GetNamespace() function call will create a new
outlook profile (session). The logon() function takes parameters in this order :-
profile,password,showdialog,newsession 3) Now we can get into any of the folders
outlook maintains in itself. Lets say we want to get into Inbox folder :-
Outlook.MAPIFolder inboxfolder; inboxfolder =
outlookSes.GetDefaultFolder(Outlook.OlDefaultFolders. olFolderInbox); Outlook
maintains its Folder dir in an enum called "OlDefaultFolders" frm where u can choose
whichever folder u want. NOw once the folder item u get u can enumerate thru it to
check ur mails or u can also use fiter to filter out unread mails from them.
as shown below. Outlook.Items unreadItems = inboxfolder.Items.Restrict("[UNREAD] =
true"); so happy outlooking :)
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]