Skip to content

Instantly share code, notes, and snippets.

Andrew Huey andyhuey

Block or report user

Report or block andyhuey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andyhuey
andyhuey / wcf-example.cs
Created Sep 23, 2019
Calling a Dynamics AX WCF service from .NET Core
View wcf-example.cs
// old way:
public async Task RunAsync()
{
CallContext context = new CallContext();
context.Company = "axcompany";
string pingResp = string.Empty;
var client = new XYZPurchInfoServiceClient();
var rv = await client.wsPingAsync(context);
pingResp = rv.response;
Console.WriteLine("Ping response: {0}", pingResp);
View enable_tls12.ps1
# Enables TLS 1.2 on Windows Server 2008 R2 and Windows 7
# adapted from https://www.derekseaman.com/2010/06/enable-tls-12-aes-256-and-sha-256-in.html
# Must run as admin. Reboot after running.
$tls12key = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2"
if (Test-Path $tls12key) {
Write-Host "TLS 1.2 key already exists."
exit
}
@andyhuey
andyhuey / deleteAllFromList.cs
Created Dec 21, 2016
CSOM code to delete all items from a SharePoint list
View deleteAllFromList.cs
private void deleteAllFromList(ClientContext cc, List myList)
{
int queryLimit = 4000;
int batchLimit = 100;
bool moreItems = true;
string viewXml = string.Format(@"
<View>
<Query><Where></Where></Query>
<ViewFields>
@andyhuey
andyhuey / doesVendorRecExist.cs
Created Dec 17, 2016
a bit of SharePoint CSOM code
View doesVendorRecExist.cs
private bool doesVendorRecExist(string companyCode, string vendorNum,
List vendorList, ClientContext cc)
{
CamlQuery spq = new CamlQuery();
spq.ViewXml = string.Format(@"
<View><Query>
<Where><And>
<Eq><FieldRef Name='VendorNo' /><Value Type='Text'>{0}</Value></Eq>
<Eq><FieldRef Name='CompanyName' /><Value Type='Text'>{1}</Value></Eq>
</And></Where>
@andyhuey
andyhuey / tfpt_ex1.ps1
Last active Aug 29, 2015
TFPT query exmple
View tfpt_ex1.ps1
# Given AX project #, return ID.
param (
[string]$projno = $( Read-Host "Enter project # (e.g. 123.4)" )
)
[string]$tfpt = "C:\Program Files (x86)\Microsoft Team Foundation Server 2012 Power Tools\TFPT.EXE"
[string]$svr = "http://myTfsServer:8080/tfs/defaultcollection"
[string]$projname = "myProjName"
[string]$query = "SELECT [System.Id], [System.Title] FROM WorkItems " +
"WHERE [System.TeamProject] = '$projname' " +
@andyhuey
andyhuey / AjhTestRSL
Created Oct 10, 2014
RecordSortedList test
View AjhTestRSL
static void AjhTestRSL(Args _args)
{
CustTable custTable;
RecordSortedList myList = new RecordSortedList(tableNum(CustTable));
boolean moreRecs;
myList.sortOrder(fieldNum(CustTable, AccountNum));
// create a list
while select firstOnly10 * from custTable
View fractions.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace MySuit.MySuitV2.BLL
{
public class Utility
{
View AjhBase36Test.x++
static void AjhBase36Test(Args _args)
{
// ajh 2014-05-07: 611.23
// adapted from http://en.wikipedia.org/wiki/Base_36.
// note: handles non-negative integers only.
#define.NBASE(36)
#define.CLIST("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
int64 base36_decode(str base36_input)
{
View isUserInRole.x++
/// <summary>
/// return true is the specified user is in any of the roles in the roleNames container.
/// </summary>
/// <param name="axUserId">
/// AX user id, e.g. curUserId()
/// </param>
/// <param name="roleNames">
/// container of role names to check. (use role NAME, not label.)
/// </param>
/// <returns>
View isUserInRole.x++
/// <summary>
/// return true is the specified user is in any of the roles in the roleNames container.
/// </summary>
/// <param name="axUserId">
/// AX user id, e.g. curUserId()
/// </param>
/// <param name="roleNames">
/// container of role names to check. (use role NAME, not label.)
/// </param>
/// <returns>
You can’t perform that action at this time.