Re: Simple FAX Sample TAPI

From: Leo (ztl_at_hotmail.com)
Date: 04/30/04


Date: Thu, 29 Apr 2004 23:00:31 -0700

Hi Andreas,

I have got a big headache when developing a webapplication using Fax Service
Extended COM objects. These days I have gone through tons of documents and
read MSDN's Fax Service section over and over, this result has been very
frustrating untill find your message here. I think I'm coming to a right
person.

Anyway, my question is about using Fax Service Extended Com API's within a
VS.NET Web Application. First of all, I made a Windows Application just to
test a code sample, "Sending a Fax" provided by MSDN
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fax/faxabo
ut_699l.asp). And, it seems to work after I make very little change to the
sample code.

Then, I went to try "Sending a Fax" from my VS.NET Web Application. My
environment is Windows XP Professional. What I had done is described below.
1) create a VB Web Application project
2) add FAXCOMEXLib to references
3) drag a button onto my Webform
4) put lines of code for the Webform (please look into my code at the bottom
of this message)
5) build, and run this application, I keep getting "err: access denied"

So, I'm asking below questions, and have been trying to get the answers.

Q1. What is the real meaning of "access denied"?
Because the fax just has a body file, and does not have cover page, does
this error mean "access to the body file is denied"?
If it is what it means, what is the reason? The Fax body file is .txt file
which located in a folder which I have even allowed Full Control to
everyone, then why access is denied? And the confusing part is Windows
Application does not give this error.

Q2. Same code works for Windows application, why not for Web application?
MSDN says, in Windows XP, "FaxDocument.ConnectedSubmit and
FaxDocument.Submit are not supported for a remote connection to a fax
server". Does this cause the "access denied" error? But, actually, in my
code, I use "FaxServer.Connect("")" to connect the local server locally.
Furthermore, I tried this web application under Windows Server 2003
(Evaluation version) environment, and I got same error "Access Denied"

Q3. Do I miss anything when using Fax Service in WebApplication or
WebService? or What is correct way to do this?

Andreas, I listed so many things here just because I just really donot know
whatelse I can do to resolve this issue, and it is so critical that my
project must be dead without sovling this problem. I will very very
appreciate your any help. Thanks a million in advance. I just hope somebody
turns on a light in my dark night, thanks.

The following is the code in my web application.
----------code begin-----------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

    SendFaxLocally()

End Sub

Private Sub SendFaxLocally()

    Dim objFaxDocument As New FAXCOMEXLib.FaxDocument()

    Dim objFaxServer As New FAXCOMEXLib.FaxServer()

    Dim objSender As FAXCOMEXLib.FaxSender

    Dim JobID As Object

On Error GoTo Error_Handler

    objFaxServer.Connect("") 'connect to local server

    objFaxDocument.Body = "k:\temp\body1.txt" 'make sure the file exists and
its folder allows enough access rights

    objFaxDocument.DocumentName = "My First Fax"

    objFaxDocument.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH

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

    objFaxDocument.AttachFaxToReceipt = True

    objFaxDocument.CoverPageType =
FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptNONE

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

    objFaxDocument.ReceiptType = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtNONE

    objFaxDocument.ScheduleType = FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstNOW

    objFaxDocument.Subject = "Today's fax"

    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@something.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"

    objFaxDocument.Sender.SaveDefaultSender()

    JobID = objFaxDocument.ConnectedSubmit(objFaxServer)

    Me.Label1.Text = "sent: " & JobID(0)

    Exit Sub

Error_Handler:

    Me.Label1.Text = "error: " & Err.Number & ", " & Err.Description

End Sub

----------code end-------------

Thanks and Best Regards,

Leo
ztl@hotmail.com

"Andreas Marschall [MVP TAPI]" <Andreas.Marschall@I-B-A-M.de> wrote in
message news:e#K9x$#IEHA.3040@TK2MSFTNGP10.phx.gbl...
> "Marc Alcāntara" <marc_alcantara@uol.com.br> schrieb im Newsbeitrag
> news:uCcWaI%23IEHA.3308@tk2msftngp13.phx.gbl...
> > I'm begin to work with Tapi recently, so, a don't know where start's my
> > application :), if somebody have a simple sample send/recive fax please
> > gives to me PLEASE.
>
> Marc,
> See my TAPI and TSPI FAQ:
> Q: Is Fax supported by TAPI ?
> http://www.i-b-a-m.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm#_Q:_Is_Fax
>
> --
> Best Regards
> Andreas Marschall
> Microsoft MVP for TAPI / Windows SDK
> TAPI / TSP Developer and Tester
> http://www.I-B-A-M.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm
> * Please post all messages and replies to the newsgroup so all may
> * benefit from the discussion. Private mail is usually not replied to.
> * This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
>