PdcAttachment.ReadData

From External Bemet Wiki
Revision as of 12:38, 14 October 2025 by TC (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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