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
<html> | |
<head> | |
<!-- | |
@tag hta:application | |
@attribute ApplicationName Sets the name of the HTA. | |
@attribute Border [Thick]|Thin|None | |
@attribute BorderStyle [Normal]|Raised|Sunken|Complex|Static | |
@attribute Caption [Yes]|No |
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
Import-Module ActiveDirectory | |
$users = Get-ADUser -Server dc01.drewchapin.com -Properties proxyAddresses,msRTCSIP-PrimaryUserAddress | |
# -Filter { physicalDeliveryOfficeName -eq "Location Name" } | |
ForEach( $user in $users ) | |
{ | |
$sip1 = $user.'msRTCSIP-PrimaryUserAddress' | |
$sip2 = $user.proxyAddresses | Where { $_ -like "SIP:*" } |
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
Sub SendEmail( fromAddress, toAddress, subject, body ) | |
On Error Resume Next | |
Dim Email | |
Set Email = CreateObject("CDO.Message") | |
Email.From = fromAddress | |
Email.To = toAddress | |
Email.Subject = subject | |
Email.TextBody = body | |
Email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 | |
Email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.google.com" |
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
Option Explicit | |
Public Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0 | |
Public Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1 | |
''' | |
''' Determine if specified file exists | |
''' | |
Public Function IsValidLink(path As String) As Boolean | |
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.Reflection; | |
using System.Windows.Forms; | |
namespace MyExcelAddin | |
{ | |
public partial class ThisAddIn | |
{ | |
public Win32Window MainWindow { get; set; } |
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
/// <summary> | |
/// Returns all child and grandchild controls of of the specified type. | |
/// </summary> | |
/// <typeparam name="T">Type of control to look for</typeparam> | |
/// <param name="parent">Parent to get list of controls from</param> | |
/// <returns></returns> | |
public static IEnumerable<T> ControlsOfType<T>( this Control parent ) where T : Control | |
{ | |
foreach( Control child in parent.Controls ) | |
{ |
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
/// <summary> | |
/// Turns on or off double buffering for controls that do not expose the property. | |
/// </summary> | |
public static void DoubleBuffered( this Control control, bool value ) | |
{ | |
Type type = control.GetType(); | |
PropertyInfo info = type.GetProperty("DoubleBuffered",BindingFlags.Instance|BindingFlags.NonPublic); | |
info.SetValue(control,value,null); | |
} |
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
/// <summary> | |
/// Generate a backslash separated path showing parent\child\grandchild relationship. | |
/// </summary> | |
public static string GeneratePath( this Control control ) | |
{ | |
string path = control.Name; | |
for( Control parent = control.Parent; parent != null; parent = parent.Parent) | |
path = String.Format("{0}\\{1}",parent.Name,path); | |
return path; | |
} |
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
static int Update( SqlConnection sql, DataTable table, string tableName = null ) | |
{ | |
int count = 0; | |
tableName = tableName ?? table.TableName; | |
if( String.IsNullOrWhiteSpace(tableName) ) throw new NullReferenceException("tableName cannot be null or empty"); | |
if( sql.State != ConnectionState.Open ) | |
sql.Open(); | |
using( SqlCommand cmd = sql.CreateCommand() ) | |
{ | |
List<string> keys = table.PrimaryKey.Select(x=>x.ColumnName).ToList(); |
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.Text; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System.DirectoryServices; | |
using System.DirectoryServices.ActiveDirectory; | |
namespace ActiveDirectoryExTest | |
{ |