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

Deleted items not updated!!!



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 11th 07, 12:44 PM posted to microsoft.public.outlook,microsoft.public.outlook.program_addins
MON205
external usenet poster
 
Posts: 31
Default Deleted items not updated!!!

Hello all,
I'm developing an Outlook Addin...
I encounter a problem that when my addin perform simple functionality which
is looping through all folders, then when the user work on Outlook move
messages from the inbox to Deleted Items folder, the Deleted Items folder
still empty till you restart the outlook.
In my code, I loop through all folders and get Items an do some process on
them. For testing this problem I removed looping into items and processing
and the problem still.
Finally I found that the problem in "pFolder-get_Items" which when I call,
the problem found, and if I removed this statement, the problem fly...
In my code below, I don't do anything with the _ItemsPtr !!!!!
Where is the problem?!! What I've missed?!!

Here is my code:
//////////////////////////////////////////////////////////////
int MyClass::Start( )
{
m_nCount = 0;
Outlook::_NameSpacePtr pMapi = NULL;
pMapi = m_spApp-GetNamespace( _bstr_t( "MAPI" ) );
if( NULL == pMapi )
{
return 0;
}

HRESULT hr;
_FoldersPtr pFoldersCollection = NULL;
hr = pMapi-get_Folders( & pFoldersCollection );
if( FAILED( hr ) )
{
pMapi-Release( );
pMapi = NULL;
return 0;
}
MAPIFolderPtr pFolder = NULL;
long lFoldersCount = pFoldersCollection-GetCount( );
pFolder = pFoldersCollection-GetFirst( );

for( long lIndex = 0; lIndex lFoldersCount; lIndex++ )
{
ReadFolder( pFolder );
// release...
pFolder-Release( );
pFolder = NULL;
pFolder = pFoldersCollection-GetNext( );
}
// release...
pFoldersCollection-Release( );
pFoldersCollection = NULL;
pMapi-Release( );
pMapi = NULL;
return 1;
}

int MyClass::ReadFolder( MAPIFolderPtr pFolder )
{
_ItemsPtr pItems = NULL;
HRESULT hr;

hr = pFolder-get_Items( & pItems ); // Here is the problem
if( FAILED( hr ) )
{
return 0;
}
// release...
pItems-Release( );
pItems = NULL;

_FoldersPtr pFoldersCollection = NULL;
hr = pFolder-get_Folders( & pFoldersCollection );
if( FAILED( hr ) )
{
return 0;
}
long lFoldersCount = pFoldersCollection-GetCount( );
if( lFoldersCount 0 )
{
MAPIFolderPtr pInnerFolder = pFoldersCollection-GetFirst( );
while( pInnerFolder )
{
ReadFolder( pInnerFolder );
// release...
pInnerFolder-Release( );
pInnerFolder = NULL;
pInnerFolder = pFoldersCollection-GetNext( );
}
}
// release...
pFoldersCollection-Release( );
pFoldersCollection = NULL;

return 1;
}
//////////////////////////////////////////////////////////////
Ads
 




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
Deleted items not updated!!! MON205 Outlook - General Queries 0 April 11th 07 12:44 PM
Remove from server when deleted from 'Deleted Items' - Archiving? [email protected] Outlook - General Queries 1 August 2nd 06 06:34 PM
Auto Empty Deleted Items on Exit OR after X days or X Items accumulated? JDJ Outlook - General Queries 2 May 30th 06 10:48 PM
Inbox, Sent Items & Outbox in Deleted Items in Outlook 2003 & OWA with Exchange splounx Outlook - General Queries 1 February 17th 06 02:22 AM
Recover deleted messages after emptying deleted items folder Gail Outlook Express 2 January 30th 06 05:18 PM


All times are GMT +1. The time now is 08:34 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.