Modifying Contact Information

Modifying contact information

The Android people need to update their documentation. It actually served to make me know less about what was happening than I would have gotten from guessing. It suggests that you can pull back a Contact, which will contain many RawContacts which will contain Data.

That interpretation is completely wrong. ContactContracts data is instead three normal average everyday database tables*:

ContactContract Tables

Table: Contacts

Access URI: Contacts.CONTENT_URI

Primary Key**: Data._ID

Description:

This table contains information about a Contact (when was it added, what's is it's user icon, does it have a custom ringtone).

Relationship: It has a 1-to-many relationship with the RawContact table.

Table: RawContacts

Access URI: RawContacts.CONTENT_URI

Primary Key: Data._ID

Foreign Key**: Data.CONTACT_ID

Description:

This table contains information about a related set of Data items. A RawContact could contain Email Type, Email Display Name, Phone Number, Phone Display Name, etc. A RawContact can be aggregated with other RawContacts to make a Contact as a user sees it. A Contact could contain just one RawContact.

Relationship: It has a 1-to-many relationship with the Data table.

Table: Data

Access URI: Data.CONTENT_URI

Primary Key: Data._ID

Foreign Key: Data.RAW_CONTACT_ID

Description:

This table contains a single field of information. An email address, A phone number, A phone number type (home/work), A nickname, A display name.

In answer to the question

I've uploaded the entire sample project to GitHub in order to allow others to see how to query, update and insert records using ContactContract.

You can find the project to download here:
https://github.com/gwoodhouse/ContactContractSample

If you just want to look at the java code performing the query/update/insert here is the class file:
https://github.com/gwoodhouse/ContactContractSample/blob/master/ContactsIntegration/src/com/woodhouse/
example/activity/ContactsIntegrationActivity.java

Hope this helps!

*Not a table, but a ContentProvider

** not strictly true.

edit contact information in iphone

Ok at last i have to find the solution myself

here is it

-(IBAction)showPicker:(id) sender{
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
ABRecordRef person = CFArrayGetValueAtIndex(allPeople,0);
ABPersonViewController *personController = [[ABPersonViewController alloc] init];
personController.displayedPerson = person;
personController.addressBook = addressBook;
personController.allowsEditing = YES;
personController.personViewDelegate = self;
UINavigationController *contactNavController = [[UINavigationController alloc] initWithRootViewController:personController];
[personController release];
CFRelease(allPeople);
CFRelease(person);

[self presentModalViewController:contactNavController animated:YES];
}

-(void)personViewControllerDidCancel:(ABPersonViewController *)peoplePicker
{
[self dismissModalViewControllerAnimated:YES];
}

-(BOOL)personViewController:(ABPersonViewController *)peoplePicker shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID) property identifier:(ABMultiValueIdentifier) identifier
{
return YES;
}

How to open New Contact Screen Directly?

Try this below code. I think I am getting what you are looking for.

    let con = CNContact()
let vc = CNContactViewController(forNewContact: con)
_ = self.navigationController?.pushViewController(vc, animated: true)

Filtering Contacts Returns Mixed Contact Information - Swift

In cellForRowAt I made a mistake and did not change the reference to the searchResults for the first name, only for the last name. Here is the code for the tableView:

if searching {
cell.textLabel?.text = searchResults[indexPath.row].contactDetails.familyName+", "+searchResults[indexPath.row].contactDetails.givenName
} else {
cell.textLabel?.text = deviceContacts[indexPath.row].contactDetails.familyName+", "+deviceContacts[indexPath.row].contactDetails.givenName
}

View Contact information from contacts lookup

You can use Quick view form to achieve this without code.

You asked through JS only, then you have to retrieve other attributes of contact on change of lookup field using Service call. (But you said read-only?)

This is a sample odata query you can use with OrganizationData.svc:

var selectQuery = "/ContactSet?&$filter=ContactId eq guid'" + lookupid + "'&$select= emailaddress1,MobilePhone";

Btw, you have long way to go. Read the documentation a lot & follow blogs. Read SDK thoroughly.

Contact Form 7 - Change email content after field replacement

To convert all of the text from the email to uppercase, you have to do this after the string replacement is done. With that being the case, you'll have to use the filter wpcf7_mail_components this is applied after the string replacement, but before the email is actually sent.

This filter passes the mail components in an array. Then you want to use DOMDocument to parse the HTML and make all of the text uppercase.

With this being the case, you can use the format of your cf7 form tags in standard upper or lower case like [text your-field]

add_filter( 'wpcf7_mail_components', 'dd_mail_componentns', 10, 1 );
function dd_mail_componentns( $components ) {
$dom = new DOMDocument();
$dom->loadHTML( $components['body'] );
$xPath = new DOMXPath( $dom );
foreach ( $xPath->query( '/html/body//text()' ) as $text ) {
$text->data = strtoupper( $text->data );
}
$components['body'] = $dom->saveXML( $dom->documentElement );
return $components;
}

This has been tested and works for me.



Related Topics



Leave a reply



Submit