get_message_content NSSOAP Methods

The get_message_content method retrieves the content of a fax server message, such as a sent or received fax image, in the form of a byte array.  This method requires a message handle to identify the message, and a content handle to identify the specific content from the message to retrieve.  Handles for all content belonging to a message can be obtained by calling get_message_q or get_message.

GET_MESSAGE_CONTENT_RESULT get_message_content(
  string       user_name, // Fax server user name
  string       user_password, // Fax server user password
  string       message_handle, // Handle of message
  string       content_handle, // Content handle from message 
  CONTENT_TYPE return_format // File and image format for returned content
)

Parameters:
user_name A NET SatisFAXtion user name.

user_password The password for the user.

message_handle A message handle that specifies the message to access

content_handle A content handle that specifies the exact message content to retrieve.  An e-mail message can contain more than one form of content.  Content handles are located in the CONTENT_INFO object that is returned with Q_MESSAGE objects from the get_message_q and get_message methods.

return_format Specifies the file and image format for the returned content.  Must be set to a member of the CONTENT_TYPE enumeration, but limited to Unknown, TIFF and PDF formats.

A value of Unknown will return the content in its current format.  Received fax images are maintained on the fax server in TIFF T6 (Group 4 fax) format.

The PDF option, that embeds a fax image in a PDF file, is available with a NET SatisFAXtion PDF conversion license.

enum CONTENT_TYPE {
  Unknown, // Return content in current format.
  T6, // Return TIFF T6 (Group 4 fax)
  PDF_T6 // Return PDF that contains a TIFF T6 fax
}

Return Value:
A GET_MESSAGE_CONTENT_RESULT object containing a result code and string, and a byte array containing the returned content

Example:
public bool get_fax_message(string message_handle,
                            string dest_filename)
  {
  NSSOAP ns = new NSSOAP();
  
  GET_MESSAGE_RESULT gmr =
    ns.get_message("supervisor","",message_handle);
                 
  if (gmr.status_num == STATUS_NUM.NoError)
    {
    CONTENT_INFO[] contents = gmr.q_message.content_info;
    
    if (contents.Length > 0)
      {
      GET_MESSAGE_CONTENT_RESULT gmc =
        ns.get_message_content("supervisor",
                               "",
                               message_handle,
                               contents[0].content_handle,
                               CONTENT_TYPE.T6);

      if (gmc.status_num == STATUS_NUM.NoError)
        {
          // Save byte array to file

        FileStream fs = new FileStream(dest_filename,FileMode.Create);
        
        fs.Write(gmc.content_data,0,gmc.content_data.Length);
        
        fs.Close();
        
        return(true);
        }
      }
    }
  
  return(false);
  }

See Also:
get_message_q, get_message