Outlook – Read another user’s calendar

Calendar delegation is a feature of Exchange, the Graph API and Outlook API do not allow the user to access the delegated calendar. Currently, the alternative workaround could be use the EWS. And here is an sample for your reference: static void DelegateAccessSearchWithFilter(ExchangeService service, SearchFilter filter) { // Limit the result set to 10 items. … Read more

Download File From SharePoint 365

I was facing the same issue and tried the answer suggested by Vadim Gremyachev. However, it still kept giving 403 error. I added two extra headers to force form based authentication like below: client.Headers.Add(“X-FORMS_BASED_AUTH_ACCEPTED”, “f”); client.Headers.Add(“User-Agent: Other”); After this it started working. So the full code goes like below: const string username = “[email protected]”; const … Read more

Setting up PHPMailer with Office365 SMTP

@nitin’s code was not working for me, as it was missing ‘tls’ in the SMTPSecure param. Here is a working version. I’ve also added two commented out lines, which you can use in case something is not working. <?php require ‘vendor/phpmailer/phpmailer/PHPMailerAutoload.php’; $mail = new PHPMailer(true); $mail->isSMTP(); $mail->Host=”smtp.office365.com”; $mail->Port = 587; $mail->SMTPSecure=”tls”; $mail->SMTPAuth = true; $mail->Username=”[email protected]”; … Read more

Connection to Office 365 by EWS API

You can use the code below to connect to the EWS on office 365: ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1); service.Credentials = new WebCredentials(“[email protected]”, “password”); service.AutodiscoverUrl(“[email protected]”, RedirectionUrlValidationCallback); You need define one callback function for the AutodiscoveryUrl function, like this: private static bool RedirectionUrlValidationCallback(string redirectionUrl) { // The default for the validation callback is to reject the … Read more

Powershell with exchange– How do I append all verbose output to a file

This article is completely revised 2017-07-18 as the new Log-Entry solution replaces the former Write-Log solution which will not be further updated. See also: Migrating from Write-Log. In general, I find that logging is underestimated for Microsoft scripting languages. Not only at design time of a script (or cmdlet) logging comes in handy but when … Read more