Skip to content

Instantly share code, notes, and snippets.

Asish Padhy AsishP

  • Sydney, Australia
Block or report user

Report or block AsishP

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
View GetTranslatedText.cs
public string getTranslatedText(string text)
string host = "";
string route = "/translate?api-version=3.0&to=en";
string translatedText = "";
System.Object[] body = new System.Object[] { new { Text = text } };
var requestBody = JsonConvert.SerializeObject(body);
using (var client = new HttpClient())
View DetectLanguage.cs
public string DetectLanguageFromText(string text)
log.Info($"Got Text {text}");
string detectedLanguage = "";
var result = client.DetectLanguageAsync(new BatchInput(
new List<Input>()
new Input("1", text)
View TextAnalyticsInitialisation.cs
public TextAnalyticsProcessing(TraceWriter Log)
log = Log;
log.Info("Text Processing Section Called");
// Create a client.
client = new TextAnalyticsClient(new ApiKeyServiceClientCredentials())
Endpoint = ""
}; //Replace 'australiaeast' with the correct region for your Text Analytics subscription
log.Info("Text Processing section initialized");
AsishP / AddUpdateSPHttpClient.ts
Last active May 6, 2019
Add/Update with SP Http Client
View AddUpdateSPHttpClient.ts
let addorUpdateObj : any = {
AuthorId :,
__metadata : {
'type': `SP.Data.CustomListItem`
console.log(`Sending object ${addorUpdateObj}`);
AsishP / GetSPDataHttpClient.ts
Created May 6, 2019
Get operation using SP Http Client
View GetSPDataHttpClient.ts
try {
let spHttpClient : SPHttpClient = context.spHttpClient;
let url = `${context.pageContext.web.absoluteUrl}/_api/web/lists/GetByTitle('${listTitle}')/Items?$select=Author/EMail,*&$expand=Author&$filter=Author/EMail eq ''`;
spHttpClient.get(url, SPHttpClient.configurations.v1).then((response : SPHttpClientResponse) => {
response.json().then((responseJson : any) => {
if (this.isValidObject(responseJson) && responseJson.value.length !== 0) {
AsishP / SingleWebPartApp.ps1
Last active Feb 27, 2019
Add Single Web Part App Page
View SingleWebPartApp.ps1
Connect-PnPOnline -Url ""
## Add Page using PnP PowerShell
$page = Add-PnPClientSidePage -Name "TestAppPart.aspx" -LayoutType SingleWebPartAppPage
## Add a section the Page
Add-PnPClientSidePageSection -Page $page -SectionTemplate OneColumnFullWidth
## Add a Client Side Web Part
Add-PnPClientSideWebPart -Page $page -DefaultWebPartType SiteActivity -Section 0 -Column 0
View MasterComponentReactControl
export default class MasterComponent extends React.Component<MasterComponentProps, MasterComponentState> {
this._childSelect = this._childSelect.bind(this);
this.state= {
stateprop1 : null,
stateprop2 : true
View ChildComponentReactControl
import * as React from 'react';
import { ChildComponentState } from './ChildComponentState';
import { WebPartContext } from '@microsoft/sp-webpart-base';
export interface ChildComponentProps
context : WebPartContext;
childoutput?: (item: any) => void;
AsishP / Get data from Office 365 Azure Log
Last active Jul 17, 2019
Get data from Office 365 Azure Log
View Get data from Office 365 Azure Log
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Web;
using Newtonsoft.Json.Linq;
using System.Net.Http;
using Newtonsoft.Json;
using System.IO;
using Microsoft.Extensions.Logging;
using System.Linq;
AsishP / Connect to Azure AD in Azure Function
Last active Jun 13, 2019
Connect to Azure AD in Azure Function
View Connect to Azure AD in Azure Function
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using System.Collections.Generic;
using Newtonsoft.Json;
using Microsoft.Azure.WebJobs.Extensions.Http;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Extensions.Logging;
You can’t perform that action at this time.