Why Getmimeentity doesn't work

This will help some people I think.Why method Getmimeentity of notesItem or notesDocument object doesn’t return anything despite the fact that when you check the fields in the document properties box (in the notes client) you see that your field is well of type Mime part.

I’ve been searching for 2 long days, I’ve read many topic on IBM notes/domino 6 and 7, 8.5 forums, with the same problems but never seen a solution.

Now I’ve got it!!!

You have to “kill” the notesdocument object (set doc = nothing) by wich you call the agent or routine and recreate a new notesdocument object (from the notesid for exemple) and there you can access your notesMIMEentity.

With this solution I don’t know how to treat a collection of document! Maybe by creating a list with the docUnID.

So to finish I give you my code to help you understand my explanations.

The goal of my code is to convert a Richtext field into HTML

session.Convertmime=False

Set db = session.CurrentDatabase

Set collection = db.UnprocessedDocuments

Set doc = collection.GetFirstDocument()

'While Not(doc Is Nothing) 'cannot be used

If Not doc Is Nothing then

docUnid = doc.Universalid

Set doc = nothing 'kill the notesdocument

Call convertDoc2Html (docUnid) 'convert the content of a richtext field into HTML

End If

'Set doc = collection.GetNextDocument(doc) 'cannot be used anymore

'Wend

session.Convertmime=True

I Hope that this can help somebody.

Isabelle