public async Task AddContact(MyContact myContact)
        {
            // acquire a O365 client to retrieve contacts
            var client = await EnsureClientCreated();

            // create new contact record
            var newContact = new Microsoft.Office365.OutlookServices.Contact {
                GivenName   = myContact.GivenName,
                Surname     = myContact.Surname,
                CompanyName = myContact.CompanyName
            };

            // add email address
            newContact.EmailAddresses.Add(new EmailAddress()
            {
                Address = myContact.EmailAddress,
                Name    = myContact.EmailAddress
            });

            // add phone numbers to collections
            newContact.HomePhones.Add(myContact.HomePhone);
            newContact.BusinessPhones.Add(myContact.BusinessPhone);

            // create the contact in O365
            await client.Me.Contacts.AddContactAsync(newContact);
        }
Beispiel #2
0
        public async Task AddContact(MyContact myContact)
        {
            var client = await EnsureClientCreated();

            var newContact = new Microsoft.Office365.Exchange.Contact {
                GivenName      = myContact.GivenName,
                Surname        = myContact.Surname,
                CompanyName    = myContact.CompanyName,
                EmailAddress1  = myContact.EmailAddress1,
                BusinessPhone1 = myContact.BusinessPhone1,
                HomePhone1     = myContact.HomePhone1
            };
            await client.Me.Contacts.AddContactAsync(newContact);
        }