首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将MS和PHP与ExchangeWebServices连接起来?

将MS和PHP与ExchangeWebServices连接起来?
EN

Stack Overflow用户
提问于 2015-06-17 08:20:12
回答 1查看 187关注 0票数 0

我目前正在学习计算机科学,在我的工作经验中,我的工作导师建议我通过PHP的一个网站(由我实现)向我的导师微软交换议程()发送约会请求。不幸的是,我不知道如何做到这一点.我对PHP、HTML和CSS有很好的了解,但我完全不懂Microsoft,因为直到我的工作导师问我这个项目,我才真正了解Microsoft。

我的代码(文件: test.php):

代码语言:javascript
复制
<?php

function __autoload($ExchangeWebServices)
{
// Start from the base path and determine the location from the class name,
$base_path = 'C:/wamp/www/new-ews2/php-ews';
$include_file = $base_path . '/' . str_replace('_', '/',             $ExchangeWebServices) . '.php';

return (file_exists($include_file) ? require_once $include_file : false);
} 

$server='test.fr';
$username='test@test.fr';
$password='testtest';

$ews = new ExchangeWebServices($server, $username, $password);

$request = new EWSType_FindItemType();
$request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;

$request->ItemShape = new EWSType_ItemResponseShapeType();
$request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;

$request->CalendarView = new EWSType_CalendarViewType();
$request->CalendarView->StartDate = date('c', strtotime('2015-06-20 -00'));
$request->CalendarView->EndDate = date('c', strtotime('2015-06-22 -00'));

$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CALENDAR;

var_dump($request); 

?>

当我进入google并设置:localhost/new-ews/php-ews/test.php

该页的结果:

代码语言:javascript
复制
object(EWSType_FindItemType)[2]
public 'CalendarView' => 
object(EWSType_CalendarViewType)[4]
  public 'EndDate' => string '2015-06-22T02:00:00+02:00' (length=25)
  public 'MaxEntriesReturned' => null
  public 'StartDate' => string '2015-06-20T02:00:00+02:00' (length=25)
public 'ContactsView' => null
public 'DistinguishedGroupBy' => null
public 'FractionalPageItemView' => null
public 'GroupBy' => null
public 'IndexedPageItemView' => null
public 'ItemShape' => 
object(EWSType_ItemResponseShapeType)[3]
  public 'AdditionalProperties' => null
  public 'BaseShape' => string 'Default' (length=7)
  public 'BodyType' => null
  public 'ConvertHtmlCodePageToUTF8' => null
  public 'FilterHtmlContent' => null
  public 'IncludeMimeContent' => null
public 'ParentFolderIds' => 
object(EWSType_NonEmptyArrayOfBaseFolderIdsType)[5]
  public 'DistinguishedFolderId' => 
    object(EWSType_DistinguishedFolderIdType)[6]
      public 'ChangeKey' => null
      public 'Id' => string 'calendar' (length=8)
      public 'Mailbox' => null
  public 'FolderId' => null
public 'QueryString' => null
public 'Restriction' => null
public 'SortOrder' => null
public 'Traversal' => string 'Shallow' (length=7)

我现在不知道怎么测试这段代码了?我现在要问我的导师服务器/用户名/密码吗?还是我的代码很好?我有什么改变吗?谢谢

编辑2:请在哪一行添加这段代码?:/

EN

回答 1

Stack Overflow用户

发布于 2015-06-17 08:28:26

有许多API可以通过PHP访问EWS:

他们会让你开始的。

编辑:

在您有了代码之后,您必须1.包括您需要的所有文件。2.添加一个自定义自动加载程序

这两者都在自述文档这里中进行了描述。为了解决上述错误,您至少必须包括文件ExchangeWebServices.php

编辑2:您并不真正地查询EWS。构建查询,但不要执行代码。当然,您需要帐户数据来查询。

代码语言:javascript
复制
$response = $ews->FindItem($request);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30886016

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档