2016-11-11 1 views
0

Ich versuche, eine Adresse auf einem vorhandenen Kontakt hinzuzufügen:fügen Sie neue Postanschrift an bestehenden Kontakt

// insert 

operations.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri) 
             .WithValue(ContactsContract.Data.InterfaceConsts.ContactId, contact.Id) 
             .WithValue(ContactsContract.Data.InterfaceConsts.RawContactId, GetRawContactId(contact.Id)) 
             .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.StructuredPostal.ContentItemType) 
             .WithValue(ContactsContract.CommonDataKinds.StructuredPostal.Pobox, address.PoBox) 
             .WithValue(ContactsContract.CommonDataKinds.StructuredPostal.Street, address.Street) 
             .WithValue(ContactsContract.CommonDataKinds.StructuredPostal.City, address.City) 
             .WithValue(ContactsContract.CommonDataKinds.StructuredPostal.Postcode, address.Postcode) 
             .WithValue(ContactsContract.CommonDataKinds.StructuredPostal.Country, address.Country) 
             .WithValue(ContactsContract.CommonDataKinds.CommonColumns.Type, GetAddressContactInfoType(address.InfoType)) 
             .Build()); 

aber alle bekomme ich ist ein

Android.Content.OperationApplicationException: insert failed 

irgendwelche Vorschläge?

vielen Dank im Voraus

+0

vollständige Stack-Trace: http://pastebin.com/695PKf3V – metagen

Antwort

0

schließlich fand ich die Lösung. Ich musste die folgende Zeile entfernen:

.WithValue(ContactsContract.Data.InterfaceConsts.ContactId, contact.Id) 
Verwandte Themen