Coder Social home page Coder Social logo

Comments (33)

Garethp avatar Garethp commented on August 10, 2024

Good question, I'm not sure. I'll look in to it tomorrow

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

This should now work in 0.8.3

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

Hi,

thanks for helping so fast.
I just pulled 8.3 and get an error when setting multiple properties:

[garethp\ews\API\Exception\ExchangeException]
Property is not valid for this object type.

Maybe i am using wrong syntax? Do i have to add

Also when i try to delete the field (worked with 8.2) i get the error

[SoapFault]
  The request failed schema validation: The 'FieldURI' attribute is invalid - The value '' is invalid according to its datatype 'http://schemas.microsoft.com/exc
  hange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Huh, that's really weird. This set of code works for me. Can you test it? What does your code look like?

$contact = $api->createContacts(array(
    'GivenName' => 'John',
    'Surname' => 'Smith',
    'EmailAddresses' => array(
        'Entry' => array('Key' => Enumeration\EmailAddressKeyType::EMAIL_ADDRESS_1, '_value' => '[email protected]')
    ),
    //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',
        )
    ),
))[0];

$api->updateContactItem($contact, array(
    'GivenName' => 'Jane',
    'EmailAddress:EmailAddress1' => array (
        'EmailAddresses' => array (
            'Entry' => array('Key' => 'EmailAddress1', '_value' => '[email protected]')
        )
    ),
    'PhysicalAddress:Home' => array(
        'PhysicalAddresses' => array(
            'Entry' => array(
                'Key' => 'Home',
                'street' => '123 Street New',
                'city' => '123 City New',
            )
        )
    )
));

$api->updateContactItem($contact, array(
    'deleteFields' => array(
        'GivenName',
        'PhoneNumber:HomePhone'
    )
));

$api->deleteItems($contact);

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024
'Entry' => array(
  'Key' => 'Home',
  'street' => '123 Street New',
  'city' => '123 City New',
  'countryOrRegion' => '1234',
)

countryOrRegion does not work

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

Also i am deleting in the same request where i am updating fields. Something like that

 'PhysicalAddress:Home' => array(
      'PhysicalAddresses' => array(
           'Entry' => array(
               'Key' => 'Home',
               'street' => '123 Street New',
               'city' => '123 City New',
        )
)
deleteFields' => array(
    'PhysicalAddress:BUSINESS,
)

If you need more information i can post the complete request.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

I think I see the issue. It looks like the constants for URI's may be incomplete. I can push it quickly, but before I do: What other fields do you need updating? If there are any that aren't defined yet, I'd like to have them all defined in the next release

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

PhysicalAddressKeyType::HOME
PhysicalAddressKeyType::BUSINESS
PhysicalAddressKeyType::OTHER

'street'
'city'
'state'
'countryOrRegion'
'postalCode'

Are these the ones you mean?

Also i was not able to sync the notes-field, maybe it is also related to missing uris?

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

And of course all PhoneNumberKeyType and EmailAddressKeyType

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

PostalCode would have been missing too. What do you mean by not being able to sync the notes field?

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

'Notes' => 'notestring'

[SoapFault]
The request failed schema validation: The 'FieldURI' attribute is invalid - The value 'contacts:Notes' is invalid according to its datatype 'http://schemas.mic
rosoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Hm... I'll look in to that. That one is strange, as it should exist...

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Okay, version 0.8.4 should now have your fields updatable, except for notes. I'm not sure why notes doesn't update, but I'll be looking in to that

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

Hi, updating works with 0.8.4 but

deleteFields' => array(
    'PhysicalAddress:BUSINESS,
)

in the same request still does not

[SoapFault]
The request failed schema validation: The 'FieldURI' attribute is invalid - The value '' is invalid according to its datatype 'http://schemas.microsoft.com/exc
hange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Hm... to be honest I can't see how to delete a whole address. You'd have to delete it one field at a time as far as I can see. The problem lies in the fact that PhysicalAddresses is not an indexed field, so you can't attach an index on that, and PhysicalAdress by itself isn't a field either. The only valid PhysicalAddress URI's are:

contacts:PhysicalAddress:City
contacts:PhysicalAddress:Country
contacts:PhysicalAddress:PostalCode
contacts:PhysicalAddress:State
contacts:PhysicalAddress:Street

So there's just no fieldURI to delete a single physicalAddress.

I'll post an issue on SO in raw XML to see if I can get a response on what the request should look like

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Out of curiosity, what are you building with this? It seems like you're touching on a pretty large feature set.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Yeah, seems like the issue is to just delete every field. Can you pull down dev-master and give it a try? I've got this working on dev-master

$api->updateContactItem($contact, array(
    'deleteFields' => array(
        'GivenName',
        'PhysicalAddress:Home',
        'PhysicalAddress:City:Business'
    )
));

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

Hey, i will try if it works. I am syncing contacts from a local database with exchange contacts. Contacts on Exchange need to be updated on a regular basis. I am using a custom property to map exchange contacts to local contacts.

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024
[SoapFault]
  Die Anforderung ist gültig, sie gibt jedoch nicht die richtige Serverversion in der SOAP-Kopfzeile "RequestServerVersion" an. Stellen Sie sicher, dass die SOAP
  -Kopfzeile "RequestServerVersion" auf den richtigen "RequestServerVersionValue" festgelegt ist.

Means something like the request is valid but RequestServerVersion has not the right RequestServerVersionValue. I think it is an Exchange 2010 Server. Tested with 97c1939

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Interesting. Are you specifying a version when you create the API? Can you try getting the API through the ExchangeAutodiscover::getAPI($username, $password) function? If it can autodiscover your server, it should get the correct version for your server

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

I do not specifiy a version but it was working with 0.8.4. When i specify the version i get an error that the property is not valid. May be invalid syntax by me but was working with 0.8.4. At the moment i have to work on another project, so i do not have time to investigate in-depth.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

I can understand that. I'll keep looking in to it, but I'm unable to reproduce your error. I'll see if there's a way I can get an Exchange 2010 server to test on, but I'm not sure if I'll be able to do it.

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

I can create an example request as soon as i find some time.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

This might be a long shot, but would it be possible for you to create a test account on your Exchange server for me to test against directly? That way I can debug it personally instead of constantly asking you to get debug data for me?

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

I use a hosted exchange server so sadly i am not able to create new accounts.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Fair enough. I'll try to create a 2010 server in a virtual machine to see if I can reproduce

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

If you can dump the XML request (Chuck a var_dump($request) at NTLMSoapClient::__doRequest()) for both the current dev-master and 0.8.4, then I should be able to do a diff and see why it's rejecting the ServerVersion.

Sorry this is taking so long to resolve, I've just never tried to do what you're doing or encountered the errors you're encountering

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

Hi, no problem that it is taking time. It is not a matter of course to give as much support as you do. When everything is working i may be able to update the documentation on how to sync contacts from a database.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Just an FYI: If I can't find a way to update Notes, you may be able to use the Body attribute insteaad, in the same way you would for emails

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

Hi, after some testing it was invalid propertys on my side. Nearly everything is working with Exchange2010 if I specify the version. When creating addresses all properties are working as expected but when updating 'countryOrRegion' and 'postalCode' do not.

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Okay, I'll look in to that, thanks

from php-ews.

Garethp avatar Garethp commented on August 10, 2024

Can you give updating countryOrRegion and postalCode a shot on the latest dev-master? I should have it fixed. Just wanted to get a confirmation before I tag a new release

from php-ews.

jwaschkau avatar jwaschkau commented on August 10, 2024

countryOrRegion and postalCode are working now.

from php-ews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.