// throws duplication exception // throws UUID error/ not found exception public static Person InewAttendee(Person newAttendee, string uuid, string version) { // tests if attendee already exists if (IgetAttendee(uuid) == null) { // adding id + version to newAttendee List <UserDefined> userDefined = new List <UserDefined>(); userDefined.Add(new UserDefined() { Value = uuid, Key = "UUID" }); userDefined.Add(new UserDefined() { Value = version, Key = "version" }); newAttendee.UserDefined = userDefined; // creates the contact PeopleResource.CreateContactRequest request = new PeopleResource.CreateContactRequest(peopleService, newAttendee); Person createdAttendeee = request.Execute(); // updates UUIDMaster // uuid and id are the same. // throws UUID error / not found exception uuidMaster.PutUpdateUUID(uuid, createdAttendeee.ResourceName, Int32.Parse(version)); return(createdAttendeee); } // attendee already excsts else { throw new DuplicationException("attendee already exists"); } }
private async Task <string> RegisterUser(string mail) { var contactToCreate = new Person(); List <Name> names = new List <Name>(); List <EmailAddress> email = new List <EmailAddress>(); List <Biography> biographies = new List <Biography>(); List <Gender> genders = new List <Gender>(); names.Add(new Name() { GivenName = "John", FamilyName = "Doe" }); email.Add(new EmailAddress() { DisplayName = "test", Value = mail }); biographies.Add(new Biography() { Value = "10.10.2005" }); genders.Add(new Gender() { Value = "male" }); contactToCreate.Names = names; contactToCreate.Biographies = biographies; contactToCreate.Genders = genders; contactToCreate.EmailAddresses = email; var request = new PeopleResource.CreateContactRequest(peopleService, contactToCreate); Person createdContact = request.Execute(); return(createdContact.ResourceName); }