This file contains hidden or 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
| $mailbox = "[email protected]" | |
| # PSETID_Note GUID | |
| $noteGuid = "0006200E-0000-0000-C000-000000000046" | |
| # Build sticky note payload | |
| $body = @{ | |
| subject = "" # Sticky notes typically have no subject | |
| body = @{ | |
| contentType = "Text" | |
| content = "This is a sticky note created via Microsoft Graph" |
This file contains hidden or 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
| private static readonly Guid PSETID_Note = new Guid("{0006200E-0000-0000-C000-000000000046}"); | |
| Item note = new Item(service); | |
| note.ItemClass = "IPM.StickyNote"; | |
| // 3. Set basic content | |
| note.Subject = "My EWS Sticky Note"; | |
| note.Body = "This is the content of the sticky note.\nCreated via EWS Managed API."; | |
| // 4. Define Extended Properties (based on MS-OXONOTE spec) |
This file contains hidden or 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
| Import-Module Microsoft.Graph.Authentication -ErrorAction Stop | |
| $graphModule = Get-Module Microsoft.Graph.Authentication | |
| $msalDll = Get-ChildItem -Path $graphModule.ModuleBase -Filter "Microsoft.Identity.Client.dll" -Recurse | Select-Object -First 1 | |
| if ($msalDll) { | |
| Add-Type -Path $msalDll.FullName | |
| Write-Host "Microsoft.Identity.Client loaded successfully from: $($msalDll.FullName)" | |
| } | |
| else { | |
| Write-Error "Microsoft.Identity.Client.dll not found" | |
| } |
This file contains hidden or 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
| NetworkCredential networkCredential = new NetworkCredential("[email protected]", "blah"); | |
| PublicClientApplicationBuilder pcaConfig = PublicClientApplicationBuilder.Create("d64799fe-dfb2-480b-a3be-a7a5a0bdaf32").WithTenantId("eb8db77e-65e0-4fc3-b967-b14d5057375b"); | |
| var app = pcaConfig.Build(); | |
| var tokenResult = app.AcquireTokenByUsernamePassword(new string[] { "https://outlook.office.com/POP.AccessAsUser.All" }, networkCredential.UserName, networkCredential.SecurePassword).ExecuteAsync().GetAwaiter().GetResult(); | |
| var saslformatedToken = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes("user=" + networkCredential.UserName + (char)1 + "auth=Bearer " + tokenResult.AccessToken + (char)1 + (char)1)); | |
| var client = new Pop3Client(); | |
| client.Connect("outlook.office365.com", 995, true); | |
| client.Authenticate(networkCredential.UserName, saslformatedToken, AuthenticationMethod.XOAUTH2); | |
| int messageCount = client.GetMessageCount(); | |
| var lastMessage = client.GetMessage(messageCount); |
This file contains hidden or 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 Microsoft.Exchange.WebServices.Data; | |
| using System.Threading.Tasks; | |
| using System.Net; | |
| using System.Security; | |
| using Microsoft.Identity.Client; | |
| using System.Net.Http; |
This file contains hidden or 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
| Create a Draft message | |
| POST https://graph.microsoft.com/v1.0/users('[email protected]')/mailfolders/drafts/messages HTTP/1.1 | |
| { | |
| "Subject": "Test Message 1234", | |
| "Body": { | |
| "ContentType": "HTML", | |
| "Content": "Rgds Glen" | |
| }, |
This file contains hidden or 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.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using System.Net.Http; | |
| using System.Net.Http.Headers; | |
| using Microsoft.Identity.Client; | |
| using Newtonsoft.Json; | |
| using Microsoft.Graph; | |
| using System.IO; |
This file contains hidden or 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
| function Get-AccessTokenForGraphFromCertificate{ | |
| param( | |
| [Parameter(Position = 1, Mandatory = $true)] | |
| [String] | |
| $TenantDomain, | |
| [Parameter(Position = 2, Mandatory = $true)] | |
| [String] | |
| $ClientId, | |
| [Parameter(Position = 3, Mandatory = $false)] | |
| [System.Security.Cryptography.X509Certificates.X509Certificate2] |
This file contains hidden or 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
| <soap:Envelope | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" | |
| xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" | |
| xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> | |
| <soap:Header> | |
| <t:RequestServerVersion Version="Exchange2016" /> | |
| </soap:Header> | |
| <soap:Body> | |
| <m:FindItem Traversal="Shallow"> |
NewerOlder