|
Posted by Peter Foot [MVP] on October 2, 2007, 6:45 am
Please log in for more thread options What are you trying to achieve? If you want to get a specific item from it's
Oid then the most efficient way is to use GetItemFromOid exposed by the
IPOutlookApp interface.
Peter
--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility
> Hi Peter,
> Thankx for the reply.I used it but it did not help me may be
> i
> m not using it correclty.Below is my code in the way i am using..
>
> HRESULT hr ;
> IFolder *pFolder;
> IPOutlookApp2 *pPOOM = NULL;
> IPOutlookItemCollection *pItems;
> IAppointment *pAppt = NULL;
>
> TCHAR tszStartDate[28];
> TCHAR tszEndDate[28];
>
> SYSTEMTIME stStart;
> DATE bstrStart;
> DATE bstrEnd;
> BSTR bstrLocation;
> BSTR bstrNote;
> BSTR bstrSubject;
> long bstrMins;
> int cItems = 0;
> long bstrSensitivity;
> long bstrBusy;
> DWORD index;
> long oidPIM;
>
> char msg[2];
>
> hr = GetPOOM(&pPOOM);
> CHR(hr);
>
> hr = pPOOM->GetDefaultFolder(olFolderCalendar,&pFolder);
> CHR(hr);
>
> hr = pFolder->get_Items(&pItems);
> CHR(hr);
>
> hr = pItems->Add(reinterpret_cast<IDispatch**>(&pAppt));
> CHR(hr);
>
> pItems->get_Count(&cItems);
> if(cItems != 0 )
> {
> hr =GetItemIndexFromOid(pItems,oidPIM,&index);
> CHR(hr);
> sprintf(msg,"%ld",index);
> ::MessageBox(NULL,(LPCWSTR)msg,_T("Index"),MB_OK);
>
> if (SUCCEEDED(pItems->Item(1+index,
> reinterpret_cast<IDispatch**>(&pAppt))))
> {
> hr = pAppt->get_Subject(&bstrSubject);
> CHR(hr);
> ::MessageBoxW(NULL,bstrSubject,_T("Subject"),MB_OK);
>
> }
> }
>
> Please help..
>
> regards
> kapil
>
>
>
|