jamesiarmes / php-ews

PHP Exchange Web Services
http://jamesarmes.com/php-ews/
MIT License
566 stars 304 forks source link

Message failed to create with "ErrorInvalidPropertySet: Set action is invalid for property." #567

Open l0ckm4 opened 5 years ago

l0ckm4 commented 5 years ago

I am using php-ews to send simple emails already but I want to add in inline attachements to one of the emails. I followed the example at https://github.com/jamesiarmes/php-ews/blob/master/examples/message/create-inline-attachment.php but cannot use

$attachment->Content = $file->openFile()->fread($file->getSize());

due to my php version - 5.4.45 So, I replaced the line with

$attachment->Content = file_get_contents($file->getPathname());

but get the following error :-

Message failed to create with "ErrorInvalidPropertySet: Set action is invalid for property."

Can anyone help me please?

EDIT

I have now tried it on a new server running php7.3 with the original code but yet I still get the error. I am running Exchange 2010 so have the version set to :- $version = Client::VERSION_2010;

RashitKhamidullin commented 3 years ago

I fixed the same issue by specifying the service pack version.

$version = Client::VERSION_2010_SP2;