PdcAttachment.ReadData: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 6: | Line 6: | ||
== Notes == | == Notes == | ||
This function only works for attachments, not for shortcuts | This function only works for attachments, not for shortcuts.<br> | ||
The parameter 'FilePath' must end with a backslash (\). | |||
== Code example == | == Code example == | ||
| Line 16: | Line 17: | ||
For index = 0 to attachmentlist.count - 1 | For index = 0 to attachmentlist.count - 1 | ||
Dim attachment as PDCEXT.PDCAttachment = attachmentlist.Items(index) | Dim attachment as PDCEXT.PDCAttachment = attachmentlist.Items(index) | ||
if attachment.ReadData("C:\temp", Path.GetFileName(attachment.FileName)) then | if attachment.ReadData("C:\temp\", Path.GetFileName(attachment.FileName)) then | ||
msgbox("File is stored on the disk") | msgbox("File is stored on the disk") | ||
else | else | ||
Latest revision as of 12:38, 14 October 2025
Declaration
ReadData(FilePath as String, Filename as String) as Boolean
Description
This function stores the file on the given file path
Notes
This function only works for attachments, not for shortcuts.
The parameter 'FilePath' must end with a backslash (\).
Code example
This example loads all attachments related to calculationnumber 12345 and stores them in the tempfolder
Dim attachmentlist As PDCEXT.PdcAttachmentList = PDC.App.AttachmentList
if attachmentlist.Read("DO_CALC", "", "12345") then
if attachmentlist.Count > 0 then
For index = 0 to attachmentlist.count - 1
Dim attachment as PDCEXT.PDCAttachment = attachmentlist.Items(index)
if attachment.ReadData("C:\temp\", Path.GetFileName(attachment.FileName)) then
msgbox("File is stored on the disk")
else
msgbox($"Something went wrong: {pdc.app.LastError}")
end if
Next
end if
end if