Skip to content

Instantly share code, notes, and snippets.

View davecra's full-sized avatar
💭
Coding for arrays

David E. Craig davecra

💭
Coding for arrays
View GitHub Profile
@davecra
davecra / ExpandDLOperation.xml
Created February 11, 2020 17:58
ExpandDL operation for PrivateDL
<?xml version="1.0" encoding="utf-8"?>
<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:ExpandDL>
<m:Mailbox>
<t:ItemId Id="AAMkADU2NjQzOWIxLWZkMTktNDU2NC04MGYwLTc4OGUxZTQ3ZTQ4OQBGAAAAAABU0Ha8nllhSqfh0CtR+4+uBwAdo3MIorCqSaC1lyH8qlH1AAAAAAEOAAAdo3MIorCqSaC1lyH8qlH1AAQQFxCnAAA=" />
</m:Mailbox>
@davecra
davecra / ResolveNamesResponse.xml
Created February 11, 2020 17:57
The SOAP Response from an EWS ResolveNames Operation
<?xml version="1.0" encoding="utf-8"?>
<!-- Note: EwsEditor has replaced the "utf-16" text in the first line with"utf-8" in order for the XML to render in the response web control. -->
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="2305" MinorBuildNumber="24" Version="V2018_01_08" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</s:Header>
<s:Body>
<m:ResolveNamesResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:ResolveNamesResponseMessage ResponseClass="Success">
@davecra
davecra / previewapi.html
Created January 23, 2020 15:17
Preview API CDN
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>My OfficeJS Add-in</title>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js" type="text/javascript"></script>
<!--<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>-->
<!-- PREVIEW API CDN -->
<script src="https://appsforoffice.microsoft.com/lib/preview/hosted/Office.js" type="text/javascript"></script>
</head>
@davecra
davecra / WorkbookOpen.vb
Created October 2, 2019 15:05
The WorkbookOpen event for the VBAProjectNotSignedWarning-Addin
Private Sub xlApp_WorkbookOpen(ByVal Wb As Workbook)
If Right(UCase(Wb.Name), 4) = "XLSM" Then
If Wb.VBASigned = False Then
MsgBox "The workbook '" & Wb.Name & "' is not signed. " & _
"If there are auto-run macros in the workbook, " & _
"they will not be run.", vbExclamation, "Signed Workbook Check"
End If
End If
End Sub
@davecra
davecra / Ribbon.cs
Last active March 26, 2025 05:49
Code for Removing Web Add-in Customization from the Ribbon in Outlook
public string GetCustomUI(string ribbonID)
{
try
{
// the property tag for the user profile entry
const string PR_EMSMDB_SECTION_UID = "http://schemas.microsoft.com/mapi/proptag/0x3D150102";
// laod the base ribbon
string LstrRibbonXml = GetResourceText("RemoveOfficeWebAddin.DisableWebAddinsRibbon.xml");
// code base is the install directory where the vsto file is located
string LstrPath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath.ToString();
@davecra
davecra / sampleOfficeEvent.js
Created May 24, 2019 00:49
Sample demonstrating use of simpleMIMEClass
function sampleOfficeEvent(event){
/** @type {Office.Types.ItemCompose} */
var item = Office.cast.item.toItemCompose(Office.context.mailbox.item);
item.saveAsync(function(idResult) {
easyEws.getMailItemMimeContent(idResult.value,
function(mimeResult) {
/** {@type (simpleMIMEClass)} */
var oMime = new simpleMIMEClass();
oMime.Parse(mimeResult);
var doc = $(oMime.HTML()); // load into an HTML document
@davecra
davecra / simpleMIMEClass.js
Created May 24, 2019 00:27
Simple client-side MIME parsing object
/**
* Simple MIME Object for parsing basic MIME results:
* - Headers (parts)
* - HTML (full)
* - Attachments
* - Embedded Image Data
*/
function simpleMIMEClass() {
/** @type {string} */
var fullHeader = "";
@davecra
davecra / ThisAddin.cs
Created March 28, 2019 18:59
IMessageFilter implementation in Excel VSTO Add-in
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace ExcelOleFilterAddIn
{
public partial class ThisAddIn : ExcelOleFilterAddIn.IMessageFilter
{
[DllImport("ole32.dll")]
static extern int CoRegisterMessageFilter(IMessageFilter lpMessageFilter, out IMessageFilter lplpMessageFilter);
@davecra
davecra / IMessageFilter.cs
Created March 28, 2019 18:57
IMessageFilter C# Implemtation
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace ExcelOleFilterAddIn
{
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct INTERFACEINFO
{
[MarshalAs(UnmanagedType.IUnknown)]
@davecra
davecra / AddNumbersFunction.cs
Created January 23, 2019 04:08
Simple Azure Function do Demonstrate in Excel
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");