473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Outlook and NT service

Hello
I have problem to connect to Outlook from Nt Service

i am using following code in c#

Outlook.Application oApp=new Outlook.ApplicationClass();
Outlook._NameSpace oNameSpace = oApp.GetNamespace("MAPI");
MAPI.Session oSession = new MAPI.SessionClass();
Outlook.ContactItem oContact=null;
oSession.Logon(Missing.Value , Missing.Value, Missing.Value, true,
Missing.Value, Missing.Value, "server" + "\n" + "username" );

oNameSpace.Logon(oSession.Name ,Missing.Value ,Missing.Value ,true);

(Outlook.MAPIFolder )oContactsFolder =
(Outlook.MAPIFolder)oNameSpace.GetDefaultFolder(Ou tlook.OlDefaultFolders
.olFolderContacts);

this code successfully running in application
but as Nt service i got following error

Error description:
System.Runtime.InteropServices.COMException (0x84140111): The server is
not available. Contact your administrator if this condition persists.
at Outlook.NameSpaceClass.Logon(Object Profile, Object Password,
Object ShowDialog, Object NewSession)

Is anyone knows why this error happends when it runs as service?
thanks
Nagina

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
1 4714
What account are you running the service under? Does it have sufficient
privileges and access rights to Outlook? Have you tried logging onto the
server as that account and run the code then?

Arild

"Nagina Eliav" <na*****@amdocs.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello
I have problem to connect to Outlook from Nt Service

i am using following code in c#

Outlook.Application oApp=new Outlook.ApplicationClass();
Outlook._NameSpace oNameSpace = oApp.GetNamespace("MAPI");
MAPI.Session oSession = new MAPI.SessionClass();
Outlook.ContactItem oContact=null;
oSession.Logon(Missing.Value , Missing.Value, Missing.Value, true,
Missing.Value, Missing.Value, "server" + "\n" + "username" );

oNameSpace.Logon(oSession.Name ,Missing.Value ,Missing.Value ,true);

(Outlook.MAPIFolder )oContactsFolder =
(Outlook.MAPIFolder)oNameSpace.GetDefaultFolder(Ou tlook.OlDefaultFolders
olFolderContacts);

this code successfully running in application
but as Nt service i got following error

Error description:
System.Runtime.InteropServices.COMException (0x84140111): The server is
not available. Contact your administrator if this condition persists.
at Outlook.NameSpaceClass.Logon(Object Profile, Object Password,
Object ShowDialog, Object NewSession)

Is anyone knows why this error happends when it runs as service?
thanks
Nagina

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eric Nelson | last post by:
Experienced, but first time outlook programmer asks... Each day I get an e-mail containing a gzipped tar archive as an attachment. I'd like an automated way to (1) save the archive as-is in a...
1
by: Paul | last post by:
I am using a windows service which accesses Microsoft Outlook. Outlook is supposed to send an email. This works fine when not run in a windows service. I am running the service under my user...
0
by: W Akthar | last post by:
Hi All, I have created a simple Windows Service which needs to be able to send appointments to Outlook. I have no problem makeing a reference to Microsoft Outlook 11.0 Object Library and...
5
by: Greg Robinson | last post by:
Not sure where to post this. At runtime, we need to be able to make sure a user is running Outlook (at least 98 or higher) in order to send an email. So, if a condition is met, we need to...
4
by: Tarren | last post by:
Hi, All: I am tasked with the following. I need to write a service to monitor an Exchange mailbox and take action when an email is received, put it in a db, etc. I do not need to send emails...
1
by: isurug | last post by:
Hello All! I've been trying to come up with a web service which enables me to use outlook remotly with a machine which only has a web browser. I've tried this with windows forms and it worked...
6
by: AMP | last post by:
I am trying to write a windows sevice that will send emails. The data is stored in a database and the service scans the database for new entries It work well as a stardard windows app, but when...
0
by: piotrperak | last post by:
I asked it on Outlook group too, but maybe some of You had similiar problems. I am using CDO. Using it I was able to access Inbox and Sent Items of: Outlook 2003 from Windows app and Windows...
1
by: robnoper | last post by:
XP SP2, access and outlook 2003 I have a form with 3 command buttons on that when one is pressed it opens up a html email for the user to send. Two of the emails work fine and open with the full...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.