View Single Post
  #6  
Old March 3rd 09, 10:54 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to specify the "current entry id" to GetItemFromID?

That means the message is not a MailItem. Could be ReportItem, MeetingItem,
etc.
The first parameter in GetIDsOfNames is the name of the property, e.g.
"Class".

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"ryotyankou via OfficeKB.com" u48591@uwe wrote in message
news:92786b09727d7@uwe...
The result of run script is: The MailItem property page is shown. I have
no
idea about the first paramater of GetIDsOfNames, i give it "_MailItem"
which
i saw via OutlookSpy as its value, but return E_NOINTERFACE.
I had another try, if we can get the dispatch pointer, why not to use it
to
QI the MailItem? This is the code i tried, but failed with return value
"E_NOINTERFACE", what's the wrong with my code?

Outlook::_NameSpacePtr NameSpacePtr =
m_spApp-ActiveExplorer()-GetSession()
;
if(NameSpacePtr == NULL)
{
return;
}
Outlook::MAPIFolderPtr inboxFolderPtr = NameSpacePtr-GetDefaultFolder
(Outlook:lFolderInbox);
if(inboxFolderPtr == NULL)
{
return;
}
IDispatch *lpDisp = NameSpacePtr-GetItemFromID(_bstr_t(EntryId),
_variant_t
(inboxFolderPtr-StoreID));
if(lpDisp == NULL)
{
return;
}

HRESULT hr = S_OK;
Outlook::_MailItemPtr spMailItem;
hr =
lpDisp-QueryInterface(__uuidof(Outlook::_MailItem),(void **)&spMailItem)
;
if(SUCCEEDED(hr))//always return E_NOINTERFACE
{
//do my work here
}


Dmitry Streblechenko wrote:
Can you use late binding (IDispatch::GetIDsOfNames/Invoke) to retrieve the
Class property?
What do you see if you run the following script from Outlook Spy (click
"Script Editor" button on the OutlookSpy toolbar, paste the script, click
Run)

BrowseObject(Application.ActiveExplorer.Selectio n(1))

I'm sorry, i typed wrong word, it is not "current" but "correct". My
purpose

[quoted text clipped - 17 lines]
the
_MailItemPtr even it is encrypted Mail item??


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200903/1



Ads