Skip to content

Instantly share code, notes, and snippets.

Brian T. Jackett BrianTJackett

View GitHub Profile
@BrianTJackett
BrianTJackett / PS-Get_PowerApps_App_Connections.ps1
Created Mar 14, 2019
Iterate through all environments and get all PowerApps apps and the connections they use.
View PS-Get_PowerApps_App_Connections.ps1
Add-PowerAppsAccount
$environments = Get-PowerAppEnvironment
foreach($environ in $environments.EnvironmentName)
{
$apps = Get-AdminPowerApp -EnvironmentName $environ
$apps | Add-Member -MemberType ScriptProperty -Name Connections -Value {$this.internal.properties.connectionReferences.PSObject.Properties.Value.DisplayName} -Force
$apps | Select-Object AppName, DisplayName, Connections
}
View CS-Graph_Request_Users_GraphServiceClient.cs
var graphResult = graphClient.Users.Request().GetAsync().Result;
Console.WriteLine(graphResult[0].DisplayName);
@BrianTJackett
BrianTJackett / CS-Graph_Class_MsalAuthenticationProvider.cs
Created Dec 11, 2018
Microsoft Graph create class to handle authentication with Azure AD and use access token on subsequent requests.
View CS-Graph_Class_MsalAuthenticationProvider.cs
public class MsalAuthenticationProvider : IAuthenticationProvider
{
private ConfidentialClientApplication _clientApplication;
private string[] _scopes;
public MsalAuthenticationProvider(ConfidentialClientApplication clientApplication, string[] scopes) {
_clientApplication = clientApplication;
_scopes = scopes;
}
@BrianTJackett
BrianTJackett / CS-Graph_Prepare_GraphServiceClient.cs
Last active Dec 11, 2018
Microsoft Graph C# .Net Core prepare GraphServiceClient
View CS-Graph_Prepare_GraphServiceClient.cs
var clientId = "<AzureADAppClientId>";
var clientSecret = "<AzureADAppClientSecret>";
var redirectUri = "<AzureADAppRedirectUri>";
var authority = "https://login.microsoftonline.com/<AzureADAppTenantId>/v2.0";
var cca = new ConfidentialClientApplication(clientId, authority, redirectUri, new ClientCredential(clientSecret), null, null);
// use the default permissions assigned from within the Azure AD app registration portal
List<string> scopes = new List<string>();
scopes.Add("https://graph.microsoft.com/.default");
@BrianTJackett
BrianTJackett / PS-Get_All_Sites_SPO.ps1
Created Jul 31, 2018
Get all sites from SharePoint Online using SPO Management Shell commands.
View PS-Get_All_Sites_SPO.ps1
Connect-SPOService -Url '<tenantAdminUrl>'
Get-SPOSite -Limit all -IncludePersonalSite $true
@BrianTJackett
BrianTJackett / CS-CSOM_Traverse_All_Sites_SPO.txt
Last active Jul 31, 2018
Traverse all sites in SharePoint Online using C# CSOM.
View CS-CSOM_Traverse_All_Sites_SPO.txt
List <SiteProperties> list = new List <SiteProperties>();
SPOSitePropertiesEnumerable ssp = null;
SPOSitePropertiesEnumerableFilter sspFilter = new SPOSitePropertiesEnumerableFilter();
SharePointOnlineCredentials creds = new SharePointOnlineCredentials("myUsernameGoesHere", securePassword);
using (ClientContext cc = new ClientContext("myURLGoesHere"))
{
cc.Credentials = creds;
You can’t perform that action at this time.