add person to group in contact fails

I am unable to add a person to a group in Contacts, for reasons that I cannot understand.


tell application "Contacts"
	set P to person 1
	set G to group 1
	add P to G
end tell

The code errs with
“Contacts got an error: You can only add a person to a group.” number 1

OS X 10.11

tell application "Contacts"
	activate
	set {P, G} to {person 1, group 1}
	add P to G
	save -- saves changes and shows them
end tell

NOTE 1: “All Contacts” isn’t a group, so you should have at least 1 group in Contacts to get working of script. The error message above most likely is related with fact, that you have not groups in your Contacts yet. To add person (new) to “All Contacts” is only creating person command.

NOTE 2: If you use Script Debugger or if you use this script as applet, then appropriate flag to access your Contacts will be set on in Security & Privacy of System Preferences. If you use this script as applet (or Script Debugger) with Contacts for first time, then appears dialog box to allow your applet (or Script Debugger) access your Contacts. Click “Allow”. More secure is allow for applet.