This applies to all versions from R4.5 to R7 as the user base here covers them all!
I have inherited some code that was supposed get all encrypted documents in a person’s mail file and decrypt them. This was sent as a button in a mail to the user’s as they would need to use their own ID to decrypt the mail.
Here are the original lines of code that caused some problems, and it’s with regards to these that I need answers, if you have them:
Dim dateTime As New NotesDateTime("01/01/01")
Set db = session.CurrentDatabase
formula = "@ismember(""$Seal"";@docfields)"
Set collection = db.Search(formula,dateTime,0)
The problem here was that this did not select all encrypted documents. I could see four possible reasons why this may have happened, and have three questions that would need answering, I answered one myself!
Obviously, the first potential problem would be the cut-off date. This is easily dealt with, although some of the unencrypted mails were after this date, so it would seem that this was not the problem.
The second potential problem is that looking for $Seal field does not always return all encrypted documents. Can you confirm if ALL encrypted documents have a $Seal field?
The third potential problem is the formula being used to find the $Seal field. Have you had any experience of problems using @IsMember? Would {“$Seal”=@DocFields} be better?
The fourth would be that there is a problem with the NotesDatabase.Search method. Have you had any experience with this?
Personally, I don’t tend to use @IsMember or db.Search as I vaguely remember having had unexpected results in the past, although this was several years ago, when R4 was just released, but as some users are still using R4.5 clients, this may be a factor, but I can’t say for sure. What is your opinion on this?
Obviously, with all these ifs and buts, this would take time to iron out, so I set the collection to be ALL documents in the database. This works perfectly, on small mail files, but once they get too big, there is a problem, the code falls over or the users abort it as it takes far too long to run on 70000 documents!
My solution to this would be to run an agent on the server at night, which puts all encrypted documents in a folder and then when the user presses the button, the code would only have to run on these documents in the folder. We would also eleminate users who had no encrypted documents in their mail fie at this stage too.
But I need a way of identifying these encrypted emails. Do they all have a $Seal field? Or do they all have a $SealData field? Can you confirm this?
Any help would be appreciated, as this is driving me nuts!
TIA
Charlie