Hi,
I have an app, written in c#, that checks an email inbox (using
cdo/mapi) and does some processing.
I've written a function "WriteToLog File (string text, bool onConsole)"
that checks whether the logfile exists (creates it if not), appends
the text to the file, closes the file and displays it on the console,
if required. It uses StreamWriter to accomplish this.
There is another function "CheckEmail ()" that logs into the email
account, processes the email and logs out.
The program does what I want, except it can't append to the log file
after a it logs into the email account. Displaying on the Console
_always_ works.
I'll show some pseudo code to explain it better:
Main()
{
WriteToLogFile( "1 start Main", true);
CheckEmail();
WriteToLogFile( "8 end Main", true);
}
CheckMail()
{
WriteToLogFile( "2 start CheckMail", true);
// log on to email account
Object vEmpty = Missing.Value;
Session oSession = new Session();
WriteToLogFile( "3 b4 logon", true);
// \/ \/ \/ these get commented out later
oSession.Logon( strProfileName, strProfilePassw ord, vEmpty, true,
vEmpty, vEmpty, vEmpty);
WriteToLogFile( "4 aft logon", true);
// do some stuff...
WriteToLogFile( "5 logging off...", true);
oSession.Logoff ();
// ^^^ these get commented out later on
WriteToLogFile( "6 ...gone", true);
WriteToLogFile( "7 end CheckMail", true);
}
I hope that makes sense to you.
The console displays everything you'd expect:
1 start Main
2 start CheckMail
3 b4 logon
4 aft logon
5 logging off...
6 ...gone
7 end CheckMail
8 end Main
but the log file only displays:
1 start Main
2 start CheckMail
3 b4 logon
If I don't logon and process the emails, the log file works again:
1 start Main
2 start CheckMail
3 b4 logon
7 end CheckMail
8 end Main
To my mind, it would seem that when I open a session the StreamWriter
fails to work.
Does anybody know that I'm doing wrong or how to fix it?
PS I'm using .NET v1.1.4322, CDO 1.2.1 on a Win 2K machine connecting
to an exchange server.
Cheers,
Sandy 0 1319 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: V.C.Sekhar |
last post by:
Hi there,
Can any one please help in getting me Python-Outlook
programming issue clarified.
I just wanted to do the following using Python:
1)Open a New Oulook Mail Window
|
by: Ottar |
last post by:
I've made a program sorting incomming mail in public folder.
The function runs every minute by using the form.timer event.
In Access XP it runs for weeks, no problem. Access 2003 runs the same
code for 6 hours and stops.
I've found the problem to be the Set MySession =
CreateObject("MAPI.Session")
|
by: Ottar |
last post by:
Error: 80040108 after 380 CreateObject("MAPI.Session")
Function MAPI_Test2()
Dim i As Integer
Dim MySession As MAPI.Session
i = 0
While (i < 2000)
Set MySession = CreateObject("MAPI.Session")
Debug.Print i
|
by: Grahame |
last post by:
Hi,
I have an app, written in c#, that checks an email inbox (using
cdo/mapi) and does some processing.
I've written a function "WriteToLogFile (string text, bool onConsole)"
that checks whether the logfile exists (creates it if not), appends
the text to the file, closes the file and displays it on the console,
if required. It uses StreamWriter to accomplish this.
|
by: Kevin Quigley |
last post by:
Hi,
I have a web page that will send emails to various addresses, I've tried
using the SmtpMail class but no matter what I try it will not work.
I have an asp page that does actually work using mapi.session...
<%
Const cStrServer = "sciehex01"
Const cStrMailbox = "weeklyreportuser"
| |
by: PhilHip |
last post by:
I've written a Windows service in VB.Net that accesses the global address
list to obtain all the entries to store them in a local database. The GAL is
accessed using the MS Exchange profile on the current machine. The service
then creates a new MAPI session and then attempts to log on to the session
using the current MS Exchange profile on the machine. Here is the section of
code that is erroring:
Dim oSession As MAPI.Session...
|
by: Sandy Beach |
last post by:
Hi,
I have an app, written in c#, that checks an email inbox (using
cdo/mapi) and does some processing.
I've written a function "WriteToLogFile (string text, bool onConsole)"
that checks whether the logfile exists (creates it if not), appends
the text to the file, closes the file and displays it on the console,
if required. It uses StreamWriter to accomplish this.
|
by: bobh |
last post by:
Hi All,
I've been using this function which I got from here for some time now
in two of my AccessXP multiusers applications and it has worked
without issue until lately it has stopped functioning on several user
pc's and I don't know why. I've asked our PC Services group what they
changed on the pc's that this does not work on and they say 'nothing'.
Well something has changed cause this did work at one time.
When I step thru it in...
|
by: squrel |
last post by:
Hi everyone..
i need ur help once more time.... i have a form called reminder..in tht form i have:
txtid, txtcaseid, txtreminder, cmbremindby(system or user), txtremindto, dtpreminddt, MAPISession1, MAPIMessages1, cmdReminder
in this case i have to set some fix reminder and fix date for every month tht automatically send by the system to some particular people...
i dont knw anything abt mapi control and have never used tht...
got some...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |