DownloadAttachment Functions
The DownloadAttachment and DownloadAttachmentSession functions download an attachment file from a specified Attachments field in a specified table record. These two functions differ only in respect to parameters for login. For more information, see Login Parameters.
The downloaded file is copied into the Temp folder on the web server. Files downloaded by these functions are cleaned up in 24 hours.
Syntax
The following is the syntax for an HTTP request:
POST /WindchillRiskandReliability12.0/DataEngine.asmx/DownloadAttachment HTTP/1.1
Host: HostName
Content-Type: application/x-www-form-urlencoded
Content-Length: length

UserName=string&Password=string&GroupName=string&ProjectName=string&SystemName=string&Table=string&Identifier=string&AdditionalIdentifier=string&AttachmentFieldName=string&AttachmentName=string
Parameters
In addition to login parameters, both the DownloadAttachment and DownloadAttachmentSession functions use these parameters:
ProjectName—The name of the Windchill Risk and Reliability Project. This value is case-sensitive.
SystemName—The name of the System file. This value is case-sensitive.
Table—The name of the Windchill Risk and Reliability table in which the record is located. This value is case-sensitive.
Identifier—The identifier of the record that you want to modify. This value is not case-sensitive.
AdditionalIdentifier—The second identifier of the record that you want to modify. This parameter is only required for the FMEA Worksheet table. For this table, you must specify the level of the FMEA data. This value is not case-sensitive. Depending on your FMEA data structure, the value can be one of the following: Item, Mode, Cause, Effect, or Action. If custom labels are assigned to data levels in the properties for the Project’s FMEA Design file, you can also use these values.
AttachmentFieldName—The name of the Attachments field with the file that you want to download. This value is case-sensitive.
AttachmentName—The name of the file that you want to delete. You can use ReadRecord functions to read the data in an Attachments field. The returned values are the file names in a semicolon-separated list. For example, assume that the following values are returned for an Attachments field with three attached files: file1.txt; myimage.png; spreadsheet.xlsx
The following is an example of an HTTP POST request:
POST /WindchillRiskandReliability12.0/DataEngine.asmx/DownloadAttachment
HTTP/1.1Host: test
Content-Type: application/x-www-form-urlencoded
Content-Length: length
UserName=Bill&Password=passwd&GroupName=Manager&ProjectName=Tablet PC &SystemName=Tablet PC&Table=System Tree Items&Identifier=System25& AttachmentFieldName=User Attachments 1&AttachmentName=flowchart.jpg
Returns
If the user is authenticated and the specified parameter values are found, the attachment is downloaded and ‘true’ is returned.
<?xml version="1.0" encoding="utf-8"?>
<DataEngineResponse xmlns="http://tempuri.org/">
<Success>true</Success>
<FileAccessCookie>.ASPXFORM=DC602F516313C8DA68560C2F3DA929911597771953E23034E5DDE9DFA0E40BBC889E960F2E3FABA15C765D2D9807F9F329BDC89C06F17ACEC284EA4695DD764C37E2921040478E25AFAE914C3C7EC9373FFD896AD30B3C32B7BC70F80D89F2096B521E068E85524E881C00333A7420DE1563D22EAD89732323E596ACD8346293A07723CB74A2D6C7A9FB01D8389ADBB6</FileAccessCookie>
</DataEngineResponse>
If the call fails, the AdditionalData tag provides the reason for the failure.
If the provided file name matches more than one of the attachments, the first one shown in Windchill Risk and Reliability is downloaded. The file is saved to the Temp folder on the web server with the same name as the file stored in the Attachments table in Windchill Risk and Reliability. A link with this file name is returned.
FileAccessCookie is returned in result response while generating output that needs to be downloaded.
If a file with this name exists in the Temp folder, an (x) prefix is added to the file name, where x is a sequential number. For example, assume that the file name is flowchart.jpg and a file with this name exists in the Temp folder. The file is saved to flowcart (1).jpg.