![]() |
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
|
|||
|
|||
![]()
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: ![]() 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? |
Ads |
#2
|
|||
|
|||
![]() Got it. The Item property works not zero based. My god. Ron. |
#3
|
|||
|
|||
![]()
=?Utf-8?B?Um9u?= wrote in news:930E0516-
: Got it. The Item property works not zero based. My god. This is because people using the OOM are expected to be using VB, which is 1-based. You should also be careful about assuming that 'true' = 1, and you'll have to do some casting between string types to get things in/out of BSTR. See http://support.microsoft.com/kb/260626/en-us for some sample code, though they're using #import to get the TLB info so the class names are a bit different. -- dan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
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 |