| Author | 
         | 
         
      
        
         
         adam.kozovo Newbie 
          
 
  Joined: 30 June 2023
 Online Status: Offline Posts: 19
          | 
        
         
          
           | Posted: 16 July 2023 at 3:18am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Hello
 Before calling:
 .Attachments.Add
 .To.Add
 to add to attachments/to collections, is there any method/property to check the existence or duplicate add preventing?
 Thank you
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         adam.kozovo Newbie 
          
 
  Joined: 30 June 2023
 Online Status: Offline Posts: 19
          | 
        
         
          
           | Posted: 16 July 2023 at 3:24am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
For attachments:
 
 For Each Attach As Attachment In AttachmentCollection
 If String.IsNullOrWhiteSpace(Attach.FilenameOriginal) = False Then
     outFileName = Attach.FilenameOriginal
 ElseIf String.IsNullOrWhiteSpace(Attach.Filename) = False Then
     outFileName = Attach.Filename
 ElseIf String.IsNullOrWhiteSpace(Attach.Name) = False Then
     outFileName = Attach.Name
 End If
 If outFileName = AttachmentName Then Return True
 
 First I didn’t know to be on a safe side, which name property should be checked
 
 Second was not sure if there’s a method/property to check existence or duplicate add preventing?
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Alex AfterLogic Support 
          
  
  Joined: 19 November 2003
 Online Status: Offline Posts: 2207
          | 
        
         
          
           | Posted: 20 July 2023 at 6:17am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Hi, there is no such property. And attachments are not filesystem. Two attachments can have the same names and filenames and be different. That's normal and happens all the time.
 
 If you just want to make sure the user, like, doesn't add the same attachment twice, you can use external code for that (like store some list of full filenames with paths of files which have already been added as attachment), i.e. don't rely on MailBee for that.
 
 Regards,
 Alex
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   |