Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Can't move items (http://www.outlookbanter.com/add-ins-outlook/72219-cant-move-items.html)

kiran May 19th 08 12:18 PM

Can't move items
 
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


Ken Slovak - [MVP - Outlook] May 19th 08 09:50 PM

Can't move items
 
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



Dmitry Streblechenko May 19th 08 09:56 PM

Can't move items
 
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




kiran May 20th 08 05:14 AM

Can't move items
 
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




Ken Slovak - [MVP - Outlook] May 20th 08 03:01 PM

Can't move items
 
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



Kiran[_2_] May 20th 08 04:11 PM

Can't move items
 
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

Ken Slovak - [MVP - Outlook] May 20th 08 08:54 PM

Can't move items
 
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




All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com