GET_FILE_FUNCTION

CAS Tags
The GET_FILE_FUNCTION function retrieves a file from the server that is part of the content of a message.  This function requires a MESSAGE_HANDLE tag to identify a message, a CURRENT_FILESPEC tag to identify a file belonging to the message, and a DESTINATION_FILESPEC tag specifying a destination file name.  The names of files belonging to a message can be obtained using the GET_Q_ENTRIES_INFO function.  

You must provide valid REGISTERED_NAME and REGISTERED_PASSWORD tags in the taglist for this function to execute.  This function allows a user to access their own message files, and a supervisor to access message files belonging to any user.


XML Interface:
The DESTINATION_FILESPEC tag is not used with this function in the CAS XML Interface.  Instead, the response taglist includes a CONTENT_DATA tag that contains the retrieved file.  The file is encoded in base64 format.  For more information, see the XML example below or Working with Files in the CAS XML Interface.

  Type Max Size Multiple Allowed
Function N/A No

Example #1 (ActiveX Interface): 
function GetMessageFile( MsgHandle, MsgFileName, DestinationFile )
  {
  var Tl = CAS.New();
  CAS.AddTag(Tl,"GET_FILE_FUNCTION","");
  CAS.AddTag(Tl,"REGISTERED_NAME",UserName);
  CAS.AddTag(Tl,"REGISTERED_PASSWORD",UserPassword);
  CAS.AddTag(Tl,"MESSAGE_HANDLE",MsgHandle);
  CAS.AddTag(Tl,"CURRENT_FILESPEC",MsgFileName);
  CAS.AddTag(Tl,"DESTINATION_FILESPEC",DestinationFile);

    // Get file on this already open session
  Tl = CAS.Send(Instance,Tl);

  CAS.Delete(Tl);
  }

Example #2 (XML Interface): 
function GetMessageFile( MsgHandle, MsgFileName, DestinationFile )
  {
  var Tl = xmlTlNew();
  xmlTlAddTag(Tl,"GET_FILE_FUNCTION",null);
  xmlTlAddTag(Tl,"REGISTERED_NAME",UserName);
  xmlTlAddTag(Tl,"REGISTERED_PASSWORD",UserPassword);
  xmlTlAddTag(Tl,"MESSAGE_HANDLE",MsgHandle);
  xmlTlAddTag(Tl,"CURRENT_FILESPEC",MsgFileName);

  var responseXML = xmlTlSend(Tl,Domain,Server,Protocol,ProxyURL);

  if (xmlTlGetTag(responseXML,"STATUS_NUM") == 0)
    {
      // Extract file from XML and convert from base64

    FBX.base64_decode_to_file(xmlTlGetTag(responseXML,"CONTENT_DATA"),
                              DestinationFile);
    }
  }

See Also:
Get File Function, MESSAGE_HANDLE, CURRENT_FILESPEC, DESTINATION_FILESPEC, GET_Q_ENTRIES_INFO, REGISTERED_NAME, REGISTERED_PASSWORD