Garethp / php-ews

PHP Exchange Web Services
BSD 3-Clause "New" or "Revised" License
112 stars 45 forks source link

Create a contact #242

Open JGalbois opened 1 year ago

JGalbois commented 1 year ago

I try to create a new contact. But i don't find the full list of fields available and the syntax for submit the creation

I see the example :

$response = $api->createContacts(array(

    'CompanyName' => 'orgnom',
    'GivenName' => 'NEW',
    'Surname' => 'NEW',
    'EmailAddresses' => array(
        'Entry' => array('Key' => Enumeration\EmailAddressKeyType::EMAIL_ADDRESS_1, '_value' => 'john.smith@gmail.com')
    ),
    //Creating multiple entries
    'PhoneNumbers' => array(
        'Entry' => array(
            array('Key' => Enumeration\PhoneNumberKeyType::HOME_PHONE, '_value' => '000'),
            array('Key' => Enumeration\PhoneNumberKeyType::BUSINESS_PHONE, '_value' => '111'),
        )
    ),
    'PhysicalAddresses' => array(
        'Entry' => array(
            'Key' => Enumeration\PhysicalAddressKeyType::HOME,
            'street' => '123 Street',
            'city' => '123 City',
            'state' => '123 State',
            'countryOrRegion' => '123 Country',
            'postalCode' => '12345',
        )
    ),
));

I would like to add

    'CompleteName' => array(
        'Entry' => array(
                array('Key' => 'FirstName', '_value' => '111'),
            ),
    ),

It's not the right syntax "Fatal error: Uncaught garethp\ews\API\Exception\ExchangeException: Set action is invalid for property."

I need some help Thank's