The method getDocumentByUNID in NotesDatabase class

The method getDocumentByUNID NotesDatabase class returns the appropriate document for the UniversalUnid passed as argument, but it does not return Nothing if it does not find the document but the error 4091 (lsERR_NOTES_BAD_UNID).
Then a code to handle this would be the following:

	Dim s As New NotesSession
	Dim db As NotesDatabase
	Dim doc As NotesDocument
	Dim unid As String
	Set db = s.Currentdatabase

	unid = "1EC53F4B3D66557BC12579A600404BE2"

	On Error 4091 GoTo Error4091Handler ' lsERR_NOTES_BAD_UNID 
	Set doc = db.Getdocumentbyunid(unid)
	On Error GoTo 0
	Print "Document found"
	Exit Sub
	Print "Document not found"
	Resume Next


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.