Created
June 9, 2020 03:17
-
-
Save gscales/2dadd866b6860c565754cce26ceaf2bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApp23 | |
{ | |
class OAuthExchangeServiceBinding : com.office365.outlook.ExchangeServiceBinding | |
{ | |
public String AnchorMailbox { get; set; } | |
public bool oAuth; | |
public String oAuthToken; | |
protected override System.Net.WebResponse GetWebResponse(System.Net.WebRequest req) | |
{ | |
if (AnchorMailbox != null) | |
{ | |
if (AnchorMailbox != "") | |
{ | |
req.Headers.Add("X-AnchorMailbox", AnchorMailbox); | |
} | |
} | |
if (oAuth) | |
{ | |
req.Headers.Remove("Authorization"); | |
req.Headers.Add("Authorization", "Bearer " + oAuthToken); | |
} | |
System.Net.HttpWebResponse | |
rep = (System.Net.HttpWebResponse)base.GetWebResponse(req); | |
return rep; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment