How to set a contact's emailaddress1, emailaddress2, emailaddress3?

Status
Not open for further replies.
R

ryotyankou

I want to update the contact's info or create new contact with emailaddress1,

emailaddress2 and emailaddress3. For new contact, i use IAddrBook::

CreateOneOff, it works great. But i don't know how to update the three

emailaddress, for example: user can set the following combine for three

emailaddresses.

1. None. No emailaddress will be set.

2. First only first emailaddress will be set.

3. Second //no need for explaination, right :)

4. Third

5. First && Second

6. First && Third

7. Second && Third

8. First, Second and Third

I tried to use SetProps and pass empty string in, the contact's emailaddress

will be empty, it's ok, but the associated entry in addressbook is still

there.

Do i need to DeleteEntries to remove it?

Another question, whether an IMessageStore can only have one Addressbook? I

don't quite understand the difference between GetDefaultDir and GetPAB.

(Default DIR and PAB).

Thanks in advance.


200911
 
Are you setting these properties on teh IMailUser object returned by the OAB

address book provider or teh underlying IMessage in one of the contacts

folders?

Dmitry Streblechenko (MVP)

-

"ryotyankou " <u48591@uwe> wrote in message

news:9f3ddc267280b@uwe...
> I want to update the contact's info or create new contact with
> emailaddress1,
> emailaddress2 and emailaddress3. For new contact, i use IAddrBook::
> CreateOneOff, it works great. But i don't know how to update the three
> emailaddress, for example: user can set the following combine for three
> emailaddresses.
> 1. None. No emailaddress will be set.
> 2. First only first emailaddress will be set.
> 3. Second //no need for explaination, right :)
> 4. Third
> 5. First && Second
> 6. First && Third
> 7. Second && Third
> 8. First, Second and Third
> I tried to use SetProps and pass empty string in, the contact's
> emailaddress
> will be empty, it's ok, but the associated entry in addressbook is still
> there.
> Do i need to DeleteEntries to remove it?
> Another question, whether an IMessageStore can only have one Addressbook?
> I
> don't quite understand the difference between GetDefaultDir and GetPAB.
> (Default DIR and PAB).
> Thanks in advance.

> >
> 200911
>
 
Take no care about which interface i used to set these properties, would you

please tell me how to update them to reach my purpose in both situations(the

IMailUser and IMessage). TIA.

Dmitry Streblechenko wrote:
> Are you setting these properties on teh IMailUser object returned by the OAB
> address book provider or teh underlying IMessage in one of the contacts
> folders?
>
> >I want to update the contact's info or create new contact with
> >emailaddress1,

> [quoted text clipped - 20 lines]
> > (Default DIR and PAB).
> > Thanks in advance.



200911
 
Another questions, What's the difference between PAB and default Directory?

And whether a message store can only have one addressbook? Thank you.

Dmitry Streblechenko wrote:
> Are you setting these properties on teh IMailUser object returned by the OAB
> address book provider or teh underlying IMessage in one of the contacts
> folders?
>
> >I want to update the contact's info or create new contact with
> >emailaddress1,

> [quoted text clipped - 20 lines]
> > (Default DIR and PAB).
> > Thanks in advance.


 
? It makes all the difference in the world how you access these objects.

Dmitry Streblechenko (MVP)

-

"ryotyankou " <u48591@uwe> wrote in message

news:9f4721fc54a07@uwe...
> Take no care about which interface i used to set these properties, would
> you
> please tell me how to update them to reach my purpose in both
> situations(the
> IMailUser and IMessage). TIA.

> Dmitry Streblechenko wrote:
> >Are you setting these properties on teh IMailUser object returned by the
> >OAB
> >address book provider or teh underlying IMessage in one of the contacts
> >folders?
> >
> >>I want to update the contact's info or create new contact with
> >>emailaddress1,

> >[quoted text clipped - 20 lines]
> >> (Default DIR and PAB).
> >> Thanks in advance.


> >
> 200911
>
 
IAddrBook::GetPAB returns the container used to keep the personal contacts

in.

IAddrBook::GetDefaultDir returns the entry id of the contains that is

selected by default when you open teh adderss book window.

Message stores do not have any address books. You are confusing address

books with one particular address book provider (OAB) that happens to use

IPM.Contact messages as a storage for its address book objects (IMailUser).

Dmitry Streblechenko (MVP)

-

"ryotyankou " <u48591@uwe> wrote in message

news:9f4798c0684ce@uwe...
> Another questions, What's the difference between PAB and default
> Directory?
> And whether a message store can only have one addressbook? Thank you.

> Dmitry Streblechenko wrote:
> >Are you setting these properties on teh IMailUser object returned by the
> >OAB
> >address book provider or teh underlying IMessage in one of the contacts
> >folders?
> >
> >>I want to update the contact's info or create new contact with
> >>emailaddress1,

> >[quoted text clipped - 20 lines]
> >> (Default DIR and PAB).
> >> Thanks in advance.


> >
>
 
OK, i will describe how did i get the contact info.

1. Use IAddrBook::GetSearchPath get SRowSet.

2. Use PropFindProp check SRowSet for PR_ENTRYID.

3. Use IAddrBook::OpenEntry open the entry id to get IABContainer.

4. Use IABContainer::GetContentsTable to get contact table.

5. Then i get wanted items in table and save their entry ids.

> .....after some operation, for example, show UI, let user make choose, etc.

In a word, i use the entry id find here to operate the contact.

My code is describe as follow:

1. ISession::OpenEntry(entry id) to get IMessage. //here should make a

conversion from CONTAB_ENTRYID to ENTRYID, for the entry id i got above is

CONTAB_ENTRYID, right??

2. use IMessage::SetProps to set

lNameId[0] = PID_LID_EMAIL1_ADDR_TYPE;// or EMAIL2/EMAIL3

lNameId[1] = PID_LID_EMAIL1_EMAIL_ADDRESS;

lNameId[2] = PID_LID_EMAIL1_ORIGINAL_DISPLAY_NAME;

lNameId[3] = PID_LID_EMAIL1_ORIGINAL_ENTRY_ID;//Use CreateOneOff create and

get entry id,

IMessage::SaveChange to save item.

This is only work for create new emailaddress and update existing

emailaddress.

For example, use want to set:

1. Before set:

we have : test1@test.com(emailaddress1)

we want to set it as: test111@test.com(emailaddress1)

OK, we can update existing emailaddress.

2. Before set:

we have: test1@test.com(emailaddress1)

we want to set it as: test1@test.com(emailaddress1), test2@test.com

(emailaddress2)

OK we can create new.

3. Before set:

we have: test1@test.com(emailaddress1)

we want to set it as: test2@test.com(emailaddress2)

That's mean we want to remove

emailaddress1.

ACTUAL RESULT IS: test1@test.com(emailaddress1), test2@test.com

(emailaddress2)

The code cannot work in situation 3.

In a word, i don't know how to remove existing emailaddress. Are we clear?

Dmitry Streblechenko wrote:
> ? It makes all the difference in the world how you access these objects.
>
> > Take no care about which interface i used to set these properties, would
> > you

> [quoted text clipped - 12 lines]
> >>> (Default DIR and PAB).
> >>> Thanks in advance.



200911
 
My purpose is quite simple, as there is a contact(See how did i get its entry

id in other reply of this post), I Create an UI, user can change

Emailaddress1, Emailaddress2 and Emailaddress3 for this contact on the UI. If

user clear any one of them, that means user want to remove it in addressbook,

otherwise create new or update existing ones.

Dmitry Streblechenko wrote:
> IAddrBook::GetPAB returns the container used to keep the personal contacts
> in.
> IAddrBook::GetDefaultDir returns the entry id of the contains that is
> selected by default when you open teh adderss book window.

> Message stores do not have any address books. You are confusing address
> books with one particular address book provider (OAB) that happens to use
> IPM.Contact messages as a storage for its address book objects (IMailUser).
> > Another questions, What's the difference between PAB and default
> > Directory?

> [quoted text clipped - 10 lines]
> >>> (Default DIR and PAB).
> >>> Thanks in advance.



200911
 
Can you help me please, dmitry?

ryotyankou wrote:
> My purpose is quite simple, as there is a contact(See how did i get its entry
> id in other reply of this post), I Create an UI, user can change
> Emailaddress1, Emailaddress2 and Emailaddress3 for this contact on the UI. If
> user clear any one of them, that means user want to remove it in addressbook,
> otherwise create new or update existing ones.
>
> >IAddrBook::GetPAB returns the container used to keep the personal contacts
> >in.

> [quoted text clipped - 9 lines]
> >>>> (Default DIR and PAB).
> >>>> Thanks in advance.



200911
 
So if you want to remove an address, you would need to delete the

appropriate properties from the IPM.Contact message using

IMessage::DeleteProps().

Dmitry Streblechenko (MVP)

-

"ryotyankou " <u48591@uwe> wrote in message

news:9f53f26c4c447@uwe...
> OK, i will describe how did i get the contact info.
> 1. Use IAddrBook::GetSearchPath get SRowSet.
> 2. Use PropFindProp check SRowSet for PR_ENTRYID.
> 3. Use IAddrBook::OpenEntry open the entry id to get IABContainer.
> 4. Use IABContainer::GetContentsTable to get contact table.
> 5. Then i get wanted items in table and save their entry ids.
> .....after some operation, for example, show UI, let user make choose,
> etc.
> In a word, i use the entry id find here to operate the contact.
> My code is describe as follow:
> 1. ISession::OpenEntry(entry id) to get IMessage. //here should make a
> conversion from CONTAB_ENTRYID to ENTRYID, for the entry id i got above is
> CONTAB_ENTRYID, right??
> 2. use IMessage::SetProps to set
> lNameId[0] = PID_LID_EMAIL1_ADDR_TYPE;// or EMAIL2/EMAIL3
> lNameId[1] = PID_LID_EMAIL1_EMAIL_ADDRESS;
> lNameId[2] = PID_LID_EMAIL1_ORIGINAL_DISPLAY_NAME;
> lNameId[3] = PID_LID_EMAIL1_ORIGINAL_ENTRY_ID;//Use CreateOneOff create
> and
> get entry id,
> IMessage::SaveChange to save item.
> This is only work for create new emailaddress and update existing
> emailaddress.
> For example, use want to set:
> 1. Before set:
> we have : test1@test.com(emailaddress1)
> we want to set it as: test111@test.com(emailaddress1)
> OK, we can update existing
> emailaddress.
> 2. Before set:
> we have: test1@test.com(emailaddress1)
> we want to set it as: test1@test.com(emailaddress1), test2@test.com
> (emailaddress2)
> OK we can create new.
> 3. Before set:
> we have: test1@test.com(emailaddress1)
> we want to set it as: test2@test.com(emailaddress2)
> That's mean we want to remove
> emailaddress1.
> ACTUAL RESULT IS: test1@test.com(emailaddress1), test2@test.com
> (emailaddress2)
> The code cannot work in situation 3.
> In a word, i don't know how to remove existing emailaddress. Are we clear?

> Dmitry Streblechenko wrote:
> >? It makes all the difference in the world how you access these objects.
> >
> >> Take no care about which interface i used to set these properties, would
> >> you

> >[quoted text clipped - 12 lines]
> >>>> (Default DIR and PAB).
> >>>> Thanks in advance.


> >
> 200911
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Witzker Set Cursor & Focus from any field to the body of a user Contact form in OL 2019 Outlook VBA and Custom Forms 1
Witzker Macro to set contact reminder to next day 9:00 Outlook VBA and Custom Forms 45
P Last Change attribute set after viewing a public folder contact Exchange Server Administration 0
B Outlook contact, calendars, and tasks wont set up in icloud Using Outlook 4
M suddenly cannot set outlook 2007 contact reminders Using Outlook 2
G how to set contact custom form as default contact form? Using Outlook 7
K Set "Assigned To" for a Contact Item Outlook VBA and Custom Forms 5
J Set calendar default to 'none' (policy) Exchange Server Administration 3
U When opening shared Calendar "The set of folders cannot be opened" Using Outlook 0
L Help: set flag for sent mail to check if received an answer Outlook VBA and Custom Forms 2
D VBA - unable to set rule condition 'on this computer only' Outlook VBA and Custom Forms 5
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
O Cannot expand the folder. The set of folders cannot be opened. You do not have permission to log on. Using Outlook 1
e_a_g_l_e_p_i Outlook 2010 How to set default email address for website links Using Outlook 3
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 25
bmtjedi Set objApp = Application Not Working in O365-32bit Using Outlook 1
F how do i set a reminder in onenote 2010 Using Outlook 8
glnz How set up new IMAP on Outlook-Office 365 and merge in pst from Outlook 2003 for same two email accounts? Using Outlook 5
ChrisK2 Send email to advertise@slipstick.com fails: "The group advertising isn't set up to receive messages from..." Using Outlook 3
S How to set up button in ribbon for individual Quick Steps Using Outlook 1
J Set Timer/Countdown on Emails? Outlook VBA and Custom Forms 3
N How to set automatically the default or user defined Quickstyle Templates by Answer in Outlook Using Outlook 1
Victor_50 Set all subfolders to not autoarchive Outlook VBA and Custom Forms 11
Z Script to set account? Using Outlook 0
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
J What is the best EntryID format to set on MS Access table Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Can you set reminder to specific times? Using Outlook 7
CWM030 I do not see a way to set the personal archive folder Exchange Server Administration 2
O Set columns for all (sub)folders Using Outlook 8
S Appointment-Cannot set Categories because ConversationID is not set Outlook VBA and Custom Forms 1
Fozzie Bear Correct Method to set up Outlook.com accounts as Exchange Using Outlook.com accounts in Outlook 7
e_a_g_l_e_p_i How to set fonts for emails in all folders in Outlook Using Outlook 1
F Set (flagged) reminder for next business day Using Outlook 4
L how to set downloaded cached emails Using Outlook 5
J Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013 Outlook VBA and Custom Forms 3
S set a flag task date as the next weekday Outlook VBA and Custom Forms 4
C Set reminder / appointment by right clicking email Using Outlook 1
Diane Poremsky Set Another Data File as Default When Using an Exchange Account Using Outlook 0
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
L set task reminder date to same as start date (without affecting due date) Using Outlook 0
S how to set user properties to a newly created appointment Outlook VBA and Custom Forms 12
C Outlook VBA to set current account Outlook VBA and Custom Forms 1
Diane Poremsky Add Attachments and Set Email Fields During a Mail Merge Using Outlook 0
O How to set subject line in replies using VBA Outlook VBA and Custom Forms 1
A Custom form not showing when recurrence is set for a meeting Using Outlook 0
M Exchange 2013 On premise set MessageRateLimit for User has no effect. Exchange Server Administration 0
A Block user to send emails to specific set of email ids Using Outlook 1
D Outlook 2007 e-mail header- How to set font & font size in received message headers ? Using Outlook 2

Similar threads

Back
Top