Skip to content

Instantly share code, notes, and snippets.

View JoeAlanis's full-sized avatar

Joe Alanis [MSFT] JoeAlanis

View GitHub Profile
@JoeAlanis
JoeAlanis / Get-FlowsUsingLegacySendMail.ps1
Last active December 9, 2024 18:08
Get Flows Using Legacy SharePoint SendMail API
<#
Pre-requisites
https://learn.microsoft.com/en-us/power-platform/admin/powerapps-powershell
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
Azure App Registration API Permissions
Most of these may need to be added by searching under "APIs my organization uses" and adding them to the app registration
For the Power Platform API, if not present, follow the steps here
@JoeAlanis
JoeAlanis / Get-GroupPlannerTasks-UserDelegated.ps1
Created May 26, 2023 14:20
Get Group Planner Tasks with User Delegated Permissions
# App Registration requires the following Graph permissions (User Delegated)
# User.Read, Group.Read.All, Tasks.Read.All, Tasks.Read.Shared
$cloud = "" # Valid types, null for Worldwide, GCC, GCCH, DOD
$_clientId = '' # Application (Client) Id from the Azure App registration
$_tentantId = '' # Directory ID from the Azure App Registration
$_authHeader = $null
$_groupName = "Team4" # Group name of the tasks you want to list
switch ($cloud)
@JoeAlanis
JoeAlanis / Add-AzureAppRedirectUrisFromFile.ps1
Created May 26, 2023 12:44
Add Azure App Registration Redirect URIs from File
$tenantId = '<Your Azure Tenant Id>'
$appObjectId = "<Your Application Object Id>" # Object ID and not the Application ID
$path = "$env:USERPROFILE\Desktop\Uris.txt"
### You shouldn't have to modify below this line ###
Connect-AzureAD -TenantId $tenantId
# ObjectId for application from App Registrations in your AzureAD
@JoeAlanis
JoeAlanis / Add-AzureAppRedirectUris.ps1
Created May 26, 2023 12:43
Script to add multiple redirect URIs to an Azure App Registration
$tenantId = '<Your Azure Tenant Id>'
$appObjectId = "<Your Application Object Id>" # Object ID and not the Application ID
$newURLs = 'https://mynewurl','https://mynewurl2' # reply URLs to add
### You shouldn't have to modify below this line ###
Connect-AzureAD -TenantId $tenantId
$app = Get-AzureADApplication -ObjectId $appObjectId
# Existing reply URLs list
@JoeAlanis
JoeAlanis / Add-PnpSPListItem.ps1
Last active January 8, 2019 18:34
Creates list items from a CSV using the PNP libararies. Sample CSV from: https://simplemaps.com/data/us-cities
Set-Location "C:\users\MyUser\Desktop\"
$obj = Import-Csv -Path USCities.csv
$sourceSiteUrl = "http://portal.adatum.local/sites/siteCollectionA"
Connect-PnPOnline $sourceSiteUrl -CurrentCredentials
foreach ($row in $obj){
Write-Output "Adding City $($row.city)"
Add-PnPListItem -List "USCities" -Values @{"Title" = $($row.id);
"City" = $($row.city);
"StateId"=$($row.state_id);
"Zip" = $($row.zips);
@JoeAlanis
JoeAlanis / HideListColumn.js
Created January 7, 2019 20:33
Hides a column from a SharePoint list.
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
var positionOfColumn = -1;
// loop through the headers and fetch the index of the column
$('.ms-listviewtable th').each(function(index, element ) {
if($(this).html().indexOf('StateId') != -1){
//console.log("Found StateId: " + index);
positionOfColumn = index;
}
@JoeAlanis
JoeAlanis / Configure-SQL.psm1
Created November 10, 2018 13:08
Legacy PowerShell module used to configure SQL Server. Portions of the code has been inspired by others and have been credited.
<#
Microsoft provides programming examples for illustration only, without warranty either expressed or
implied, including, but not limited to, the implied warranties of merchantability and/or fitness
for a particular purpose.
This sample assumes that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can help explain the
functionality of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. if you have limited programming
@JoeAlanis
JoeAlanis / jQueryui-is-undefined.js
Created November 10, 2018 12:49
Adds jQueryUI to the header if undefined.
var s;
if (typeof $.ui === 'undefined') {
// jquery ui not loaded
s = document.createElement('script');
s.src = "https://code.jquery.com/ui/1.12.1/jquery-ui.js";
document.head.appendChild(s);
console.log("jQuery UI is undefined. Added reference")
}
$userAccountName="joeb"
$getADUser = (([adsisearcher]"(&(objectCategory=User)(samaccountname=$($userAccountName)))").FindAll()).properties
$getADUser
$groupName="workflowGroup"
$getADGroup = (([adsisearcher]"(&(objectCategory=Group)(name=$($groupName)))").FindAll()).properties
$getADGroup