Hi Ken,
I manage to find the source of the problem. In my function
oExplorer_FolderSwitch(), i assign contact entry id to a variable called
myEntryID.
Everything work fine until I started to move one of my contact (Contact A)
from one folder to another folder. I am able to move Contact A to the another
folder on the first 2 time. After that, I am not able to move it anymore.
When i click on Contact A, the contact screen pop up. If i tried to edit the
name, company or any other contact information and save my changes, it will
prompt the following message:
- The item cannot be saved because it was changed by another user or in
another window. Do you want to make a copy in the default folder for the
item?
The strange thing is if i commented out the line:
myEntryID = oContact.EntryID
then it will work fine. I tried to used Marshal.ReleaseComObject to release
the oContact object but i still get the same problem.
It is anything wrong with my Outlook or it is just my code?
Below is the code for my add-in
My code
----------
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
oExplorer = Me.Application.ActiveExplorer
End Sub
Private Sub oExplorer_FolderSwitch() Handles oExplorer.FolderSwitch
Dim oContact As Object
Dim itemIndex As Integer = 1
Dim myEntryID As String = ""
If oExplorer.Selection.Count 0 Then
For itemIndex = 1 To oExplorer.Selection.Count
oContact = oExplorer.Selection.Item(itemIndex)
If (TypeOf oContact Is Outlook.ContactItem) Then
myEntryID = oContact.EntryID
End If
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oContact)
Next
End If
End Sub
Thanks in advance....
"Ken Slovak - [MVP - Outlook]" wrote:
There's no way to tell other than close study of your code and monitoring
the locals.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"ck" wrote in message
news
Hi Ken,
Thanks for the reply. Do you know how to check what object is referencing
to
a contact item? Fyi, i have set the contact item to nothing and as far as
i
concern, there are no more object are referencing the contact item.
Thanks.