User Property changes show up on the outlook 2013 UI correctly but it does not show up on the MailItem User Properties in Shared Account between PCs Environment

Hello There,
I have written an Outlook Add-In to add several User Properties to our incoming emails. This add-in will be installed in 100 computers in different states and our Exchange server is hosted in our datacenter in CA. 
Everything works great but there is an odd thing happens and that is when one PC changes a UserProperty Value all the other PCs  show up that change on their outlook UIs but when I get the MailItem object from the same other PC is
not showing the changes. But if I shutdown outlook on that PC and open it up again the changes will be showing up in the MailItem object. It seems to me that MailItem doesn't refresh but UI does.
Does anyone know how I can refresh the MailItem after its UserProperties has been changed from another pc in a shared account environment.   
These are my codes to save a property and show all properties:
Public Sub SaveUserProperty(xName As String, xValue As String)
Dim ns As Outlook.NameSpace = Me.Application.GetNamespace("MAPI")
Dim oMailItem As Outlook.MailItem = Nothing
Dim oUserProperties As Outlook.UserProperties = Nothing
Dim oUserProperty As Outlook.UserProperty = Nothing
Try
oMailItem = ns.GetItemFromID(curMailId)
oUserProperties = oMailItem.UserProperties
oUserProperty = oUserProperties.Find(xName)
If oUserProperty IsNot Nothing Then
oUserProperty.Value = xValue
End If
oMailItem.Save()
Catch ex As Exception
MsgBox(String.Format("{0}: {1}{2}", "SaveProperty", vbTab, ex.Message))
Finally
If Not IsNothing(oUserProperty) Then
Marshal.ReleaseComObject(oUserProperty)
oUserProperty = Nothing
End If
If Not IsNothing(oUserProperties) Then
Marshal.ReleaseComObject(oUserProperties)
oUserProperties = Nothing
End If
If Not IsNothing(oMailItem) Then
Marshal.ReleaseComObject(oMailItem)
oMailItem = Nothing
End If
If Not IsNothing(ns) Then
Marshal.ReleaseComObject(ns)
ns = Nothing
End If
End Try
End Sub
Public Sub ShowUserProperties()
Dim builder As StringBuilder = New StringBuilder()
Dim ns As Outlook.NameSpace = Me.Application.GetNamespace("MAPI")
Dim oMailItem As Outlook.MailItem = Nothing
Dim oUserProperties As Outlook.UserProperties = Nothing
Dim oUserProperty As Outlook.UserProperty = Nothing
Try
oMailItem = ns.GetItemFromID(curMailId)
oUserProperties = oMailItem.UserProperties
For Each oUserProperty In oUserProperties
builder.AppendFormat("{2}:{0}{3}{1}", vbTab, vbNewLine, oUserProperty.Name, oUserProperty.Value)
Runtime.InteropServices.Marshal.ReleaseComObject(oUserProperty)
Next
If (builder.Length > 0) Then
System.Windows.Forms.MessageBox.Show(builder.ToString(), "The UserProperties collection")
End If
Catch ex As Exception
MsgBox(String.Format("{0}: {1}{2}", "ShowUserProperties", vbTab, ex.Message))
Finally
If Not IsNothing(oUserProperty) Then
Marshal.ReleaseComObject(oUserProperty)
oUserProperty = Nothing
End If
If Not IsNothing(oUserProperties) Then
Marshal.ReleaseComObject(oUserProperties)
oUserProperties = Nothing
End If
If Not IsNothing(oMailItem) Then
Marshal.ReleaseComObject(oMailItem)
oMailItem = Nothing
End If
If Not IsNothing(ns) Then
Marshal.ReleaseComObject(ns)
ns = Nothing
End If
End Try
End Sub

Outlook will not see the latest changes downloaded from Exchange (or changed through MAPI bypassing the Outlook Object Model on the local machine) until the MailItem object is completely released and reopened. The explorer list shows the changes since it
is fed off the underlying folder contents table, not the cached MailItem object.
There is nothing you can unless you make sure the MailItem object is released and is never kept referenced fro any prolonged periods of time.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.5 is now available!

Similar Messages

Maybe you are looking for

  • How do I build a model calendar page with three columns and two or three lines per day?

    I am trying to build a Page that has three columns with lines in each column that will be numbered according to each month. Then each month I plan to type in the birth dates, anniversaries, special occasions of my family. There will be over 120 entri

  • Pl/sql web service returning a list of results

    I am able to publish a pl/sql package as a web service that returns a single result. However, when I try to return a list of results, I get an error in jdeveloper when I select the package and invoke publish as web service. I use a simple pl/sql pack

  • Need help me in usage of below given functions when MOAC set

    Hi, Can somebody help me in answering for the below questions? In R12, I set MO:Security profile at responsibility level and the profile has three OUs. Please see the below code. declare v_orgid1 NUMBER; v_orgid2 NUMBER; v_orgid3 NUMBER; v_orgid4 NUM

  • What is InDesign CS6? | Learn InDesign CS6 | Adobe TV

    Learn about Adobe InDesign, the industry-standard publishing application for print publications, interactive PDF documents, digital magazines, and EPUBs. http://adobe.ly/Jo2ssH

  • Question about Java GSS-Kerberos authentication

    Hi, I am new to GSS API. I have a client requirement to use Java GSS Kerberos Authentication instead of using IIS for Integrated Windows Authentication. In IWA, the IE browser automatically picks up the logged-in windows user credentials and passes i