Share via

Outlook 2019 Addin savechanges fail with cache mode

Mauricio Poggio Veiro 301 Reputation points
2022-04-19T16:39:17.127+00:00

Hi,

I have an OLK addin which save mapi properties in mail items, without cache mode it's work fine, but if cache mode is enabled it hang with this error:

"MAPI_E_NO_ACCESS"

Sample code (I'm using Redemption):

Public Shared Sub SetCampoMAPIcon_RED2(xItem As Outlook.MailItem, xsCampo As String, xsValor As String, ByRef rMail As Redemption.RDOMail, xbSave As Boolean)
Try

        Dim KEEP_OPEN_READWRITE = 2, PR_MY_PROP As Object
        Dim FORCE_SAVE = 4
        If rMail Is Nothing Then rMail = mRDOSession.GetRDOObjectFromOutlookObject(xItem)
        PR_MY_PROP = rMail.GetIDsFromNames("{00020329-0000-0000-C000-000000000046}", xsCampo) Or &H101E 'PT_UNICODE
        Dim PropValue(0) As String
        PropValue(0) = xsValor
        **rMail.Fields(PR_MY_PROP) = PropValue**   'FAIL HERE
        If xbSave Then **rMail.SaveAs("", FORCE_SAVE)** 'OR FAIL HERE

    Catch ex As System.Exception
        GeneroTrace("SetCampoMAPIconRedemption::", TraceLevel.Error, ex.Message & vbCrLf & ex.StackTrace & vbCrLf & xsCampo & " - " & xsValor)
    End Try
End Sub

any help will be appreciated, thanks!
Mauricio.

Microsoft 365 and Office | Development | Other
Outlook | Windows | Classic Outlook for Windows | For business
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.