Skip to content

Instantly share code, notes, and snippets.


Asish Padhy AsishP

  • Sydney, Australia
View GitHub Profile
View Azure Table Scripts reading from CSV
$resourceName = "<Resource Group Name>"
$azureStorage = "<Storage Container Name>"
$azureTable = "<Azure Storage Table>"
$Credential = Get-Credential
function UploadDataToAzureTableStorage {
param (
[Parameter(Mandatory = $true, HelpMessage = 'Please provide the FileName')][ValidateNotNullOrEmpty()][String]$fileName
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 -
View Import Exchange Online PowerShell
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Credential -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber
View React renderMethod
public render(): React.ReactElement<IProps> {
return (
{ ? (
<TooltipHost content={this.props.tooltipMessage || strings.message}
calloutProps={{ gapSpace: 0 }}
directionalHint={this.props.tooltipDirectional || DirectionalHint.leftTopEdge}>
View React componentDidUpdate
// Check the component properties and state for changes
public componentDidUpdate(prevProps : IProps, prevState : IState) : void
// If properties have changed bind it
if( !== || this.state.stateValue !== prevState.stateValue)
//Do more things here
View React componentDidMount
// Using pnpjs to get items and
public componentDidMount()
sp.web.lists.getByTitle(listTitle).items.get().then((items: Item[]) => {
stateValue : items
View React ComponentWillMount
// Do a REST Query to get data from REST using spHttpClient
public componentWillMount()
const items: any = await this.props.context.spHttpClient.get(restApi, SPHttpClient.configurations.v1, {
headers: {
'Accept': 'application/json;odata.metadata=none'
}).then(resp => resp.json());
View React OnInit
// SPFx context init below
public onInit(): Promise<void> {
return super.onInit().then(_ => {
// other init code may be present
spfxContext: this.context
View Apply PnP Provisioning Template PowerShell
Set-PnPTraceLog -On -LogFile "<Location in hard drive>" -Level Debug
Apply-PnPProvisioningTemplate -Path "<Folder location>" -ClearNavigation -IgnoreDuplicateDataRowErrors
View SharePoint Create Site PowerShell Command
## Create a SharePoint classic site
New-PnPTenantSite -Title "Title" -Url "" -Lcid 1033 -TimeZone <TimeZoneID> -Template "STS#0" -StorageQuota <Size in MB> -StorageQuotaWarningLevel <Size in MB> -ResourceQuota <quota number> -Description "description" -Owner "" -RemoveDeletedSite -Wait
## Create a new Modern SharePoint site
New-PnPSite -Title "Title" -Url "" -Type CommunicationSite -SiteDesign Showcase -Description "description"
You can’t perform that action at this time.