Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Rajesh Sitaraman rjesh-git

🎯
Focusing
View GitHub Profile
View Get-Teams.ps1
## Run this in PowerShell as Administrator
## Install PnP PowerShell Module
Install-Module -Name PnP.PowerShell -AllowClobber
Import-Module PnP.PowerShell -Force
## Change YourOffice365Domain with yours, enter the global admin creds when prompted
Connect-PnPOnline -Url https://YourOffice365Domain-admin.sharepoint.com/
## Gets all Teams in tenant
View Get-IgniteContent.ps1
# Author Rajesh Sitaraman
# @rjesh | rjesh.com
<#
.SYNOPSIS
Download Ignite 2019 session presentation slides and videos.
.EXAMPLE
PS C:\> .\Get-IgniteContent.ps1 -DownloadPath /Users/rajeshsitaraman/src/public/share/IG-2019 -Keyword "AI"
.EXAMPLE
PS C:\> .\Get-IgniteContent.ps1 -DownloadPath /Users/rajeshsitaraman/src/public/share/IG-2019 -Keyword "Teams" -IncludeVideos
View computer-vision-output.json
{
"categories": [
{
"name": "others_",
"score": 0.00390625
},
{
"name": "outdoor_",
"score": 0.01953125,
"detail": {
@rjesh-git
rjesh-git / hideTeams.sh
Created May 2, 2019
Office365 CLI hide Teams creation prompt
View hideTeams.sh
# Login to SharePoint online team site as owner
o365$ spo login https://M365x816568.sharepoint.com/sites/it
# set TeamifyHidden property as True
o365$ spo propertybag set --webUrl https://M365x816568.sharepoint.com/sites/it --key TeamifyHidden --value True
@rjesh-git
rjesh-git / addClientSideWebPart.ps1
Last active Mar 8, 2018
Add Client Side WebPart using PnP PoSh
View addClientSideWebPart.ps1
function ConvertTo-Hashtable {
[CmdletBinding()]
[OutputType('hashtable')]
param (
[Parameter(ValueFromPipeline)]
$InputObject
)
process {
if ($null -eq $InputObject) {
@rjesh-git
rjesh-git / uploadImage.html
Last active Feb 22, 2018
Upload Image from CEWP/Script Editor
View uploadImage.html
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script type="text/javascript">
var ShowInsertImage = function (ctlId) {
var dOpt = {
url: imagesPath,
args: null, dialogReturnValueCallback: function callback(status, result) {
console.log('new file uploaded here:'+result.newFileUrl);
$('#container').append( '<br/><img src="'+result.newFileUrl+'" height="200" width="200">' );
},
View pagecontextinfo.js
CorrelationId : "b215479e-f056-5000-11a1-ec000000000010"
DesignPackageId : "00000000-0000-0000-0000-000000000000"
PreviewFeaturesEnabled: true
PublishingFeatureOn : false
ReycleBinItemCount : -1
aadInstanceUrl : "https://login.windows.net"
aadTenantId : "96d8e75d--14a031e2320f"
aadUserId : "e7d71f70-13e9-0000-0000-86d1269cd536"
alertsEnabled : true
allowSilverlightPrompt : "True"
View _spPageContextInfo.js
// This is how you can access the page context info
this.context.pageContext.legacyPageContext;
// Retreive current user display name
this.context.pageContext.legacyPageContext['userDisplayName']);
// Even site classification
this.context.pageContext.legacyPageContext['siteClassification']);
@rjesh-git
rjesh-git / addSCACommSites.ps1
Last active Feb 2, 2018
add site collection admin to communication sites
View addSCACommSites.ps1
# Update the tenant url
PS C:\> .\Add-CommSitesSCA.ps1 -Url https://<tenant>-admin.sharepoint.com
## Or Provide optional credentials
PS C:\> $creds = Get-Credential
PS C:\> .\Add-CommSitesSCA.ps1-Url https://<tenant>-admin.sharepoint.com -Credentials $creds
@rjesh-git
rjesh-git / GetAllGroups.ps1
Last active Nov 8, 2017
Get all Office 365 groups in tenant
View GetAllGroups.ps1
$scopes = @("Group.Read.All")
Connect-PnPMicrosoftGraph -Scopes $scopes
Get-PnPUnifiedGroup