![]() |
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
|
|||
|
|||
![]()
Hello,
I'm using the Items::Restrict method in my addin. I'm looping for all mails that I haven't processed yet depending on a user property and after processing the mail I change this property. I found that changing property when I loop for the restricted items affect the restricted items list. My code is similar to: { _ItemsPtr pItems = NULL; HRESULT hr = pFolder-get_Items( & pItems ); _ItemsPtr pRestrictedItems = pItems-Restrict( "NOT( [Processed] = 1" ); _MailItemPtr pMail = pRestrictedItems-GetFirst( ); long l = pRestrictedItems-GetCount( ); for( long lIndex = 0; lIndex lItemsCount; lIndex++ ) { if( pMail ) { //Procees Mail... // Change the [Processed] user property to 1 // pMail-Save( ); } } } When testing this code, I found that the for loop ends with lIndex = 218 where the lCount = 500. |
Ads |
#2
|
|||
|
|||
![]()
Call Restrict, save all entry ids to a list first, then loop through your
list (rather that the restricted items collection) retrieving the items using Namespace.GgetItemfromID. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "MON205" wrote in message ... Hello, I'm using the Items::Restrict method in my addin. I'm looping for all mails that I haven't processed yet depending on a user property and after processing the mail I change this property. I found that changing property when I loop for the restricted items affect the restricted items list. My code is similar to: { _ItemsPtr pItems = NULL; HRESULT hr = pFolder-get_Items( & pItems ); _ItemsPtr pRestrictedItems = pItems-Restrict( "NOT( [Processed] = 1" ); _MailItemPtr pMail = pRestrictedItems-GetFirst( ); long l = pRestrictedItems-GetCount( ); for( long lIndex = 0; lIndex lItemsCount; lIndex++ ) { if( pMail ) { //Procees Mail... // Change the [Processed] user property to 1 // pMail-Save( ); } } } When testing this code, I found that the for loop ends with lIndex = 218 where the lCount = 500. |
#3
|
|||
|
|||
![]()
Thanks a lot for your reply.
I found that the Items collection is a dynamic collection!!!! You can find strange things he http://msdn2.microsoft.com/en-us/lib...tions_restrict .... "Dmitry Streblechenko" wrote: Call Restrict, save all entry ids to a list first, then loop through your list (rather that the restricted items collection) retrieving the items using Namespace.GgetItemfromID. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "MON205" wrote in message ... Hello, I'm using the Items::Restrict method in my addin. I'm looping for all mails that I haven't processed yet depending on a user property and after processing the mail I change this property. I found that changing property when I loop for the restricted items affect the restricted items list. My code is similar to: { _ItemsPtr pItems = NULL; HRESULT hr = pFolder-get_Items( & pItems ); _ItemsPtr pRestrictedItems = pItems-Restrict( "NOT( [Processed] = 1" ); _MailItemPtr pMail = pRestrictedItems-GetFirst( ); long l = pRestrictedItems-GetCount( ); for( long lIndex = 0; lIndex lItemsCount; lIndex++ ) { if( pMail ) { //Procees Mail... // Change the [Processed] user property to 1 // pMail-Save( ); } } } When testing this code, I found that the for loop ends with lIndex = 218 where the lCount = 500. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is Restrict Dynamic | MON205 | Outlook - General Queries | 2 | April 4th 07 05:34 PM |
Dynamic result by recipient’s name | Pari | Outlook and VBA | 5 | February 12th 07 09:09 PM |
Is a dynamic Map to location possible? | Angyl | Outlook - Using Forms | 0 | July 5th 06 07:00 PM |
embedding dynamic data in signature file | don vito | Outlook and VBA | 3 | June 14th 06 07:12 AM |
Outlook 2003 Dynamic signatures | TheHealingLotus | Outlook - General Queries | 1 | March 9th 06 01:38 PM |