I need to delete a file that is located in a windows directory within a workflow. I was thinking about running a vb script but not sure if that is the best way.
Question
Question
I need to delete a file that is located in a windows directory within a workflow.
Replies
I believe that would be the best method for deleting a file in a windows directory. The only issue is permissions to delete the file. Please check this and have workflow possibly running under a service account that would have access to that directory. Also, prior to deleting, you should include a condition to check if the directory exist before deleting the file.
I could use some help with the vb code. could you help
I am needing some help with the vb code to delete this file.
I think you would need to do it in a script activity. https://msdn.microsoft.com/en-us/library/system.io.file.delete%28v=vs.110%29.aspx
Thanks...I was able to get the file to delete when I manually dim the file name....
Dim FileName="c:\ThisFile.txt"
Im not sure how to retrieve the file name from the "For Each File" function... into VB
Im not sure how to dim the variable "FileName"
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports System.IO
Imports Laserfiche
Namespace WorkflowActivity.Scripting.Script
'''<summary>
'''Provides one or more methods that can be run when the workflow scripting activity is performed.
'''</summary>
Public Class Script1
Inherits ScriptClass90
'''<summary>
'''This method is run when the activity is performed.
'''</summary>
Protected Overrides Sub Execute()
'Write your code here.
dim FileName as Laserfiche.Workflow.Activities.ForEach.ForEachFileFlags = GetTokenValue("ForEachFile_CurrentFile_Full Name")
file.delete(FileName)
End Sub
End Class
End Namespace
See your other thread. Please use the Code tag when posting code to make it more readable.