How to Add new contact to existing group Monotouch?
I try following code
ABAddressBook ab = new ABAddressBook();
ABPerson p = new ABPerson();
p.FirstName = fname;
p.LastName = lname;
ABMutableMultiValue<string> phones = new
ABMutableStringMultiValue();
phones.Add(phone, ABPersonPhoneLabel.Mobile);
p.SetPhones(phones);
ABMutableDictionaryMultiValue addresses = new
ABMutableDictionaryMultiValue();
NSMutableDictionary a = new NSMutableDictionary();
a.Add(new NSString(ABPersonAddressKey.City), new NSString(city));
a.Add(new NSString(ABPersonAddressKey.State), new NSString(state));
a.Add(new NSString(ABPersonAddressKey.Zip), new NSString(zip));
a.Add(new NSString(ABPersonAddressKey.Street), new NSString(addr1));
addresses.Add(a, new NSString("Home"));
p.SetAddresses(addresses);
ABGroup[] allGroups = adBook.GetGroups();
for (int rowIndex=0; rowIndex<allGroups.Length
;rowIndex++)
{
ABGroup abGroup=allGroups [rowIndex];
if(abGroup.Name ==strGroupName)
{
abGroup.Add(per);
ab.Save ();
break;
}
}
Following error fire in line abGroup.Add(per)
Unhandled Exception: System.ArgumentException: cfErrorHandle must not be
null.
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Add-new-contact-to-existing-group-Monotouch-tp4315556p4315556.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch