}//main()

  ///<summary>FaxSend</summary>
  public static void FaxSend
  (
   ref UtilityFaxArgument  utilityFaxArgument,
   ref String              exceptionMessage
  )
  {

   int             faxDocStatus                    =  -1;

   object          faxServerClassDocument          =  null;
   
   FaxDoc          faxDoc                          =  null;
   FaxServerClass  faxServerClass                  =  null;
   
   if ( utilityFaxArgument.FaxDocument == null || utilityFaxArgument.FaxDocument == String.Empty )
   {
    return;
   }//if ( utilityFaxArgument.FaxDocument == null || utilityFaxArgument.FaxDocument == String.Empty )    	

   try 
   {
    faxServerClass = new FaxServerClass();
    
    faxServerClass.Connect( utilityFaxArgument.FaxServerName ); //specifies the machinename
    
    faxServerClassDocument = faxServerClass.CreateDocument
    (
     utilityFaxArgument.FaxDocument
    );
    
    faxDoc = ( FaxDoc) faxServerClassDocument;
    
    faxDoc.FaxNumber = utilityFaxArgument.FaxNumber;
    faxDocStatus = faxDoc.Send();

    UtilityDebug.Write
    (
     String.Format
     (
      "Fax Status: {0}",
      faxDocStatus
     )
    );

    faxServerClass.Disconnect();

   }//try
   catch ( Exception exception )
   {
    UtilityDebug.Write
    (
     String.Format
     (
      "Exception: {0}",
      exception.Message
     )
    );
   }//catch ( Exception exception )   	
    
  }//public static void FileImport()
Exemple #2
0
        public static void FaxDocument(string server, string document, string receiver, string receiverName, string sender)
        {
            FaxServer faxServer = new FaxServer();
            FaxDoc    doc       = null;
            int       response  = -11;

            try
            {
                faxServer.Connect(server);
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to connect to server: " + e.Message);
            }

            try
            {
                doc = (FaxDoc)faxServer.CreateDocument(document);
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to create document: " + e.Message);
            }

            try
            {
                doc.FaxNumber     = receiver;
                doc.RecipientName = receiverName;
                doc.DisplayName   = sender;
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to assign Fax Properties: " + e.Message);
            }


            try
            {
                response = doc.Send();
                Console.WriteLine(response + " Send successfully");
            }
            catch (Exception e)
            {
                Console.WriteLine(response + e.Message);
            }

            try
            {
                faxServer.Disconnect();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error during disconnect from server: " + e.Message);
            }

            Console.WriteLine("Done");
            Console.ReadKey();
        }