Exemplo n.º 1
0
        /// <summary>
        /// This method updates a contact
        /// </summary>
        /// <param name="contact">The contact to update</param>
        /// <returns>The updated contact</returns>
        public static Contact UpdateContact(Contact contact)
        {
            String jsonResponse = MicrosoftGraphHelper.MakePatchRequestForString(
                String.Format("{0}me/contacts/{1}",
                    MicrosoftGraphHelper.MicrosoftGraphV1BaseUri,
                    contact.Id),
                    contact,
                    "application/json");

            var updatedContact = JsonConvert.DeserializeObject<Contact>(jsonResponse);
            return (updatedContact);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method adds a contact
        /// </summary>
        /// <param name="contact">The contact to add</param>
        /// <returns>The added contact</returns>
        public static Contact AddContact(Contact contact)
        {
            String jsonResponse = MicrosoftGraphHelper.MakePostRequestForString(
                String.Format("{0}me/contacts",
                    MicrosoftGraphHelper.MicrosoftGraphV1BaseUri),
                    contact,
                    "application/json");

            var addedContact = JsonConvert.DeserializeObject<Contact>(jsonResponse);
            return (addedContact);
        }