ISQuestion.DeleteUploadedFile

Description

This function deletes the uploaded file.

Syntax

object.DeleteUploadedFile aIndex

Part Attribute Type Description
object Required
The object always implements the ISQuestion interface
aIndex In, Required
int
The index of the uploaded file to be deleted

Example

Display the number of the files uploaded to the question before and after deleting.

Dim aPatient
Dim aQuestions, aQuestion
Dim aMessage
Dim i
Dim aStream
Dim aFileName

Set aPatient = Profile.SelectPatient   
set aQuestions = Profile.ProfileInternal.LoadQuestionsForPatient(aPatient.ID)
if aQuestions.Count = 0 then
  Profile.MsgBox("No questions")
  exit sub
end if  
set aQuestion = aQuestions.Item(0)
aMessage = aMessage & vbNewLine &_
  "Title: " & aQuestion.Title & vbNewLine &_
  "Amend Date: " & aQuestion.AmendDate & vbNewLine &_
  "Body: " & aQuestion.Body & vbNewLine &_
  "Date: " & aQuestion.Date & vbNewLine &_
  "Patient: " & aPatient.SurnameFirstName & vbNewLine &_
  "Status: " & aQuestion.Status & vbNewLine &_  
  "Uploaded Files Count = " & aQuestion.GetUploadedFileCount & vbNewLine  

set aStream = Profile.MakeStream
aFileName = "hello"
aStream.LoadFromFile("D:\documents\hello.docx")
aQuestion.UploadFile aFileName, aStream
aMessage = aMessage & vbNewLine & "The file '" & aFileName &_
  "' was successfully uploaded to the question '" & aQuestion.Title & "'" &_
  vbNewLine & vbNewLine & "Uploaded Files Count = " &_
  aQuestion.GetUploadedFileCount & vbNewLine
  
aQuestion.DeleteUploadedFile(0)
aMessage = aMessage & vbNewLine & "The first file attatched to the question '" &_
  aQuestion.Title & "' was successfully deleted" &_
  vbNewLine & vbNewLine & "Uploaded Files Count = " &_
  aQuestion.GetUploadedFileCount & vbNewLine
  
Profile.MsgBox(aMessage)  
Note:

In Profile Client v8 on User Interface Uploaded Files can be found and deleted in Organisation > Work Centre > Work > Patient Items > Question Properties > Question > Uploaded Files.

Version information

Added in v7.8.0