GetAttachmentURL

Mon 01 January 2018

Syntax

GetAttachmentURL(URLSource, DirAndSysFileName, UserFileName , AttachmentURL [, AuthToken][, ContentURI][, PreserveCase])

Description

Use the GetAttachmentURL function within a Mobile Application Platform (MAP) application to temporarily download a file from its source storage location and return the associated attachment URL. This attachment URL can subsequently be used by the MAP application to temporarily gain secure access to the downloaded file.

Additional information that is important to the use of GetAttachmentURL can be found in the PeopleTools: PeopleCode Developer's Guide :

  • PeopleTools supports multiple types of storage locations.

    See .

  • Certain characters are illegal in file names; other characters in file names are converted during file transfer.

    See .

  • Non-ASCII file names are supported by the PeopleCode file attachment functions.

    See .

  • The PeopleCode file attachment functions do not provide text file conversions when files are attached or viewed.

    See .

Parameters

Field or Control

Definition

URLSource

Specifies a reference to a URL. This can be either a URL identifier in the form URL . URL_ID , or a string. This, along with the DirAndSysFileName parameter, indicates the file's source location.

Note: The URLSource parameter requires forward slashes (/). Backward slashes (\) are not supported for this parameter.

See .

DirAndSysFileName

Specifies the relative path and file name of the file on the file server. This is appended to URLSource to make up the full URL where the file is transferred from. This parameter takes a string value

Note: The URLSource requires "/" slashes. Because DirAndSysFileName is appended to the URL, it also requires only "/" slashes. "\" are NOT supported in anyway for either the URLSource or the DirAndSysFileName parameter.

UserFileName

Specifies the name of the as it was known to the end-user at the time it was originally uploaded as a string value (may be different than the name of the file at the storage location).

AttachmentURL

Returns the attachment URL as a string value.

Specify AttachmenURL as a string variable or a field reference in the form of [ RECORD .] FIELD . You must supply the RECORD only if the record field and your PeopleCode program are in different record definitions.

AuthToken

Specifies the PeopleSoft authentication token to be used to retrieve the file from the file storage location.

The default value for this optional parameter is the empty string.

Important! A MAP application must treat AuthToken as a required parameter.

ContentURI

Specifies the content URI to be used by this function to construct the returned attachment URL. This string value can be specified as:

  • A quoted reference to a PeopleSoft node object (in the form, Node. NODE_NAME ) that has a content URI property with a value that will be used as the content URI. For example:

    "Node.PSFT_HR"
  • A quoted reference to a PeopleSoft URL object (in the form, URL. URL_ID ) that has a URL property with a value that will be used as the content URI. For example:

    "URL.MY_URI_URL"
  • A literal string. For example:

    "http://example.com:8080/psc/ps/"

The default value of this optional parameter is the empty string.

Important! If no value is specified for this parameter or its value is explicitly specified as an empty string, then the value of the content URI property of the default local node is used.

PreserveCase

Specify a Boolean value to indicate whether when searching for the file specified by the DirAndSysFileName parameter, its file name extension is preserved or not; True , preserve the case of the file name extension, False , convert the file name extension to all lowercase letters.

The default value is False .

Warning! If you use the PreserveCase parameter, it is important that you use it in a consistent manner with all the relevant file-processing functions or you may encounter unexpected file-not-found errors.

Returns

You can check for either an integer or a constant value:

Numeric Value

Constant Value

Description

0

%Attachment_Success

File was transferred successfully.

Important! If file type restrictions are changed so that access to a previously uploaded file is now blocked, a call to ViewAttachment will return %Attachment_Success, even though the file and its contents are not displayed.

1

%Attachment_Failed

File transfer failed due to unspecified error.

The following are some possible situations where %Attachment_Failed could be returned:

  • Failed to initialize the process due to some internal error.

  • Failed due to unexpected/bad reply from server.

  • Failed to allocate memory due to some internal error.

  • Failed due to timeout.

  • Failed due to non-availability of space on FTP server.

  • Failed to close SSL connection.

  • Failed due to an unspecified error on the HTTP repository.

    If the HTTP repository resides on a PeopleSoft web server, then you can configure tracing on the web server to report additional error details.

    See .

3

%Attachment_FileTransferFailed

File transfer failed due to unspecified error during FTP attempt.

The following are some possible situations where %Attachment_FileTransferFailed could be returned:

  • Failed due to mismatch in file sizes.

  • Failed to write to local file.

  • Failed to store the file on remote server.

  • Failed to read local file to be uploaded

  • No response from server.

  • Failed to overwrite the file on remote server.

7

%Attachment_DestSystNotFound

Cannot locate destination system for FTP.

The following are some possible situations where %Attachment_DestSystNotFound could be returned:

  • Improper URL format.

  • Failed to connect to the server specified.

8

%Attachment_DestSysFailedLogin

Unable to login to destination system for FTP.

The following are some possible situations where %Attachment_DestSysFailedLogin could be returned:

  • Unsupported protocol specified.

  • Access denied to server.

  • Failed to connect using SSL Failed to verify the certificates.

  • Failed due to problem in certificates used.

  • Could not authenticate the peer certificate.

  • Failed to login with specified SSL level.

  • Remote server denied logon.

  • Problem reading SSL certificate.

9

%Attachment_FileNotFound

Cannot locate file.

The following are some possible situations where %Attachment_FileNotFound could be returned:

  • Remote file not found.

  • Failed to read remote file.