Opening a CAlendar Item with PR_Entry_ID

P

PS

Hi All

I have a question related to Outlook. I am accessing a MAPI folder
which contains meeting items. This is not the regular calender
standard folder but a different one which contains the same info. When
I access each item - i can get the PR_Entry_ID property for each item
in that folder.

Now I really want to use that value and open the item so that i can
then access other properties such as subject, start time, end time etc
since those are not availalbe in the regualr item.

I am open to using either Redemption to do so or also Outlook obejct
model whichever works better.

Following is the code i am currently doing:

RDOFolder folder =
rdoSession.Stores.DefaultStore.RootFolder.Folders.Item("AAA").Folders.Item("BBB");

foreach (object item in folder.Items)
{
object mapiObject = item.GetType().InvokeMember("MAPIOBJECT",
BindingFlags.Public | BindingFlags.GetField |
BindingFlags.GetProperty, null, item, new object[] { },
System.Globalization.CultureInfo.InvariantCulture);
}

iPrpID = 0x0FFF0102 //This contains the PR_Entry_ID Val;
header = rdoUtil.HrGetOneProp(mapiObject, iPrpID);
if (header != null)
row["PR_ENTRYID"] = rdoUtil.HrArrayToString(header);


So as you see from above - I get the PR_Entry_ID from above - then I
need to use this value and open the item to access some other
properties such as mentioned above.

Thanks
 
D

Dmitry Streblechenko

Why not use teh valu of teh EntryID property?

foreach (RDOMail item in folder.Items)
{
string entryid = mail.EntryID;

Secondly, there is no reason to use MAPIUtils.HrGetOnePorp, you can use
RDOMail.Fields[].

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
P

PS

The reason I cant use entry id property is because this is not the
standard calendar folder. The value is stored in a named property.

But how do i acheive the second part - my question?

Pratik
 
K

Ken Slovak - [MVP - Outlook]

You use code like Dmitry showed:

foreach (RDOMail item in folder.Items)
{
string entryid = mail.EntryID;
string subject = mail.Subject;
string Body = mail.Body;
}

Why go through all the reflection and late binding and other complications
you have?

If your named property is a UserProperty then: mail.UserProperties[] is
what you want. If not then mail.Fields[] with a property tag matching the
one you used to create the named property. You can do that from
folder.GetIDsFromNames() to get the property tag.
 
D

Dmitry Streblechenko

What named property? You are reading the value of PR_ENTRYID.
Whether a message comes from a default folder or not, makes no difference.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top