Getting 'officelocation' from current item

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. This is probably a simple solution, but for the life of me, I can't
figure it out.

I have a macro that takes values from a completed outlook form and places
this into an excel file. This is to simplify the data-entry required. I
simply open the email, run the macro, and go to the next. It is working for
both outlook properties (SentOn) and for my own userdefined properties within
the form (Question a).

Everything works well, but I am trying to grab the officelocation property
value for the person who sent the email/form to me. The problem is, I am
unsure of how to do it. Below is some sample code (that is working) that
puts the SentOn date and the result of Question a into my excel file.

All I want to do now is to put the contact's officelocation into the same
excel file.

ApExcel.Cells(i%, 2).value = myinspector.CurrentItem.SentOn
ApExcel.Cells(i%, 5).value =
myinspector.CurrentItem.UserProperties("Question a")

Thanks!

Chris
 
Are you using Exchange? Meaning, you are referring to the sender's Address
Book properties dialog (and the Office property on the general tab), and not
a Contact form?

If so, you need to use CDO to access the AddressEntry object for the sender
of the e-mail. You can then lookup CdoPR_OFFICE_LOCATION (&H3A19001E) in the
AddressEntry.Fields collection.

Otherwise, if you are not using Exchange, and you want the value of the
Office field on the Details tab of a Contact form, then the Outlook Object
Model equivalent of the AddressEntry object doesn't give you much
information. You must use the AddressEntry.Name or AdAddressEntry.Address
properties to search for that information in your Contacts folder. Then you
can access the ContactItem.OfficeLocation property.
 
Back
Top