My company obtained some Lotus Notes databases that we have been asked to process, by going through all the documents in the databases and giving them sets of data from the documents. When we attempt to process them, we run into errors when we are stepping through the documents.
We are trying to access the databases through our own dummy profile, so I’m guessing we’re using the database’s -Default- ACL settings, which is, according to NotesPeek:
name “-Default-”
access-level NoAccess
flags NoDelete PublicReader
Here is example code (written in VB6):
'-------------------------------------------------------
Dim session As Domino.NotesSession
Dim database As Domino.NotesDatabase
Dim docarray As Domino.NotesDocumentCollection
Dim document As Domino.NotesDocument
Dim i As Long
Set session = New Domino.NotesSession
session.Initialize 'no username, no password
Set database = session.GetDatabase(vbNullString, “C:\problemNSF.nsf”) 'not on a server, file is local
If Not database.IsOpen Then Err.Raise -1, “Database is not open”
Set docArray = database.Search(“SELECT @ALL”, Nothing, 0) 'Get all the documents in the database
If docArray.Count = 0 Then Err.Raise -1, “No documents found”
Set document = docArray.GetFirstDocument()
For i = 1 To docArray.Count
Debug.Print document.UniversalID
Set document = docArray.GetNextDocument(document) '<--- ERROR : Argument has been deleted
Next
'-------------------------------------------------------
On the line where I have the error comment, partway through execution do I get that “Argument has been deleted” error, on that line, and when I look at the document object, some of it’s properties are:
Created = #12:00:00 AM#
IsDeleted = False
IsValid = False
LastModified = #12:00:00 AM#
NoteID = “”
NotesURL = “notes: ///__40DE593A16FB0445.nsf/0/000800006000D2140000001400000013?OpenDocument”
UniversalID = “”
For the NotesURL, I changed the replica ID posted, but it is an actual NotesURL (the replica ID is valid), but when I try to run it to open the document, I get “The document specified by the link cannot be located within the linked-to database,” and the UniversalID specified in the NotesURL didn’t exist in the database, even as a deletion stub.
I also tried changing it so at the point I had the error, I’d call GetNthDocument and specify an index higher than where I was, but each call would always return the same document object that seemed to point to some nonexistant document.
And in the Lotus Notes client itself, I can only actually see a dozen documents in the database’s InBox. I can’t even see the All Documents view to try and check that, and the view ($All) doesn’t exist in the backend either. I believe it is not a problem with all the documents themselves, as I can see every document in the database through NotesPeek, but is there any way to skip that problem point or not retrieve that document or to have Notes rebuild it or anything?
Thank you for your help.
EDIT: Problem seems to be ACL related. I used a bit of code found here ( http://www.codestore.net/store.nsf/unid/BLOG-20031110 about halfway down the page, posted by a Ed Wrenbeck), that disables Uniform Access in a Notes database and I was able to see everything inside the database as well as have the script run without a problem.