How to specify Cover Sheet from collection in RightFax API?

1.3k views Asked by At

Trying to programmatically send a fax with cover sheet. I have made a custom cover sheet in RightFax (v10.0), but the code doesn't seem to pick it, even though i set the FCSFileName, it still uses the Cover Sheet selected in the Admin Utility as default.

 FaxServer faxServer = new FaxServer();
        faxServer.ServerName = "XXX-XX1";
        faxServer.Protocol = CommunicationProtocolType.cpNamedPipes;
        faxServer.UseNTAuthentication = BoolType.True;

        Fax fax = (Fax)faxServer.get_CreateObject(CreateObjectType.coFax);

        fax.ToName = "xxxx";
        fax.ToFaxNumber = "xxxxxxxxxx";
        fax.ToCompany = "XXX, Inc";
        fax.FromName = "xxxxx";

        fax.HasCoversheet = BoolType.True;
        fax.FCSFilename = faxServer.CoverSheets[6].LongFileName;  //only example of setting the cover sheet i could find online so far

        fax.Attachments.Add(@"c:\Some Invoice.pdf", BoolType.False);
        fax.Send();
1

There are 1 answers

1
Lee McKenna On

Two things will resolve your problem.... First, you set the coversheet you wish to use in the property, OriginalFCSFilename, and second, you must use the ShortFilename value:

fax.OriginalFCSFilename = faxServer.CoverSheets[6].ShortFileName

For our system, we allow users to view/select the coversheet "Name", and our s/w will then get the required short filename via...

fax.OriginalFCSFilename = faxServer.Coversheets(CoversheetName).ShortFilename

The ShortFilename is a value similar to, "^0000008.doc" where the 7 digits are a hex value corresponding to the coversheets (unique) "handle" value in the database.

In erarlier versions of RightFax, the long filename (which is the filename stored on disk) is what what had to be used. This seems to be a change in RF 10.5. This stumped me for the past week, and after looking at the database schema/values, figured this out (why else would they have this if it wasn't used somewhere/somehow).

If you set the HasCoversheet to True, and enter any invalid short filename (or nothing) for OriginalFCSFilename, RightFax will use the user's default coversheet.

NOTE: After the fax is created, if you query for the fax, you will see that this field is "blanked out", and the property, FCSFilename, will be populated with the filename (hexnumber followed by 301) which represents the image file within RightFax.