A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Can't move items



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 19th 08, 12:18 PM posted to microsoft.public.outlook.program_addins
kiran
external usenet poster
 
Posts: 24
Default 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

Ads
  #2  
Old May 19th 08, 09:50 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #3  
Old May 19th 08, 09:56 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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



  #4  
Old May 20th 08, 05:14 AM posted to microsoft.public.outlook.program_addins
kiran
external usenet poster
 
Posts: 24
Default 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



  #5  
Old May 20th 08, 03:01 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #6  
Old May 20th 08, 04:11 PM posted to microsoft.public.outlook.program_addins
Kiran[_2_]
external usenet poster
 
Posts: 3
Default 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
  #7  
Old May 20th 08, 08:54 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 08:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.