Skip to content

Instantly share code, notes, and snippets.


Asish Padhy AsishP

  • Sydney, Australia
View GitHub Profile
View Search Unified Audit Log
$data = Search-UnifiedAuditLog
-StartDate $startInterval
-EndDate $endInterval
-Operations FileAccessed, FilePreviewed, PageViewed, PageViewedExtended, SearchViewed, CompanyLinkUsed, SecureLinkUsed, FileDownloaded, FileModified, FileUploaded, FileDeleted, FolderModified, CompanyLinkCreated, SharingInheritanceBroken, ListUpdated, FileSyncDownloadedFull, FileSyncUploadedFull
-SessionId $sessionId
-SessionCommand ReturnLargeSet
-ResultSize 5000
## Start Date - Date and Time in local Computer Date Time format
## End Date - Date and Time in local Computer Date Time format
## Operations - For more information see here -
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;
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