PDA

View Full Version : Problems using Fax Archive MessageIterator


Nasko
January 22nd 05, 07:51 AM
hi, i have a problem retrieving messages in incoming & outgoing archive.
here is the code, it's picked from similar sample in MSDN and works fine
under Windows2003 but gives a strange exception with WindowsXP.

[STAThread]
static void Main(string[] args)
{
try
{
FaxServer server = new FaxServerClass();
server.Connect( "" );
server.Folders.OutgoingArchive.Refresh();
FaxOutgoingMessageIterator iter =
server.Folders.OutgoingArchive.GetMessages( 100 );

iter.MoveFirst(); //BREAKS HERE
while( iter.AtEOF )
{
Console.WriteLine( iter.Message.Id );
iter.MoveNext();
}
}
catch( Exception ex )
{
Console.WriteLine( "Ex: " + ex.ToString() );
Console.ReadLine();
}
}

Here is the exception :

System.Runtime.InteropServices.COMException (0x80070103): Operation
failed.
at FAXCOMEXLib.FaxOutgoingMessageIteratorClass.MoveFi rst()
at ConsoleApplication1.Class1.Main(String[] args)

I tried it on other XP machines - sp1 & sp2;
When creating FaxOutgoingMessageIterator or FaxIncommingMessageIterator the
object is created but all fields give exception when accessed.

Note that this happenes in .NET environmet on Windows XP machine only. i
tried VB and C#. When i wrote a simple C++ that use FaxServer, it worked
fine.

To avoind the problem for my project i read the message id's from the
corresponding folder( reading the filenames of the received or sent faxes)
and after that i use GetMessage(id) function to retrieve tha message which
is very ugly solution.

Any suggestions?
thanks

Google