Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Cardy johnnycardy

View GitHub Profile
@johnnycardy
johnnycardy / pubsub.ts
Created Jul 13, 2020
Simple pub/sub TypeScript class
View pubsub.ts
export default class PubSub {
private topics: { [id: string] : PubSubTopic; } = {};
private constructor(){
}
public static subscribe(topic:string, listener:(args:any)=>void) : void {
this.getInstance().subscribeToTopic(topic, listener);
}
@johnnycardy
johnnycardy / test-list-items.ts
Created May 31, 2020
Code for creating test list items for demos etc.
View test-list-items.ts
private createListItem() : void {
this.context.spHttpClient.post(`https://TENANT.sharepoint.com/_api/web/lists/GetByTitle('Opportunities')?$select=ListItemEntityTypeFullName`, SPHttpClient.configurations.v1, {
method: 'get',
headers: new Headers({
'Accept': 'application/json',
'Content-Type': 'application/json'
})
}).then(result => {
@johnnycardy
johnnycardy / ExecuteQueryAsync
Last active Aug 29, 2019
ExecuteQueryAsync for Microsoft SharePoint CSOM 15/16 (On Premise)
View ExecuteQueryAsync
private static async Task CSOM15ExecuteAsync(ClientRuntimeContext clientContext)
{
try
{
//ScriptTypeMap.EnsureInited();
Assembly csomRuntime = Assembly.GetAssembly(typeof(ClientRuntimeContext));
Type scriptTypeMap = csomRuntime.GetType("Microsoft.SharePoint.Client.ScriptTypeMap");
InvokePrivateStaticMethod(scriptTypeMap, "EnsureInited");
//ClientRequest pendingRequest = PendingRequest;
@johnnycardy
johnnycardy / GetEntityParametersCodeActivity.cs
Last active Feb 20, 2017
Microsoft CRM workflow code activity to retrieve various useful parameters for the current executing context.
View GetEntityParametersCodeActivity.cs
public class GetEntityParametersCodeActivity : CodeActivity
{
[Output("PrimaryEntityID")]
[ArgumentDescription("Primary Entity ID.")]
public OutArgument<string> PrimaryEntityId { get; set; }
[Output("PrimaryEntityName")]
[ArgumentDescription("Primary Entity Name.")]
public OutArgument<string> PrimaryEntityName { get; set; }
View tabs.js
<! Reference jQuery on the Google CDN >
<script src="//code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
<! Reference jQueryUI on the Google CDN >
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.min.js" type="text/javascript"></script>
<script src="//cdn.jsdelivr.net/jquery.cookie/1.4.1/jquery.cookie.min.js" type="text/javascript"></script>
<style>
.ui-widget-header { background: none; border-radius: 0; border-left: 0; border-top: 0; border-right: 0; }
#tabsContainer { border:none;}
.ms-webpartzone-cell { margin: 0 !important; border:0; }
You can’t perform that action at this time.