DeleteAttachment

Mon 01 January 2018

Syntax

DeleteAttachment(URLSource, DirAndSysFileName[, PreserveCase])

Description

Use the DeleteAttachment function to delete a file from the specified storage location.

DeleteAttachment does not generate any type of “Are you sure?” message. If you want the end user to verify the deletion before it is performed, you must write your own checking code in your application.

Additional information that is important to the use of DeleteAttachment 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 .

Parameters

Field or Control

Definition

URLSource

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 location.

Note: When the URLSource parameter is specified as a string value, forward slashes (/) are required. Backward slashes (\) are not supported for a string value.

See .

DirAndSysFileName

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

Note: Because the DirAndSysFileName parameter is appended to the URL, it also requires forward slashes (“/”). Backward slashes (“\”) are not supported for this parameter.

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 lower case 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 deleted successfully.

1

%Attachment_Failed

File deletion failed due to an 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 deletion failed due to unspecified error during FTP attempt.

The following are some possible situations where %Attachment_FileTransferFailed could be returned: No response from 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.

This error code applies to the following storage locations: database records only. The following are some possible situations where %Attachment_FileNotFound could be returned:

  • Remote file not found.

  • Failed to read remote file.

10

%Attachment_DeleteFailed

Cannot delete file.

This error code applies to the following storage locations: FTP sites and HTTP repositories. The following are some possible situations where %Attachment_DeleteFailed could be returned:

  • Remote file not found.

  • Failed to read remote file.