Exemple #1
0
require 'outlook.php';
$loggedIn = !is_null($_SESSION['access_token']);
$redirectUri = 'http://shoretelcalenders.azurewebsites.net/authorize.php';
?>

<html>
	<head>
		<title>PHP Mail API Tutorial</title>
	</head>
  <body>
    <?php 
if (!$loggedIn) {
    ?>
      <!-- User not logged in, prompt for login -->
      <p>Please <a href="<?php 
    echo oAuthService::getLoginUrl($redirectUri);
    ?>
">sign in</a> with your Office 365 account.</p>
    <?php 
} else {
    $messages = OutlookService::getMessages($_SESSION['access_token']);
    ?>
      <!-- User is logged in, do something here -->
      <h2>Your messages</h2>
      <table>
        <tr>
          <th>From</th>
          <th>Subject</th>
          <th>Received</th>
        </tr>
        
Exemple #2
0
<!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file. -->
<?php 
session_start();
require_once 'oauth.php';
$auth_code = $_GET['code'];
$redirectUri = 'http://localhost/php-tutorial/authorize.php';
$tokens = oAuthService::getTokenFromAuthCode($auth_code, $redirectUri);
if ($tokens['access_token']) {
    $_SESSION['access_token'] = $tokens['access_token'];
    // Get the user's email from the ID token
    $user_email = oAuthService::getUserEmailFromIdToken($tokens['id_token']);
    $_SESSION['user_email'] = $user_email;
    // Redirect back to home page
    header("Location: http://localhost/php-tutorial/home.php");
} else {
    echo "<p>ERROR: " . $tokens['error'] . "</p>";
}
?>

<!--
 MIT License: 
 
 Permission is hereby granted, free of charge, to any person obtaining 
 a copy of this software and associated documentation files (the 
 ""Software""), to deal in the Software without restriction, including 
 without limitation the rights to use, copy, modify, merge, publish, 
 distribute, sublicense, and/or sell copies of the Software, and to 
 permit persons to whom the Software is furnished to do so, subject to 
 the following conditions: 
 
 The above copyright notice and this permission notice shall be 
Exemple #3
0
<!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file. -->
<?php
  session_start();
  require_once('oauth.php');
  $auth_code = $_GET['code'];

  $tokens = oAuthService::getTokenFromAuthCode($auth_code, 'http://localhost/Producktiviti/OutBinder/authorize.php');

  if ($tokens['access_token']) {
    $_SESSION['access_token'] = $tokens['access_token'];

    // Redirect back to home page
    header("Location: http://localhost/Producktiviti/OutBinder/home.php");
  }
  else
  {
    echo "<p>ERROR: ".$tokens['error']."</p>";
  }
?>

<!--
 MIT License:
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 ""Software""), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
 
Exemple #4
0
  require('oauth.php');
  require('outlook.php');

  $loggedIn = !is_null($_SESSION['access_token']);
?>

<html>
    <head>
      <title>PHP Mail API Tutorial</title>
    </head>
  <body>
    <?php
      if (!$loggedIn) {
    ?>
      <!-- User not logged in, prompt for login -->
      <p>Please <a href="<?php echo oAuthService::getLoginUrl('http://localhost/Producktiviti/OutBinder/authorize.php')?>">sign in</a> with your Office 365 account.</p>
    <?php
      }
      else {
        $messages = OutlookService::getMessages($_SESSION['access_token']);
    ?>
      <!-- User is logged in, do something here -->
      <h2>Your messages</h2>

      <table>
        <tr>
          <th>From</th>
          <th>Subject</th>
          <th>Received</th>
        </tr>
<!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file. -->
<?php 
session_start();
require_once 'oauth.php';
$auth_code = $_GET['code'];
$tokens = oAuthService::getTokenFromAuthCode($auth_code, 'http://shoretelcalenders.azurewebsites.net/authorize.php');
if ($tokens['access_token']) {
    $_SESSION['access_token'] = $tokens['access_token'];
    // Redirect back to home page
    header("Location: http://shoretelcalenders.azurewebsites.net/home.php");
} else {
    print_r($tokens['access_token']);
    echo "<br/><p>ERROR: " . $tokens['error'] . "</p>";
}
?>

<!--
 MIT License: 
 
 Permission is hereby granted, free of charge, to any person obtaining 
 a copy of this software and associated documentation files (the 
 ""Software""), to deal in the Software without restriction, including 
 without limitation the rights to use, copy, modify, merge, publish, 
 distribute, sublicense, and/or sell copies of the Software, and to 
 permit persons to whom the Software is furnished to do so, subject to 
 the following conditions: 
 
 The above copyright notice and this permission notice shall be 
 included in all copies or substantial portions of the Software. 
 
 THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,