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..."
 
 
Line 9: Line 9:


== 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 14:02, 28 July 2023

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

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