G
Guest
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.
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.