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 » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

C++, ATL: Access of folder content by index fails



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old October 10th 07, 03:01 PM posted to microsoft.public.outlook.program_vba
Ron
external usenet poster
 
Posts: 128
Default C++, ATL: Access of folder content by index fails

I have a very simple COM-add-in where I try to access a folder.
But the direct access by index fails:

CComPtrOutlook::_NameSpace NameSpace;
m_spApp-GetNamespace(L"MAPI", &NameSpace);

CComPtrOutlook::MAPIFolder InBoxFolder;
CComPtrOutlook::MAPIFolder RootFolder;
NameSpace-GetDefaultFolder(Outlook:lFolderInbox, &InBoxFolder);
InBoxFolder-get_Parent((IDispatch **)&RootFolder);
CComPtrOutlook::_Folders Folders;
RootFolder-get_Folders(&Folders);

Outlook::MAPIFolder * pFolder = NULL;
HRESULT hr = Folders-GetFirst(&pFolder);
ATLASSERT(hr == S_OK);
hr = Folders-Item(CComVariant(0), &pFolder);
ATLASSERT(hr == S_OK);

The second ATLASSERT() fails (out of bounds) whereas the first succeeds! Why?

 




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
Extract word document content and save in MS Access Raju A[_2_] Outlook and VBA 0 September 3rd 07 10:50 AM
Extract word document content and save in MS Access. Raju A[_2_] Outlook and VBA 0 September 3rd 07 10:50 AM
outlook web access fails after installing sharepoint... chentiangemalc Outlook - Installation 3 March 12th 07 07:27 PM
Outlook 2003 Script: How to get the Index or number of items in a Folder news.microsoft.com Outlook and VBA 5 November 6th 06 10:11 PM
Outlook 2003 access to Hamster IMAP fails Darren Outlook - General Queries 0 October 21st 06 06:40 PM


All times are GMT +1. The time now is 11:11 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-2025 Outlook Banter.
The comments are property of their posters.