N
nikolayds via OfficeKB.com
Hi All,
I am migrating my plugin from 2003 to 2007 Outlook.
A following code is throwing me exception:
<code>
COleVariant covIndex;
covIndex.vt = VT_I4;
covIndex.lVal = 1;
olSelectedItem = olSel->Item(covIndex);
CComQIPtr<Outlook::_MailItem> pMailItem(olSelectedItem);
CComPtr<Outlook::_MailItem> pItemT = pMailItem;
Outlook::OlObjectClass oc = pItemT->GetClass(); //works
DATE dt = 0;
dt = pItemT->SendOn; //Fails with exception
CLSID clsid;
hr = ::CLSIDFromProgID(L"Redemption.SafeMailItem", &clsid);
CComPtr<Redemption::ISafeMailItem> spSafeMailItem;
hr = ::CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,__uuidof
(ISafeMailItem),(void**)&spSafeMailItem );
hr = spSafeMailItem->put_Item(pItemT);
BSTR name = SysAllocStringLen(L"", 1000);
hr = spSafeMailItem->get_SenderName(&name); //works
return;
</code>
Exception is address violation.
I strongly suspect the issue is with how the params are passed, because all
functions with parameters on Outlook::_MailItem are failing where all others
are OK.
Here is what I have in StdAfx
<code>
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\mso.dll"
rename("RGB", "RGB_") \
rename("DocumentProperties", "DocProps") rename("FindText", "WordFindText") \
rename("PlaySound", "OfficePlaySound")\
rename_namespace("Office")
using namespace Office;
#import "C:\Program Files\Microsoft Office\Office12\MSOUTL.OLB" rename
("CopyFile", "CopyFile_") \
rename("PlaySound", "OutlookPlaySound")\
rename_namespace("Outlook")
using namespace Outlook;
</code>
The code is working just fine in OL 2003
I am migrating my plugin from 2003 to 2007 Outlook.
A following code is throwing me exception:
<code>
COleVariant covIndex;
covIndex.vt = VT_I4;
covIndex.lVal = 1;
olSelectedItem = olSel->Item(covIndex);
CComQIPtr<Outlook::_MailItem> pMailItem(olSelectedItem);
CComPtr<Outlook::_MailItem> pItemT = pMailItem;
Outlook::OlObjectClass oc = pItemT->GetClass(); //works
DATE dt = 0;
dt = pItemT->SendOn; //Fails with exception
CLSID clsid;
hr = ::CLSIDFromProgID(L"Redemption.SafeMailItem", &clsid);
CComPtr<Redemption::ISafeMailItem> spSafeMailItem;
hr = ::CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,__uuidof
(ISafeMailItem),(void**)&spSafeMailItem );
hr = spSafeMailItem->put_Item(pItemT);
BSTR name = SysAllocStringLen(L"", 1000);
hr = spSafeMailItem->get_SenderName(&name); //works
return;
</code>
Exception is address violation.
I strongly suspect the issue is with how the params are passed, because all
functions with parameters on Outlook::_MailItem are failing where all others
are OK.
Here is what I have in StdAfx
<code>
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\mso.dll"
rename("RGB", "RGB_") \
rename("DocumentProperties", "DocProps") rename("FindText", "WordFindText") \
rename("PlaySound", "OfficePlaySound")\
rename_namespace("Office")
using namespace Office;
#import "C:\Program Files\Microsoft Office\Office12\MSOUTL.OLB" rename
("CopyFile", "CopyFile_") \
rename("PlaySound", "OutlookPlaySound")\
rename_namespace("Outlook")
using namespace Outlook;
</code>
The code is working just fine in OL 2003