![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi all,
I encountered the following error message while try to move a contact from one folder to another folder. - Cannot move the items. The operation cannot be performed because the message has been changed. For your information, i add event handler for Contact_ItemRemove event. The error will occur when i try to update UserProperties for the particular contact. I am using VSTO SE and Outlook 2007. thanks! |
#2
|
|||
|
|||
![]()
That usually means that you have the item referenced in some other objects
that are causing a conflict, or that you haven't released objects that have a reference to the item in some other location. -- 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 ... Hi all, I encountered the following error message while try to move a contact from one folder to another folder. - Cannot move the items. The operation cannot be performed because the message has been changed. For your information, i add event handler for Contact_ItemRemove event. The error will occur when i try to update UserProperties for the particular contact. I am using VSTO SE and Outlook 2007. thanks! |
#3
|
|||
|
|||
![]()
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. "Ken Slovak - [MVP - Outlook]" wrote: That usually means that you have the item referenced in some other objects that are causing a conflict, or that you haven't released objects that have a reference to the item in some other location. -- 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 ... Hi all, I encountered the following error message while try to move a contact from one folder to another folder. - Cannot move the items. The operation cannot be performed because the message has been changed. For your information, i add event handler for Contact_ItemRemove event. The error will occur when i try to update UserProperties for the particular contact. I am using VSTO SE and Outlook 2007. thanks! |
#4
|
|||
|
|||
![]()
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. |
#5
|
|||
|
|||
![]()
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. |
#6
|
|||
|
|||
![]()
That loop of yours doesn't save anything, it just overwrites oContact and
myEntryID each pass through the loop. Is that just for testing purposes? I'm sort of leery about using ReleaseComObject in loops like that unless I need to. I've found it can destroy any reference to underlying objects, not just the referenced object. For example, I have an Inspector handler with a mail item. I also reference the mail item elsewhere. If I call ReleaseComObject on the item in the Inspector handler it causes any reference to the mail item elsewhere to fire an exception. I'd probably first try setting the oContact object to Nothing instead of calling ReleaseComObject. I see nothing in the code you show that would cause the problem you cite, is that the actual code? How are you moving the items, is it using the UI or using code? Don't forget that if you are doing it in the UI you might be firing the Explorer.FolderSwitch event on that new folder object. I'd probably be using BeforeFolderSwitch for whatever needed to be done for a new folder view and then using Explorer.SelectionChange to handle items in the Selection. Also, don't assume that you will always have an ActiveExplorer object. Outlook can be started using automation with no Explorers. Either use Application.Explorers.Item(1) after checking Application.Explorers.Count or wrap your use of ActiveExplorer in a Try...Catch block. -- 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 ... 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.... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
"operation cannot be performed because the message has been changed"error excel to outlook | somethinglikeant | Outlook and VBA | 0 | April 2nd 08 09:43 PM |
The function cannot be performed because the message has been changed | [email protected] | Outlook - Calandaring | 4 | September 20th 07 08:35 PM |
-832306935 "The operation cannot be performed because the message has been changed." | JohnV@nn | Add-ins for Outlook | 3 | July 17th 07 03:33 PM |
Error:The operation cannot be performed because the message has been changed | s | Outlook - General Queries | 0 | November 15th 06 11:55 AM |
The function cannot be performed because the message has been chan | Mr_Mike_B | Outlook - Calandaring | 0 | May 3rd 06 05:07 PM |