Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to add a new contact from c#?

59 views
Skip to first unread message

Sam Jost

unread,
Dec 17, 2004, 8:21:11 AM12/17/04
to
I can attach to Outlook and read the contacts from any folder with this
source:

Outlook.Application outlookApp = new Outlook.Application();
Outlook.NameSpace outlookNamespace = outlookApp.GetNamespace("mapi");
outlookNamespace.Logon("SR", "", true, true);
Outlook.MAPIFolder cContacts = outlookNamespace.PickFolder();
foreach (Outlook.ContactItem outlookKontakt in cContacts.Items)
{
Console.WriteLine(outlookKontakt.FullName);
}
outlookNamespace.Logoff();


But now I'd like to change fields in these contacts, or add a new contact.

Can someone point me to some hints/docs how to add new contacts via COM, or
how to change stuff in the contacts?

thanks!
Sam


Sam Jost

unread,
Dec 17, 2004, 8:38:17 AM12/17/04
to
I had been a bit hasty to post my question, now I found the solution to my
problem.

thanks anyway for collective thinking :)

Sam


"Sam Jost" <lum...@noemail.nospam> schrieb im Newsbeitrag
news:upah%23sD5E...@TK2MSFTNGP14.phx.gbl...

ro...@xfinlow.co.uk

unread,
Sep 20, 2005, 10:03:12 AM9/20/05
to
Please help.
I have used VB for outlook auomation an am trying to use c#, but I
can't seem to get foreach to work in this way, but vb is fine...

outlook2002, gives

Form1.cs(103): foreach statement cannot operate on variables of type
'Outlook.Items' because 'Outlook.Items' does not contain a definition
for 'GetEnumerator', or it is inaccessible

Does anyone have any ideas ?

Cheers
Robin

On Fri, 17 Dec 2004 14:38:17 +0100, "Sam Jost" <lum...@noemail.nospam>
wrote:

Oz Kologlu

unread,
Sep 20, 2005, 7:56:06 PM9/20/05
to
Use items.GetNext()

Oz


<ro...@Xfinlow.co.uk> wrote in message
news:4c50j1todq2g0qan3...@4ax.com...

0 new messages