Get whole contact record at once

S

Sam Admin

Hi,
Developing outlook addin for OL2003 / VB2005. I have entryids of
contact items in my database & I want to get contact item from it. I
am fetching contact item with following snippet

cont = Application.Session.GetItemFromId(entryID)

I can get properties of item through writing
myBody = cont.Body OR cont.ItemPropeties("Body").Value
mySubject = cont.Sybject OR cont.ItemPropeties("Subject").Value

But I want to get contact item's whole properties like body, subject,
fullname etc in one record something like

'--------------------------

dim myPropCollection as Object
myPropCollection = GetProperties(cont)
....

'--------------------------
i.e. I don't want to fetch each and every property separately. What
can I do?
Is redemption or exmapi support functions like this?

Thanks in advance
 
K

Ken Slovak - [MVP - Outlook]

No matter what API you use if you want to get or set the value of a specific
property you have to do so one property at a time. You can certainly
retrieve or create a ContactItem, but getting or setting properties on it
are a one property at a time exercise.

Even if you use something like a MAPI Table to retrieve columns of data for
one or more items (rows) you still have to read and evaluate one column at a
time. The same applies if you work with the ItemProperties collection of an
item, you still need to work with one property at a time.
 
S

Sam Admin

No matter what API you use if you want to get or set the value of a specific
property you have to do so one property at a time. You can certainly
retrieve or create a ContactItem, but getting or setting properties on it
are a one property at a time exercise.

Even if you use something like a MAPI Table to retrieve columns of data for
one or more items (rows) you still have to read and evaluate one column at a
time. The same applies if you work with the ItemProperties collection of an
item, you still need to work with one property at a time.

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm


Hi,
Developing outlook addin for OL2003 / VB2005. I have entryids of
contact items in my database & I want to get contact item from it. I
am fetching contact item with following snippet
cont = Application.Session.GetItemFromId(entryID)
I can get properties of item through writing
myBody = cont.Body  OR cont.ItemPropeties("Body").Value
mySubject = cont.Sybject OR cont.ItemPropeties("Subject").Value
But I want to get contact item's whole properties like body, subject,
fullname etc in one record something like

dim myPropCollection as Object
myPropCollection = GetProperties(cont)
...
'--------------------------
i.e. I don't want to fetch each and every property separately. What
can I do?
Is redemption or exmapi support functions like this?
Thanks in advance

Thanks Ken for your valueable reply. That means, I will say, there is
no way to get whole properties as a bunch of collection directly,
right?. All I need to do is get properties one by one only. Also if I
get contact item through GetItemFromID that doesn't mean I am getting
all properties of that item in advance, but rather I need to get
individual properties one by one. Is my assumption correct?

Thanks again
 
K

Ken Slovak - [MVP - Outlook]

Getting a ContactItem or MailItem or any type of Outlook item will normally
retrieve all the properties on that item. That is what is presented to you
as that item. From there you access individual properties on that item.

The only exception to that is if you use the SetColumns() method of a
folder's Items collection. In that case you only load the specified
properties on items when you load them.

The ItemProperties collection of an item is as close as you can get to what
you're talking about, but you still have to access each property
individually to get its value from that collection.




<snip>
Thanks Ken for your valueable reply. That means, I will say, there is
no way to get whole properties as a bunch of collection directly,
right?. All I need to do is get properties one by one only. Also if I
get contact item through GetItemFromID that doesn't mean I am getting
all properties of that item in advance, but rather I need to get
individual properties one by one. Is my assumption correct?

Thanks again
 

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