CODE
For Each lbfile As IO.FileInfo In diar3
Dim itemlb1 As String = item.FullName
Dim itemlb As String = Path.GetFileNameWithoutExtension(itemlb1)
Dim lbfile1 As String = lbfile.FullName
'copy the appropriate .lb file
If lbfile.FullName.Contains(itemlb) Then
'make sure it is a .lb file and then release
If lbfile.Extension = ".lb" Then
Try
File.Copy(lbfile1, DEST_LIB + "\" + lbfile.Name, True)
'add to the email
strEmail = strEmail + Environment.NewLine + Path.GetFileName(lbfile1)
Catch e As
'inform of files not copied
strEmail = strEmail + Environment.NewLine + "File could not be copied: " + Path.GetFileName(lbfile1)
End Try
End If
End If
Next
my try catch block tries to copy a file, if a user has it open, it will obviously be unable to do so. if this is the case, it adds a line to my confirmation email saying that the file could not be copied. i want to add the name of the user who is preventing this operation to also be added to the email. i think i probably need to use the system.environment.username? well not exactly but something similar? just not sure how.