Community discussion forum

How to send fax using VB.net

  • 4 years ago

    Hi All,


    I caught the error while running the following code in VB.net 1.1 on my XP.


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


           Try
               Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
               Dim objFaxServer As New FAXCOMEXLib.FaxServer
               Dim objSender As FaxSender
               Dim JobID As Object


               objFaxServer.Connect("LAB1-STU15")
               objFaxDocument.Body = "c:\Test.txt"
               objFaxDocument.DocumentName = "My First Fax"
               objFaxDocument.Recipients.Add("94114619774", "Bud")
               objFaxDocument.AttachFaxToReceipt = True
               objFaxDocument.Note = "Here is the info you requested"
               objFaxDocument.Subject = "Today's fax"
               JobID = objFaxDocument.ConnectedSubmit(objFaxServer)
               MsgBox("The Job ID is :" & JobID(0))


           Catch ex As Exception
               MsgBox("Error number: " & Hex(Err.Number) & ", " & Err.Description)
           End Try
       End Sub



    It gives me foloowing error.


    "Error number: 800710D8, Operation failed."


    I double check all the variables. But those are correct. File is there.
    The exception is  System.Runtime.InteropServices.Exception.


    I don't know what to do.
    I prefer if somebody can help me to solve the problem.
    Pls reply me ASAP.  Since I have to show this project  19th of September.


    Cheers,
    Gayan


  • 4 years ago

    Install a fax printer to send a fax. You need to install a FAX printer before executing this operation on your computer to avoid this error.




    GMIke    


    "I would love to change the world, but they won't give me the source code."


    Enjoy: http://www.developerfusion.co.uk/forums/topic-29704

  • 4 years ago

    Hi GMike,


    Sorry for late reply.
    Yesterday night I have tried it and it works fine.
    Thanks a lot.
    I also read your funny thread.


    Cheers,
    Gayan


  • 4 years ago

    Hi GMike and All,


    As I told you my fax works fine.
    But since I want to enhance the application I used this code for the asp.net web project.
    I checked it with .txt file and it works fiine.
    But when I try to send .doc file it doen't get faxed.
    I put a breakpoint and checked it. Code didn't execute after ConnectedSubmit method.
    It doesn't gave me any error as well. But it tooks lot time but nothing happens.
    I again try with .txt file which is 1kb size. It works fine.
    But for the .doc file which is 20kb file it took lot time. But nothing happens.


    FOr VB.net application it works for both .txt and .doc file.
    So what should I do to get rid of this problem.
    Time is ticking. I need help very ASAP.


    Best Regards,
    Gayan

  • 4 years ago
    Try to set the priority of FaxDocument to Highest, may be this will work although not tested.
    Code:

    objFaxDocument.Priority = fptHIGH
    objFaxServer.Connect("LAB1-STU15")
    objFaxDocument.Body = "c:\abc.doc"



    GMike    

    "I would love to change the world, but they won't give me the source code."  
  • 3 years ago

    Hi ,

    I have the same problem. When I try to send a FAX, it works fine on my local WinXP machime, but when I try on my Win2003 server it doesn't work. Windows fax service is installed on both. There are no differences between the configs.

    I can connect to the sever, list the jobs and much more, but when I try to send a Fax using

    "ConnectedSubmit(faxServer)"

    I get an Exception with the error code "800710D8".

    It's weird, because I can acces all the jobs but can't send a Fax.

    Any idea?

    Thanks!

    Here is my code:

     

     

    Dim objFaxDocument As New FAXCOMEXLib.FaxDocument

    Dim objFaxServer As New FAXCOMEXLib.FaxServer

    Dim objSender As FAXCOMEXLib.FaxSender

    Dim JobID As Object

    Dim devices As FAXCOMEXLib.FaxDevices

    Dim device As FAXCOMEXLib.FaxDevice

    'Error handling

    On Error GoTo Error_Handler

    'Connect to the fax server

    'This doesn't work... :-(

    objFaxServer.Connect("MyFaxServer")

    'This works fine!

    objFaxServer.Connect("")

    'Set the fax body

    objFaxDocument.Body = "C:\test.txt"

    'Name the document

    objFaxDocument.DocumentName = "My First Fax"

    'Set the fax priority

    objFaxDocument.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH

    'Add the recipient with the fax number 12225550100

    objFaxDocument.Recipients.Add("4893310", "Bud")

    'Choose to attach the fax to the fax receipt

    objFaxDocument.AttachFaxToReceipt =

    True

    'Set the cover page type and the path to the cover page

    objFaxDocument.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptNONE

    'objFaxDocument.CoverPageType.FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptNONE()

    objFaxDocument.CoverPage = "generic"

    'Provide the cover page note

    objFaxDocument.Note = "Here is the info you requested"

    'Provide the address for the fax receipt

    objFaxDocument.ReceiptAddress = ""

    'Set the receipt type to email

    objFaxDocument.ReceiptType = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtMSGBOX

    'Specify that the fax is to be sent at a particular time

    objFaxDocument.ScheduleType = FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstNOW

    ' FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstSPECIFIC_TIME

    'CDate converts the time to the Date data type

    'objFaxDocument.ScheduleTime = (CDate("4:35:47 PM"))

    objFaxDocument.Subject = "Today's fax"

    'Set the sender properties.

    objFaxDocument.Sender.Title = "Mr."

    objFaxDocument.Sender.Name = "Bob"

    objFaxDocument.Sender.City = "Cleveland Heights"

    objFaxDocument.Sender.State = "Ohio"

    objFaxDocument.Sender.Company = "Microsoft"

    objFaxDocument.Sender.Country = "USA"

    objFaxDocument.Sender.Email = "someone@microsoft.com"

    objFaxDocument.Sender.FaxNumber = "12165555554"

    objFaxDocument.Sender.HomePhone = "12165555555"

    objFaxDocument.Sender.OfficeLocation = "Downtown"

    objFaxDocument.Sender.OfficePhone = "12165555553"

    objFaxDocument.Sender.StreetAddress = "123 Main Street"

    objFaxDocument.Sender.TSID = "Office fax machine"

    objFaxDocument.Sender.ZipCode = "44118"

    objFaxDocument.Sender.BillingCode = "23A54"

    objFaxDocument.Sender.Department = "Accts Payable"

     

    'Save sender information as default

    objFaxDocument.Sender.SaveDefaultSender()

    'Submit the document to the connected fax server

    'and get back the job ID.

    JobID = objFaxDocument.ConnectedSubmit(objFaxServer)

    MsgBox("The Job ID is :" & JobID(0))

    Exit Sub

    Error_Handler:

    'Implement error handling at the end of your subroutine. This implementation is for demonstration purposes

    MsgBox("Error number: " & Hex(Err.Number) & ", " & Err.Description)

  • 3 years ago

    I receive error: 800710D8.  After searching the error on Google, I found out that the error means that the fax printer isn't installed on the client machine.


    The network fax that is installed on my PC (Win XP Pro SP2) is the fax modem on the server.  The fax icon in "Printers and Faxes" is a MS Shared Fax Driver and clicking on opens up Fax Console.  So I should be able to send a fax through the vb code and that fax should appear in the Fax Console.


    If I have a MS Fax Shared Driver installed then why the error?   Any suggestions on how to resolve the error?

    Thanks.

  • 3 years ago

    can you tell me what refrences you added to your project to make these command lines work

       Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
               Dim objFaxServer As New FAXCOMEXLib.FaxServer
               Dim objSender As FaxSender
               Dim JobID As Object

    i need to send a .doc via a fax with a fax printer








  • 3 years ago

    Main reference you need to install is "MS Fax Service Extended COM Library".  Any idea on the error that I mentioned above?

  • 3 years ago

    only thing i can think of is that they dont have access to your computer or the printer that you are using isnt really set up as  a fax printer

  • 3 years ago

    I am having problem in a somewhat different scenario, which is mentioned below:

    -------------------------------------------------------------------------------------

    "Adobe Reader --
     Faxing a pdf document

    My Dot net(C#) based application sends fax messages. I am using FAXCOMLIB.DLL version=1.0.0.0 (Microsoft's dll used for faxing) and runtime version=v1.1.4322 for sending the fax message. When the application attaches a PDF Document and sends the Fax message, an Adobe Acrobat reader instance gets opened in a minimized state.This happens whenever the application sends a fax message with PDF Document attached, a new instance of Acrobat reader gets opened everytime (in a minimized state) and neither of them closes on completion of sending the Fax message. We have to close all those opened instances of Acrobat Reader manually. This however does not happen while faxing Microsoft word documents.








    I am using the following code:

    --------------------------------

    public

    bool SendFax(string pstrSubject, string pstrMsgFileName,string pstrPDFFileName,

    string pstrUserName, string pstrFaxNumber,string pstrFaxServerName)

    {

    bool bIsService=FaxServiceCheck();

    if(pstrFaxServerName=="(local)")

    {

    pstrFaxServerName=Environment.MachineName;

    }

    FAXCOMLib.FaxServer faxServer =

    new FAXCOMLib.FaxServerClass();

    try

    {

    faxServer.Connect(pstrFaxServerName);

    }

    catch

    {

    MessageBox.Show("Unable to connect the Fax Server, Please make sure the Fax Service is Running.");

    }

    FAXCOMLib.FaxDoc faxDoc1 = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(pstrPDFFileName);

    FAXCOMLib.FaxDoc faxDoc2=(FAXCOMLib.FaxDoc) faxServer.CreateDocument(pstrMsgFileName);

    faxDoc1.RecipientName = pstrUserName;

    faxDoc1.FaxNumber = pstrFaxNumber;

    faxDoc1.DisplayName = "Caravan Messaging System";

    faxDoc2.RecipientName = pstrUserName;

    faxDoc2.FaxNumber = pstrFaxNumber;

    faxDoc2.DisplayName = "Caravan Messaging System";

    try

    {

    int Response = faxDoc1.Send();

    faxServer.Disconnect();

    }

    catch

    {

    }

    try

    {

    int Response = faxDoc2.Send();

    return true;

    }

    catch

    {

    return false;

    }

    }


    If someone can suggest a workaround for this, please advice. "

  • 3 years ago

    Hey did you get the this problem resolved?  I am having the same issue. I can fax the ms word document by printing it to the remote fax server but it does not work from the Visual Basic Code. It fails on ConnectedSubmit(objFaxServer) returning "800710D8"

    Can you please share the fix?

    Thank you...

  • 2 years ago

    Hi dear,

    can u tell me that where i found the dll for FAXCOMEXLib ?

    and that file is work in windows 2000 or not?

    Please tell immediatly i need it.

    Thanks

     

  • 2 years ago

    hi,

     you can find the FAXCOMEX.DLL in windows 2003/SBS server.

  • 2 years ago

    Hi!

    I'm working with the FAXCOMlib library to implement a fax aplication for sending and receiving faxes and I need to get the image that the Windows Fax Machine generates into a temporal folder.

    What can I do to reference the image with the FaxTiff object?

     

    Thank you very much for any information.

  • 2 years ago
    Any information about the faxcomlib faxtiff library?

    Thanks.



  • 2 years ago
       
    Hi All,

    I have read through the previous messages in the this thread relating to the use of VB.Net to send fax, however I would like to know if it is possible to send fax with VB6 and how can I do this? preferably without major cost implications. Can some please give me an example of the code that may be required.

    Thanks,

    Chirag.








  • 1 year ago

    Hi, I managed to write up something  using your guide on the Fax Library.....

    My problem is when I am doing a multi-recipient fax, I get a the error below (I am using VB 2005 Express btw)

    System.IO.FileLoadException: Operation failed.
       at FAXCOMEXLib.FaxDocumentClass.Submit(String bstrFaxServerName)
       at Faxing_SW.Form1.SendFax() in D:\UMS\FaxModule\Faxing SW\Form1.vb:line 98

    This only happens if I try sending more than 1 fax

     I attach my code below for your review.

    Try

    Dim m_TSID = "TEST"

    Dim m_FaxID = "77299875"

    'Dim m_Priority = ""

    Dim n As Integer

    Dim FS As FAXCOMEXLib.FaxServer

    Dim FD As FAXCOMEXLib.FaxDocument

    FS = New FAXCOMEXLib.FaxServer

    FD = New FAXCOMEXLib.FaxDocument

    FS.Connect("")

    '** Build Fax Header

    FD.Sender.TSID = m_TSID

    FD.DocumentName = m_FaxID

    FD.AttachFaxToReceipt = True

    'FD.Priority = m_Priority

    '** Set Recipient

    For x = 8 To (DataList.Length - 2)

    Dim tempArr = DataList(x).ToString.Replace(Chr(13), String.Empty).Split("^")

    FD.Recipients.Add(tempArr(0), tempArr(1))

    Next

    '** Set Sender

    FD.Sender.Name = SenderName

    FD.Sender.Company = CompanyName

    FD.Sender.FaxNumber = SenderFax

    FD.Sender.OfficePhone = SenderTel

    FD.Sender.Title = Title

    '** Set Subject/Body

    FD.Subject = Subject

    FD.DocumentName = DocName

    FD.Body = DocBody

    '** Fax Cover Page

    '** Submit Fax to WinXP Fax Service

    Dim JobID As Object

    JobID = FD.ConnectedSubmit(FS)

    '** Clean Up Objects Here

    FS.Disconnect()

    Catch ex As Exception

    InfoBox.Text = ex.ToString

    MsgBox((
    "Exception message: " & ex.Message & vbCrLf & "Exception Source: " & ex.Source))

    End Try

  • 1 year ago
    Hi, Thanks for your code. I was searching code and i find it in Developerfusion site. Its working fine. I need some more help. Can you tell me how to send bulk fax. I have data like Fax no. and recipient name in data grid now i want to send the fax using for loop for all the data. Thanks in advance Enjoy Programming Medha.net

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!