Deleting 'Sent' items NOT in other folders

Posted on 2000-03-17
Last Modified: 2013-12-18
Is there an elegant way to identify items in the sent mail that are not in other folders?   If an item is put into another folder from the 'Sent' folder, and the item is deleted from the sent folder, the 'copy' in the other folder also disappears.   I assume that that is because only a link is set up between the base item and the folder.

Would like to reduce the size of the 'Sent' folder to be only items that are 'stored' in other folders, or, alternatively, find a way to put an actual copy of the document into the folder, instead of a link, then we can delete all the items in the sent folder completely, until the next run of the cleanup.
Question by:mwking
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3

Accepted Solution

Arunkumar earned 500 total points
ID: 2630532
Hi mwking !!!

Here is a simple code to acheive your request.

1. Create a Shared Folder Named "Unique Folder" in your mail db.
2. Create an Agent that runs manually from actions menu and runs on selected documents.
3. Paste the following code in your Agent and save it.
4. Go to the sent Folder and select all documents (Ctrl+A).
5. Use Actions menu and Run the agent that you have created on the selected documents.
6. Watch for the status bar for the script completion.
7. Open the "Unique Folder" to find the documents that are found only in your sent box and not in any other Folders !!!!

Here is the Code for the Agent.....

     Dim ss As New notessession
     Dim ws As New notesuiworkspace    
     Dim db As notesdatabase
     Dim view As NotesView    
     Dim doc As notesdocument    
     Dim tempdoc As notesdocument    
     Dim swapdoc As notesdocument
     Dim dc As NotesDocumentCollection
     Dim Ctr As Double
     Set db = ss.CurrentDatabase
     Set view = db.GetView("($Sent)")
     Set dc = db.UnprocessedDocuments
     Set doc = dc.GetFirstDocument
     Ctr = 1
     Do While Not doc Is Nothing
          unid = doc.UniversalID    
          Flag = "NotFound"
          Forall fols In db.Views                                            
               If Not fols.Name = "($Sent)" Then                    
                    If fols.IsFolder Then                        
                         Set tempdoc = fols.GetFirstDocument        
                         If Not tempdoc Is Nothing Then
                              Do While Not tempdoc Is Nothing                              
                                   unid2 = tempdoc.UniversalID                              
                                   If unid = unid2 Then
                                        Flag = "Found"
                                        Exit Do                                                        
                                   End If                                                                                                                      
                                   Set tempdoc = fols.GetNextDocument(tempdoc)
                         End If                        
                    End If                    
               End If                        
               If Flag = "Found" Then
                    Exit Forall
               End If
          End Forall                    
          If Flag = "NotFound" Then
               Call doc.PutInFolder("Unique Folder")              
               Print Ctr & ". document(s) Put in Unique Folder"
               Ctr = Ctr + 1
          End If
          Set doc = dc.GetNextDocument(doc)
     If Ctr = 1 Then
          Print "All the selected documents are found to be in one more folder(s)"
          Print "Successfully transferred " & Ctr - 1 & " documents to Unique Folder"
     End If

Cool Ain't ???

Good Luck !!!


Expert Comment

ID: 2636024

Lotus notes is a Database. Folders are the result of particular query ...It's a view ... When you delete a message , you delete data ...

sent = all data sended
received = all data receive
forum = all messages with response(s)
-> don't touch ...

You can transfer data in another database but I think is a bad way.

Expert Comment

ID: 2639571
Hi Frache !!!

I'm sorry. I did not get you at all.
Could you be more specific and elaborate on your comment ???


Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 2639888

Lotus Notes is a database "like" Access  ,SQL server, or Oracle.
Each user have a little database who contain all messages.
With a database when you want obtain (extract) data, you make a query.
When you click on sent folder, you execute a query.
When you click on received folder, you execute another query.
A "view" is a particular query.
"sent" folder is a view.
"received" folder is a view.
"all messages" is a view
etc ...
With a view you see a part of your database.
When you create a new folder you create a new query = a new view. Not a "real" folder.

When you delete a message in a view you delete data in your database.

If you want duplicate data you must create a new database, and delete data after.

Expert Comment

ID: 2639892
To create new database you can use replication process.

Author Comment

ID: 2640457
Regarding the comment from 'frache':  Am aware that Lotus Notes/Domino is a DB.   The real issue is how to identify those items that are listed in the sent folder as being tagged into other folders/views, and to avoid deleting those that are tagged into other folders/views, thereby keeping those items that are, in the users eyes, worthy of keeping.

Author Comment

ID: 2640776
On pasting the code into the agent, I get an error message regarding a formula error:
'An operator or semicolon was expected but none was encountered: ss'
referencing the first line of the code.

Did you test this yet??


Expert Comment

ID: 2642868

Make sure that you paste the code in the script options initialise event.

I guess you are trying to paste
it in the formula event.

Good Luck !



Author Comment

ID: 2649716

We are getting errors in the Script Initialise event.   Please review the code and let us know.   The strange stan-alone 'If' is flagged and the error posted is :
"Agentname: Initialize: 34: Unexpected En-of-Line; Expected : Expression"

If we remove the "If", we get a pile of mis-matched "End" statements.

I suspect that there is a condition missing in the version of the code posted above>



Expert Comment

ID: 2660378
Hi Mic,

I have just checked the script that i have posted.

Check - manually from actions menu.
Run on - Selected documents
Copy the code to clipboard

paste it between the sub & End sub of the initialize event.

I did not get any errors and the code is perfectly workin.

All the loops and conditions are complete.  

Good Luck !



Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question