![]() |
|
#1
|
|||
|
|||
|
Hi All.
i have a problem with Redemption Objects . i write a add in for outlook. this code must retrieve аll adresses from contact list. i can get the Outlook OOM objects to work fine, but am having trouble creating and using Redemption objects. Here is my sample code to read a contact from the address book and display the email address (bypassing the security prompt using redemption): what wrong? Code:
void __stdcall CMyComAddIN::GetAdresses_Redemption()
{
CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
hr_pro_id = CLSIDFromProgID(L"Outlook.Application",&findCLSID);
hr = olApp.CreateInstance(findCLSID);
pFolder_ = olApp->GetNamespace(L"MAPI",&spNS);
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
HRESULT log = spNS->Logon(covOptional, covOptional, covOptional, covOptional);
spNS->GetDefaultFolder(Outlook::olFolderContacts,&spContacts);
spContacts->get_Items(&spItms);
spItms->GetFirst(&spFirstItem);
CLSID clsid;
CComPtr<Redemption::ISafeContactItem> pSafeContactItem(NULL);
hr_form_prog_id = CLSIDFromProgID(L"Redemption.SafeContactItem", &clsid);
hr_ = pSafeContactItem.CoCreateInstance(clsid);
BSTR emailAddress;
pSafeContactItem->put_Item(pContact_);
pSafeContactItem->get_Email1Address(&emailAddress);
while(spFirstItem)
{
pContact_ = spFirstItem;
CComBSTR emailAddress;
pSafeContactItem->get_Email1Address(&emailAddress);
spFirstItem.Release();
spItms->GetNext(&spFirstItem);
}
spNS->Logoff();
CoUninitialize();
}
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Access Object library 10 | Gyto | Office | 0 | 10-09-2008 09:04 AM |
| Publish custom contact form using Redemption | Zakary | Outlook | 0 | 08-22-2008 07:40 AM |
| Object in SMTPSink looses Value | jehemo2001 | Outlook | 0 | 03-14-2006 02:30 PM |