Coder Social home page Coder Social logo

exchange-web-services-for-php's People

Contributors

cby016 avatar fuitad avatar jakemac53 avatar linux-jedi avatar rileydutton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exchange-web-services-for-php's Issues

cannot use the lib with https url

hello,
i do an advance install. the wsdl will be not load if i don't declare the realPath of wsdl :

$exchangeclient = new ExchangeClient();
$exchangeclient->init("xxxx", "xxxx", null, realpath(dirname(FILE) . '/EWS/lib/Services.wsdl'));
$items = $exchangeclient->get_messages();

But when i use any functions of exchangeClient no data are retrieve.
which are the potential problem ?
my server is NTLM & Basic atuhentification and the url of my asmx services is an https,
i also must be pass to an proxy (entreprise architecture)

thans in advance

Undefined property: stdClass::$ToRecipients

Thanks for this repo, it's great !!

Today I started to use this lib and have the following error:

PHP Notice: Undefined property: stdClass::$ToRecipients in Exchange-Web-Services-for-PHP/lib/ExchangeClient.php on line 257

Reviewing I found this code block:

if(!is_array($messageobj->ToRecipients->Mailbox)) {
    $messageobj->ToRecipients->Mailbox = array($messageobj->ToRecipients->Mailbox);
}

I see this object is referred in $messageobj in the line 241

$messageobj = $response->ResponseMessages->GetItemResponseMessage->Items->Message;

When I get all keys, I get this:

MimeContent
ItemId
Subject
Sensitivity
Body
Attachments
Size
DateTimeSent
DateTimeCreated
ResponseObjects
HasAttachments
IsReadReceiptRequested
From
IsRead

I suppouse my Exchange Server not send some propertyes like ToRecipients, fot this reason I suggest check is ToRecipients is set before process it like this:

if (isset($messageobj->ToRecipients)) {
    if(!is_array($messageobj->ToRecipients->Mailbox)) {
        $messageobj->ToRecipients->Mailbox = array($messageobj->ToRecipients->Mailbox);
    }
    
    foreach($messageobj->ToRecipients->Mailbox as $mailbox) {
        $newmessage->to_recipients[] = $mailbox;
    }
}

Instead

if(!is_array($messageobj->ToRecipients->Mailbox)) {
    $messageobj->ToRecipients->Mailbox = array($messageobj->ToRecipients->Mailbox);
}
foreach($messageobj->ToRecipients->Mailbox as $mailbox) {
    $newmessage->to_recipients[] = $mailbox;
}

Trying to get property of non-object

If im trying to run this library, i'm just getting back the following error:

Strict Standards: Creating default object from empty value in /var/www/exchange/lib/ExchangeClient.php on line 332
Strict Standards: Creating default object from empty value in /var/www/exchange/lib/ExchangeClient.php on line 333
Strict Standards: Creating default object from empty value in /var/www/exchange/lib/ExchangeClient.php on line 338
Strict Standards: Creating default object from empty value in /var/www/exchange/lib/ExchangeClient.php on line 340
Strict Standards: Creating default object from empty value in /var/www/exchange/lib/ExchangeClient.php on line 342
Notice: Trying to get property of non-object in /var/www/exchange/lib/ExchangeClient.php on line 354
Notice: Trying to get property of non-object in /var/www/exchange/lib/ExchangeClient.php on line 354
Notice: Trying to get property of non-object in /var/www/exchange/lib/ExchangeClient.php on line 354
Notice: Trying to get property of non-object in /var/www/exchange/lib/ExchangeClient.php on line 357
Notice: Trying to get property of non-object in /var/www/exchange/lib/ExchangeClient.php on line 357
Notice: Trying to get property of non-object in /var/www/exchange/lib/ExchangeClient.php on line 357

So clearly somthing is wrong with the variable $CreateItem, but i'm not able to figure out what...
phpStorm shows me the useless error 'Undifined Variable "CreateItem"... '

Any Idea why this error occurred?
Is it possible, that this error has something todo with the, may not right configured, curl at the server?

Parsing WSDL issues with 'Advanced' Installation

Hey!

I've been trying to get this library working with my Exchange Server 2007. Unfortunately the basic installation didn't do anything for me. While the advanced installation got me a little further, I'm still having trouble and would appreciate any guidance. I saved the three files in the lib/ directory but running init() throws an error saying 'cannot load external entity'. If I hardcode the path 'http://localhost/lib/Services.wsdl' in ExchangeClient.php. I get the message:
'Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: 'ExchangeServices' already defined in ...'

Even though I definitely only posted the additional stuff only once and it's not in there a second time!

Can you help me out?
Thanks!!

// Edit: Actually, I was able to get it to work by putting the absolute filesystem path. However, now I'm getting a 401.2 HTTP error. Any clue why that's happening?

Warning: Creating default object from empty value in ExchangeClient.php on line 94

This only makes sense.. here is the code in the object:

public function get_events($start, $end) {
    $this->setup();

    $FindItem->Traversal = "Shallow";
    $FindItem->ItemShape->BaseShape = "IdOnly";
    $FindItem->ParentFolderIds->DistinguishedFolderId->Id = "calendar";

    if($this->delegate != NULL) {
        $FindItem->ParentFolderIds->DistinguishedFolderId->Mailbox->EmailAddress = $this->delegate;
    }

    $FindItem->CalendarView->StartDate = $start;
    $FindItem->CalendarView->EndDate = $end;

    $response = $this->client->FindItem($FindItem);
..................................

$FindItem isn't even defined or anything... so it's throwing the error about creating a default object from an empty value. Is there a better way to go about this? Instead of just doing:

$FindItem = new StdClass;

Because then it throws an error on line 95 ($FindItem->ItemShape->BaseShape) because then it becomes a multi-dimensional object... which would be tedious to make every single level an StdClass..

Thanks for any help.

$ec->init($username, $password) NOT WORKING

Every time I call the function: $ec->init($username, $password); my webpage STOPS loading and remains white.
when I comment that line, everything is fine.
I even commented out the contents of the init() function and still the same white page.

Am I calling the init function wrong? Is there something I am missing?

PLEASE HELP!!!

and yes, all the necessary files are in the correct locations.

get_message on a empty folder

Thank you for this very useful peace of code!

Changes on ExchangeClient.php

'204,206c204
'<
'< $items = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->Message;
'<
'---.
'>
'210c208
'< if(count($items) == 0)
'---
'> if($response->ResponseMessages->FindItemResponseMessage->RootFolder->TotalItemsInView == 0)
'212a211,212
'> $items = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->Message;
'>

ErrorMessageDispositionRequired when sending email

Hi,

when sending an email like so $ec->send_message("[email protected]", "Subject", "Content");, the function returns 0 and print_r($ec->lastError); shows ErrorMessageDispositionRequired.

I was able work around this using $ec->send_message("[email protected]", "Subject", "Content", "Text", false); but it would be nice if this worked even with $saveinsent = true.

I believe the server I use runs Exchange 2013.

Thanks!

Request: How to lookup room resources from a global address list?

Hi,

I just wondered if someone could point me in the right direction on how to lookup room resources (or any type of resource) from a connection to Exchange using this library.

Within Outlook I can see room resources in my global address list but I'm not sure how you could hook into this using Exchange-Web-Services-for-PHP.

Thanks

unexpected T_OBJECT_OPERATOR when trying to connect

Apologies if this is a really simple problem but I have been trying to get this working for days and haven't been able to get past this hurdle. I have followed the setup instructions @ https://github.com/rileydutton/Exchange-Web-Services-for-PHP and when I run the test code on that page to send a simple email I get the below error

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\inetpub\wwwroot_Includes\EWS\lib\ExchangeClient.php on line 583

Any ideas?

Public calendar

Hi!

Everything is working but is it possible to access calendars in a public folder?
How?

Thanks!

Parsing WSDL: Couldn't bind to service in

Great script Riley....this script is exactly what I need and you did a great job of explaining things. However, I can't seem to get it to work. I followed the "advanced" installation verbatim but I keep receiving the following error when I run your example script...

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't bind to service in F:\UniServer\www\ExchangeWebServices\exchangeclient\Exchangeclient.php:38 Stack trace: #0 F:\UniServer\www\ExchangeWebServices\exchangeclient\Exchangeclient.php(38): SoapClient->SoapClient('Services.wsdl', Array) #1 F:\UniServer\www\ExchangeWebServices\exchangeclient\index.php(6): Exchangeclient->init('myusername', 'mypassword') #2 {main} thrown in F:\UniServer\www\ExchangeWebServices\exchangeclient\Exchangeclient.php on line 38

Here's my code:
require_once("Exchangeclient.php");
$exchangeclient = new Exchangeclient();
$exchangeclient->init("myusername", "mypassword");
$exchangeclient->send_message("[email protected]", "Subject", "A test message");

Any ideas on what might be going on? I'd love to get this working....thanks!

-K

error while using mark_message_as_read

Hi,

I can get emails without error using get_message function. However, when I want to mark the read e-mail with the mark_message_as read function, I get the following error.

A PHP Error was encountered

Severity: Error
Message: SOAP-ERROR: Encoding: object has no 'Path' property
Filename: lib/ExchangeClient.php
Line Number: 624 --> $response = $this->client->UpdateItem($request);

My code blocks like this:

$ec = new ExchangeClient();
$ec->init("xxxxx", "xxxxx", NULL, "http://myexchangedomain/EWS/Services.wsdl");
$result = $ec->get_messages('10', FALSE, 'inbox', TRUE);
$ec->mark_message_as_read( $result );

is this support exchange2010?

SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'Services.wsdl' : failed to load external entity "Services.wsdl" in D:\xampp\htdocs\email\lib\NTLMSoapClient.php:9 Stack trace: #0 D:\xampp\htdocs\email\lib\NTLMSoapClient.php(9): SoapClient->SoapClient('Services.wsdl', Array) #1 D:\xampp\htdocs\email\lib\ExchangeClient.php(49): NTLMSoapClient->__construct('Services.wsdl', Array) #2 D:\xampp\htdocs\email\M2.php(14): ExchangeClient->init('oechslertc\supe...', 'Mdt12345') #3 {main}

How to add body to event?

I'd like to create an event containing a body information as plain text or HTML. So i tried to extend the ExchangeClient function create_event() with:

$body = 'Hello World! This is a cool event :-)';
$CreateItem->Items->CalendarItem->Body = new StdClass();
$CreateItem->Items->CalendarItem->Body = $body;
$CreateItem->Items->CalendarItem->Body->BodyType = 'Text';

Therefore the resulting XML in the SOAP-request should look like this:
<t:Body BodyType="Text">Hello World! This is a cool event :-)</t:Body>

But no luck so far. I don't get what to assign to the body-object which contain the bodytext.

No ExchangeClient.php file

Hello. I'm trying to follow the instructions on page:
https://github.com/Heartspring/Exchange-Web-Services-for-PHP/blob/master/README.markdown

I have downloaded the files from my Exchange server. However, I can find no directory that contains the file ExchangeClient.php. Am I missing something?

I did find that the files I downloaded already exist in the wsdl directory. Are these dummy files that I should simply replace with the ones I downloaded (and then make the addition as suggested)?

Thanks for any help you can provide.

Warning: stream_wrapper_unregister():

Warning: stream_wrapper_unregister(): Unable to unregister protocol https:// in C:\xampp\htdocs\inventario\exchange\lib\ExchangeClient.php on line 485

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://mailcluster.fimitsgr.local/EWS/Services.wsdl' : Start tag expected, '<' not found in C:\xampp\htdocs\inventario\exchange\lib\NTLMSoapClient.php:8 Stack trace: #0 C:\xampp\htdocs\inventario\exchange\lib\NTLMSoapClient.php(8): SoapClient->SoapClient('https://mailclu...', Array) #1 C:\xampp\htdocs\inventario\exchange\lib\ExchangeClient.php(48): NTLMSoapClient->__construct('https://mailclu...', Array) #2 C:\xampp\htdocs\inventario\mail.php(8): ExchangeClient->init('helpdesk', 'Fenice_03', NULL, 'https://mailclu...') #3 {main} thrown in C:\xampp\htdocs\inventario\exchange\lib\NTLMSoapClient.php on line 8

Warning on return of only one event

If get_events() returns only one event an error is shown

Warning: count(): Parameter must be an array or an object that implements Countable in /Applications/XAMPP/xamppfiles/htdocs/pikettapi/sources/lib/ExchangeClient.php on line 121

No delegate in send_message method

Add

if($this->delegate != NULL)
$CreateItem->Items->Message->From->Mailbox->EmailAddress = $this->delegate;

to line 321 in Exchangeclient.php to fix.

Thanks a lot for a great piece of code.
Manteca

Some OWA Servers require NTLM and Basic authentication

Thank you very much for doing this! It is very useful.

Some servers require NTLM and Basic authentication. In this case, the Authorization: NTLM header must be sent before the Authorization: Basic header.

Please consider adding an authorization_type to the class so affected users can use something like this:

401c401
< curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);


> curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM | CURLAUTH_BASIC);

Is the project abandoned?

Hi.

No pull requests have been merged since 2017.
I also have few improvements made for my own use that could be useful but no one is merging code then I wont bother.

Malformed object creations

This class is awesome. It does exactly what I need it to do, without having to be an expert in using web services.

If you run this with:```
error_reporting(-1);
ini_set('display_errors','On');


You get all kinds of warnings about creating empty objects.

For example line 181 in get_messages method. The ```$FindItem```  should get initialized like ```$FindItem = new stdClass();``` and ```$FindItem->ItemShape = new stdClass();``` etc.

I'm a bit new to OO, but I gotta think there is probably a better way to init these objects rather than writing ```$obj = new stdClass()``` all over the place. Maybe some kind of setter?  

When I get a little more confident I'll write up a fix and a pull request :-)


Creating default object from empty value in.. multiple lines.

Hey, thanks for the great software. Sadly I encountered a problem.
I used the advanced installation and the demo you have on the <>code page.

I filled in the blind-text as my real mailserver (mail.domain.tld), used my outlook/domain login in the code-snippet and executed the code.

This is the error:

➜  Exchange-Web-Services-for-PHP git:(master) ✗ php outlooktest.php    
PHP Warning:  Creating default object from empty value in /var/www/html/Exchange-Web-Services-for-PHP/lib/ExchangeClient.php on line 349
PHP Warning:  Creating default object from empty value in /var/www/html/Exchange-Web-Services-for-PHP/lib/ExchangeClient.php on line 355
PHP Warning:  Creating default object from empty value in /var/www/html/Exchange-Web-Services-for-PHP/lib/ExchangeClient.php on line 357
PHP Warning:  Creating default object from empty value in /var/www/html/Exchange-Web-Services-for-PHP/lib/ExchangeClient.php on line 370

All the files are there and are modified as the advanced installation requires.

➜  lib git:(master) ✗ ls
ExchangeClient.php  ExchangeNTLMStream.php  messages.xsd  NTLMSoapClient.php  NTLMStream.php  Services.wsdl  types.xsd

Maybe you can help me with that! Thanks a lot!

"Creating default object from empty value" error

When using the get_events() function I get a lot of warnings (while it still seems to work).
Can anybody help?

Thanks!

Warning: Creating default object from empty value in ExchangeClient.php on line 95

Warning: Creating default object from empty value in ExchangeClient.php on line 96

Warning: Creating default object from empty value in ExchangeClient.php on line 97

Warning: Creating default object from empty value in ExchangeClient.php on line 103

Warning: Creating default object from empty value in ExchangeClient.php on line 125

Warning: Creating default object from empty value in ExchangeClient.php on line 126

Warning: Creating default object from empty value in ExchangeClient.php on line 137

Warning: Creating default object from empty value in ExchangeClient.php on line 145

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 137

Warning: Creating default object from empty value in ExchangeClient.php on line 145

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 137

Warning: Creating default object from empty value in ExchangeClient.php on line 145

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

Warning: Creating default object from empty value in ExchangeClient.php on line 156

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.