PdcAttachment.Save: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "== Declaration == Save(FilePath as String) as Boolean == Description == This function saves the attachment in Bemet == Notes == == Code example == This example adds a new..."
 
No edit summary
Line 3: Line 3:


== Description ==
== Description ==
This function saves the attachment in Bemet  
This function locates saves the attachment in Bemet  


== Notes ==
== Notes ==
If the FilePath is an empty string, then it is assumed that the file is located in the Bemet temp directory. In this case the Attachment.FileName is used to locate the file in the temp directory
and to load this file in a steam, before it is saved in the Document Repository, Sharepoint, or the attachment table.<br>
If the FilePath is not empty, it will assume that it contains a full path to the file that you want to save. In this case the path should contain both the filepath and the filename. <br>
<br>
When using Sharepoint, if this file already exists for the specific entity you are copying to ( for example calculation 12345 already has a drawing.pdf, and you are uploading another drawing.pdf)
then it will overwrite this file in the sharepoint folder.




== Code example ==
== Code example ==
This example adds a new attachment to calculationnumber 12345
This example adds a new text file from a specific path to calculationnumber 12345
<source lang="vb.Net">
<source lang="vb.Net">
Dim attachmentlist As PDCEXT.PdcAttachmentList = PDC.App.AttachmentList
Dim attachmentlist As PDCEXT.PdcAttachmentList = PDC.App.AttachmentList
if attachmentlist.Read("DO_CALC", "", "12345") then
if attachmentlist.Read("DO_CALC", "", "12345") then
   dim attachment = attachmentlist.add
   dim attachment = attachmentlist.add
   attachment.filename = "C:\test.txt"
   attachment.Save("C:\test.txt")
   attachment.Save
end if
</source>
 
This example adds a new text file from the Bemet temp directory to calculationnumber 12345
<source lang="vb.Net">
Dim attachmentlist As PDCEXT.PdcAttachmentList = PDC.App.AttachmentList
if attachmentlist.Read("DO_CALC", "", "12345") then
  dim attachment = attachmentlist.add
  attachment.filename = "test.txt"
   attachment.Save("")
end if
end if
</source>
</source>

Revision as of 11:00, 29 November 2023

Declaration

Save(FilePath as String) as Boolean

Description

This function locates saves the attachment in Bemet

Notes

If the FilePath is an empty string, then it is assumed that the file is located in the Bemet temp directory. In this case the Attachment.FileName is used to locate the file in the temp directory and to load this file in a steam, before it is saved in the Document Repository, Sharepoint, or the attachment table.
If the FilePath is not empty, it will assume that it contains a full path to the file that you want to save. In this case the path should contain both the filepath and the filename.

When using Sharepoint, if this file already exists for the specific entity you are copying to ( for example calculation 12345 already has a drawing.pdf, and you are uploading another drawing.pdf) then it will overwrite this file in the sharepoint folder.


Code example

This example adds a new text file from a specific path to calculationnumber 12345

Dim attachmentlist As PDCEXT.PdcAttachmentList = PDC.App.AttachmentList
if attachmentlist.Read("DO_CALC", "", "12345") then
  dim attachment = attachmentlist.add
  attachment.Save("C:\test.txt")
end if

This example adds a new text file from the Bemet temp directory to calculationnumber 12345

Dim attachmentlist As PDCEXT.PdcAttachmentList = PDC.App.AttachmentList
if attachmentlist.Read("DO_CALC", "", "12345") then
  dim attachment = attachmentlist.add
  attachment.filename = "test.txt"
  attachment.Save("")
end if