I synch domino server Person, group, MailInDb, Resource & Room object and store in my database making universal ID as unique key. But when i synch again i need to get list of deleted documents so that i can delete them on the base of universal id.
PLease suggest a way out.
Your help is appreciated.
Subject: Loop for synchronizing
There’s no way to get access to the deletion stubs using the built-in languages. It would be possible using the C-API but that’s way to complicated for your issue and not even neccessary.
Just loop over the documents in your database and try to get the originating document using db.GetDocumentByUNID(). If it does not exist, delete the current document.
There are a some dragons here which you might wish to avoid:
-
Don’t delete the documents in the loop, just store the UNIDs in an array or List and delete them in a second loop. You might also add them to a document collection and delete the whole collection afterwards.
-
If you use GetDocumentByUNID you need to implement error handling since this funktion does not return “Nothing” in case the document does not exist, but simply crashes. You might want to use DBGetDocumentByUNID() for this, which implements the errorhandling needed:
Function DBGetDocumentByUnid (db As NotesDatabase, unid As String) As NotesDocument
On Error 4091 Resume Next
Set DBGetDocumentByUnid = Nothing
Set DBGetDocumentByUnid = db.GetDocumentByUnid(unid)
If Err = 4091 And ( DBGetDocumentByUnid Is Nothing ) Then
Err = 0
Set DBGetDocumentByUnid = Nothing
Exit Function
End If
If DBGetDocumentByUnid Is Nothing Then
Set DBGetDocumentByUnid = Nothing
Exit Function
End If
If DBGetDocumentByUnid.Size = 0 Or DBGetDocumentByUnid.UniversalID = "" Or DBGetDocumentByUnid.IsDeleted Then
Set DBGetDocumentByUnid = Nothing
Exit Function
End If
End Function