![]() |
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
|
|||
|
|||
![]()
I ma writing Outlook COM Addin in VB6. The Addin checks if an item is added
or moved to/from a predefined folder (X) from/to any other folder. It movement happens, it prompts to enter a password. If the password is invalid, the item is restored to original folder. -If mail Added to folder 'X' from folder 'A' -Prompt for password in ItemAdd of 'X'. -If password is invalid, move it back to 'A' Similarly for ItemRemove. As moved Item is not available in ItemRemove, I monitor all the other folders for ItemAdd and store the moved item and use it in ItemRemove. Now, If an item is moved to 'X' and invalid passowrd, it is moved back to say 'A'. And if the same mail is moved again to 'X', and invalid password, then I get an error 'Can't move items.' If some other item is moved, then it works fine. I even tried in C++ COM. I am getting the same error over there. Any help would be highly appreciated. Regards, Kiran |
Ads |
#2
|
|||
|
|||
![]()
It works fine when? Does it work if you try to move it again if you detect
that error? Is that in the same procedure? Does it work if you step your code in the debugger? -- 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 "Kiran" wrote in message ... I ma writing Outlook COM Addin in VB6. The Addin checks if an item is added or moved to/from a predefined folder (X) from/to any other folder. It movement happens, it prompts to enter a password. If the password is invalid, the item is restored to original folder. -If mail Added to folder 'X' from folder 'A' -Prompt for password in ItemAdd of 'X'. -If password is invalid, move it back to 'A' Similarly for ItemRemove. As moved Item is not available in ItemRemove, I monitor all the other folders for ItemAdd and store the moved item and use it in ItemRemove. Now, If an item is moved to 'X' and invalid passowrd, it is moved back to say 'A'. And if the same mail is moved again to 'X', and invalid password, then I get an error 'Can't move items.' If some other item is moved, then it works fine. I even tried in C++ COM. I am getting the same error over there. Any help would be highly appreciated. Regards, Kiran |
#3
|
|||
|
|||
![]()
Do not store items, store the entry ids and reopen the items as needed using
Namespace.GetItemFromID -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Kiran" wrote in message ... I ma writing Outlook COM Addin in VB6. The Addin checks if an item is added or moved to/from a predefined folder (X) from/to any other folder. It movement happens, it prompts to enter a password. If the password is invalid, the item is restored to original folder. -If mail Added to folder 'X' from folder 'A' -Prompt for password in ItemAdd of 'X'. -If password is invalid, move it back to 'A' Similarly for ItemRemove. As moved Item is not available in ItemRemove, I monitor all the other folders for ItemAdd and store the moved item and use it in ItemRemove. Now, If an item is moved to 'X' and invalid passowrd, it is moved back to say 'A'. And if the same mail is moved again to 'X', and invalid password, then I get an error 'Can't move items.' If some other item is moved, then it works fine. I even tried in C++ COM. I am getting the same error over there. Any help would be highly appreciated. Regards, Kiran |
#4
|
|||
|
|||
![]()
Consider the following scenario:
Folder 'X' is protected. 1. If mail1 is moved to folder 'X' from folder 'A' and password is invalid, then the mail1 is restored back to folder 'A'. 2. If mail1 is again moved to folder 'X' from folder 'A' and again password is invalid, then I get error 'Can't move items'. During Debug and otherwise also. If mail2 is moved in step 2, instead of mail1, and password is invalid, then also the mail2 is restored. The problem occurs if the same mail is moved in succession. I am actually moving the parameter item in ItemAdd event handler of folder 'X'. I also monitor all the folders' Items otherthan 'X' for ItemAdd event to identify which item was removed from folder 'X'. If I donot monitor those Items, this error does not occur. In that case I can not identify which item was removed from folder 'X'. Please let me know if you need more information. Regards, Kiran "Ken Slovak - [MVP - Outlook]" wrote: It works fine when? Does it work if you try to move it again if you detect that error? Is that in the same procedure? Does it work if you step your code in the debugger? -- 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 "Kiran" wrote in message ... I ma writing Outlook COM Addin in VB6. The Addin checks if an item is added or moved to/from a predefined folder (X) from/to any other folder. It movement happens, it prompts to enter a password. If the password is invalid, the item is restored to original folder. -If mail Added to folder 'X' from folder 'A' -Prompt for password in ItemAdd of 'X'. -If password is invalid, move it back to 'A' Similarly for ItemRemove. As moved Item is not available in ItemRemove, I monitor all the other folders for ItemAdd and store the moved item and use it in ItemRemove. Now, If an item is moved to 'X' and invalid passowrd, it is moved back to say 'A'. And if the same mail is moved again to 'X', and invalid password, then I get an error 'Can't move items.' If some other item is moved, then it works fine. I even tried in C++ COM. I am getting the same error over there. Any help would be highly appreciated. Regards, Kiran |
#5
|
|||
|
|||
![]()
Show your ItemAdd code, let's see if something jumps out as a problem.
-- 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 "Kiran" wrote in message ... Consider the following scenario: Folder 'X' is protected. 1. If mail1 is moved to folder 'X' from folder 'A' and password is invalid, then the mail1 is restored back to folder 'A'. 2. If mail1 is again moved to folder 'X' from folder 'A' and again password is invalid, then I get error 'Can't move items'. During Debug and otherwise also. If mail2 is moved in step 2, instead of mail1, and password is invalid, then also the mail2 is restored. The problem occurs if the same mail is moved in succession. I am actually moving the parameter item in ItemAdd event handler of folder 'X'. I also monitor all the folders' Items otherthan 'X' for ItemAdd event to identify which item was removed from folder 'X'. If I donot monitor those Items, this error does not occur. In that case I can not identify which item was removed from folder 'X'. Please let me know if you need more information. Regards, Kiran |
#6
|
|||
|
|||
![]()
Hello Ken,
I checked the properties of the mail in 2 instances. The Parent is set to moved folder 'X' in first move. During second move, the parent is set to source folder 'A'. If I do not monitor Items of folder 'A', then there is no issue. But I need to monitor folder 'A' also. Here is my ItemAdd handler. Private Sub mEncryptedItems_ItemAdd(ByVal Item As Object) 'Check password 'If pass word is invalid Dim mail As MailItem Set mail = Item Set tempMail = mail.Move(mSpCurrentFolder) Set tempMail = Nothing End Sub I even tried dereferencing the mail by setting it to Nothing and then use GetItemFromID(entryID, storeID). But no use. Thanks & Regards, Kiran |
#7
|
|||
|
|||
![]()
The code looks OK. I'm wondering if a delay would make any difference, i.e:
Dim mail As MailItem DoEvents Set mail = Item DoEvents Set tempMail = mail.Move(mSpCurrentFolder) Other than that I'm out of ideas. -- 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 Kiran wrote in message ... Hello Ken, I checked the properties of the mail in 2 instances. The Parent is set to moved folder 'X' in first move. During second move, the parent is set to source folder 'A'. If I do not monitor Items of folder 'A', then there is no issue. But I need to monitor folder 'A' also. Here is my ItemAdd handler. Private Sub mEncryptedItems_ItemAdd(ByVal Item As Object) 'Check password 'If pass word is invalid Dim mail As MailItem Set mail = Item Set tempMail = mail.Move(mSpCurrentFolder) Set tempMail = Nothing End Sub I even tried dereferencing the mail by setting it to Nothing and then use GetItemFromID(entryID, storeID). But no use. Thanks & Regards, Kiran |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
move items | Amir Atary | Outlook and VBA | 3 | May 1st 08 03:52 PM |
Move all items to new PC | RBear3 | Outlook - General Queries | 3 | December 28th 07 04:53 PM |
Move old sent items to subfolder | Chris Craven | Outlook and VBA | 1 | July 19th 07 07:23 AM |
Move Items from deleted items to another folder | [email protected] | Outlook and VBA | 1 | February 15th 07 07:27 PM |
Can't delete items or move items in Outlook 2002 | Garret Swayne | Outlook - General Queries | 2 | April 14th 06 08:15 AM |