I am ‘fixing’ some documents in my db that have started to give a “No MIME data” error when accessed via the web. My ‘fix’ consists of opening the documents in edit mode in the client and saving them (without making changes).
I attempted to automate this using LS, but after a NotesDocument.Save (True, True), the document still produced the same error. However when I use the NotesUIDocument.Save method, the document is ‘fixed’.
Can anyone let me know:
-
What is the difference between these two methods (code below)?
-
How I can replicate the behaviour of the NotesUIDocument.Save in the NotesDocument class. I want to ‘fix’ an entire view of documents at once as there are hundreds of them, so dont want to have to open each one by hand …
Gail
Code:
METHOD 1: (works on selected document)
Dim session As New notessession
Dim result As Boolean
' Get the current document
Set doc = session.DocumentContext
If Not doc Is Nothing Then
Call doc.save(True,True)
End If
METHOD 2: (works on open document only)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
uidoc.EditMode = True
Call uidoc.Save
uidoc.EditMode = False
Subject: Difference between Save method in NotesUIDocument and NotesDocument
Gail,I would suggest u to use “ComputeWithForm” method before saving the doc. The error u r getting could be a result of field translation or default value formula.
Subject: RE: Difference between Save method in NotesUIDocument and NotesDocument
Thanks for the suggestion. I have tried: doc.ComputeWithForm(True,True)
with no success in my original script (before I moved to UIDocuments) so I am still looking for a solution …
Subject: Difference between Save method in NotesUIDocument and NotesDocument
NotesUIDocument.Save works on the frontend.NotesDocument.Save works on the backend.
In theory, NotesDocument.ComputeWithForm will compute all the fields with the form, which is normally done through the frontend, which is why its result should be the same as the UI save.
However, this is not always true; for instance you may have computed-for-display fields in the form. If a computed field has a formula based on a computed-for-display field, it will work when saved in the UI, and fail when saved in the backend (where the computed-for-display field is not available).
So, in theory, if the form does not contain any error, all the valdiation fields are OK, and there are no computed-for-display fields, the ComputeWithForm should work.
Try looking at the fields in the backend through the properties to see what fields are updated correctly when you save? This should hint you to why it is not working through the backend.
HTH
Nicolas Abesdris
Quintessence e-solutions Inc.