PdcAttachment.ReadData: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "== Declaration == ReadData(FilePath as String, Filename as String) as Boolean == Description == This function stores the file on the given file path == Notes == This functi..."
 
No edit summary
 
(2 intermediate revisions 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 ==
This example loads all attachments related to calculationnumber 12345 and stores them in the tempfolder
<source lang="vb.Net">
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
</source>

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