Skip to content

Commit

Permalink
Merge pull request #179 from cjvandyk/6.12.800
Browse files Browse the repository at this point in the history
6.12.800
-Added `Identity.Cert.NewSelfSigned()` method to cenerate on demand self signed certificates that are RSA/SHA512 based. 
-Added the `RUNNING_IN_AZURE` check to `Core.GetRunFolder()`. -Added `.GetDriveItemVersions()` and `.DownloadVersions()` to `Microsoft.Graph.Models.DriveItem`. 
-Added `.GetVersions()` to `Microsoft.Graph.Models.DriveItem`. 
-Added `Graph.GetSite()` method.
-Added `Constants.GraphObjectType`.
-Added `consoleFeedback` and `feedbackEvery` parameters to `Graph.GetListItems()`. 
-Added public `Graph.Get()` generic method for handling multiple kinds of Graph object aggregation. 
-Added internal `Graph.AddFilterSelect()` method for applying filter and select parameters to dynamic `QueryParameters`. 
-Added internal `Graph.GetPages()` method for retrieving all pages of a given dynamic `CollectionResponse`. 
-Added public `.GetDrives()` extension method to the Microsoft.Graph.Models.Group object.
-Added public `.GetDrives()` extension method to the Microsoft.Graph.Models.Site object.
-Added public `.GetDrives()` extension method to the Microsoft.Graph.Models.User object.
-Added `Constants.GraphDriveParentType`.
-Added `GraphDriveParentType` as a parameter to `Graph.Get()` in order to handle the different types of DriveCollections. 
-Added internal `Graph.ConvertObjToDrive()` method for converting `List<object>` to `List<Drive>`. 
-Added multithreading logic to `Graph.GetGroups()` to boost performance.  The number of threads employed is based on the number of logical CPU cores reported by the Environment. 
-Added `Core.ForEach()` method to do parallel foreach processing in batches.  This is especially useful when the Action specified in body executes complex operations like making REST calls against big data sources e.g. having to call the /_api/web/ensureuser REST method in SharePoint when validating 200,000 users will inevitably lead to thread timeouts since the CPU just can't handle that many parallel threads concurrently. 
-Added `SharePoint.ValidUser()` method that validates if a given user is a valid SharePoint user by calling SharePoint's /_api/web/ensureuser REST method. 
-Drop Microsoft.Extensions dependencies down from version 8 to 6 for Azure Function compatibility. 
-Fixed `Graph.GetSites()` method that never implemented the iterator. 
-Fixed a breakout bug in `Graph.GetGroupsPages()`. 
-Made Logit.Instance.ILogger setter public.
-Optimized the `.TakeAndRemove()` extension method for System.Collections.Generic.List. -Removed `using static` references related to the `Graph.Get()` method and used full namespace instead. 
-Updated `System.Object.Load()` and `System.Object.Save()` extension methods in State to handle dynamic object types. 
-Name shortening refactor.
  • Loading branch information
cjvandyk authored Mar 9, 2024
2 parents 9ce1fcc + c70a0c9 commit 01e9524
Show file tree
Hide file tree
Showing 141 changed files with 1,889 additions and 478 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="GCCHigh.Extensions.Core" Version="6.6.800" />
<PackageReference Include="GCCHigh.Extensions.Core" Version="6.9.800" />
</ItemGroup>
<ItemGroup>
<None Include="Images\Extensions-128x128.png">
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>6.1.800</VersionPrefix>
<VersionPrefix>6.2.800</VersionPrefix>
<LangVersion>latest</LangVersion>
<Company>Cornelius J. van Dyk</Company>
<Copyright>Copyright © 2009-2024</Copyright>
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@

### **6.1.800 (2024-02-27)**<br>
- Dependency updates.<br>

### **6.2.800 (2024-03-10)**<br>
- Name shortening refactor.<br>
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>6.1.800</VersionPrefix>
<VersionPrefix>6.2.800</VersionPrefix>
<LangVersion>latest</LangVersion>
<Company>Cornelius J. van Dyk</Company>
<Copyright>Copyright © 2009-2024</Copyright>
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions Constants/VersionHistory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# GCCHigh.Extensions.Constants Version History.

### **6.0.800 (2024-02-27)**<br>
- Rearchitected and Optimized.<br>
- Rebranded the `Extensions` set of NuGet packages as `GCCHigh.Extensions`.<br>

### **6.1.800 (2024-02-27)**<br>
- Added `UserMembershipType` type to Constants.<br>

### **6.2.800 (2024-03-10)**<br>
- Added `Constants.TimeSpanType`.<br>
- Added `Constants.GraphObjectType`.<br>
- Added `Constants.GraphDriveParentType`.<br>
- Name shortening refactor.<br>
76 changes: 47 additions & 29 deletions Extensions.Core/Extensions.Core.cs → Core/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Microsoft.Identity.Client;
using System.Threading.Tasks;
using System.Linq;
using System.Linq.Expressions;

namespace Extensions
{
Expand Down Expand Up @@ -273,9 +274,9 @@ public static string GetSetting(string key)
tenantConfig.LoadConfig();
AuthMan.TargetTenantConfig = tenantConfig;
}
if (AuthMan.TargetTenantConfig.Settings.ContainsKey(key))
if (AuthMan.TargetTenantConfig.Settings.TryGetValue(key, out string result))
{
return AuthMan.TargetTenantConfig.Settings[key];
return result;
}
return "";
}
Expand Down Expand Up @@ -577,9 +578,9 @@ public static string NoNull(IDictionary<string, object> dict,
{
try
{
if (dict.ContainsKey(fieldName))
if (dict.TryGetValue(fieldName, out object result))
{
return dict[fieldName].ToString();
return result.ToString();
}
else
{
Expand Down Expand Up @@ -969,17 +970,15 @@ public static Microsoft.Graph.Models.ListItem GetUserFromLookupId(
public static string GetUserEmailUpn(
Microsoft.Graph.Models.ListItem listItem)
{
if (listItem.Fields.AdditionalData.ContainsKey("EMail") &&
listItem.Fields.AdditionalData["EMail"] != null)
if (listItem.Fields.AdditionalData.TryGetValue("EMail", out object result))
{
return listItem.Fields.AdditionalData["EMail"].ToString();
return result.ToString();
}
if (listItem.Fields.AdditionalData.ContainsKey("EMail") &&
listItem.Fields.AdditionalData["EMail"] != null)
if (listItem.Fields.AdditionalData.TryGetValue("UserName", out result))
{
return listItem.Fields.AdditionalData["UserName"].ToString();
return result.ToString();
}
return "";
return null;
}

/// <summary>
Expand All @@ -1000,25 +999,27 @@ public static string GetUserEmailUpn(
if ((id == null) ||
(id == ""))
{
return "";
return null;
}
var userListItems = GetListItems(
"User Information List",
GetEnv("HomeSiteBaseUrl"),
id);
var userListItems = GetListItems("User Information List",
GetEnv("HomeSiteBaseUrl"),
id);
if ((userListItems != null) &&
(userListItems.Count > 0) &&
(userListItems[0].Fields.AdditionalData.ContainsKey("EMail")) &&
(userListItems[0].Fields.AdditionalData["EMail"] != null))
(userListItems[0].Fields.AdditionalData.TryGetValue("EMail", out object result)))
{
return result.ToString();
}
if (userListItems[0].Fields.AdditionalData.TryGetValue("UserName", out result))
{
return userListItems[0].Fields.AdditionalData["EMail"].ToString();
return result.ToString();
}
return userListItems[0].Fields.AdditionalData["UserName"].ToString();
return null;
}
catch (Exception ex)
{
Err(ex.ToString());
return "";
return null;
}
finally
{
Expand All @@ -1041,21 +1042,38 @@ public static string GetUserEmailUpn(
var item = GetUserFromLookupId(id, ref siteUsers);
if (item == null)
{
return "";
return null;
}
try
{
if ((item.Fields.AdditionalData.ContainsKey("EMail")) &&
(item.Fields.AdditionalData["EMail"] != null))
if (item.Fields.AdditionalData.TryGetValue("EMail", out object result))
{
return result.ToString();
}
try
{
Wrn("Cannot get EMail field, trying UserName instead.");
if (item.Fields.AdditionalData.TryGetValue("UserName", out result))
{
return result.ToString();
}
}
catch (Exception ex)
{
return item.Fields.AdditionalData["EMail"].ToString();
//Both fields don't exist so just drop through.
}
return item.Fields.AdditionalData["UserName"].ToString();
Err("Cannot get UserName field either.");
return null;
}
catch (Exception ex)
{
Err(ex.ToString());
return item.Fields.AdditionalData["UserName"].ToString();
Wrn("Cannot get EMail field, trying UserName instead.");
if (item.Fields.AdditionalData.TryGetValue("UserName", out object result))
{
return result.ToString();
}
Err("Cannot get UserName field either.\n" + ex.ToString());
return null;
}
finally
{
Expand All @@ -1080,7 +1098,7 @@ internal static bool TryAdd(
{
try
{
if (!dic.ContainsValue(val))
if (!dic.ContainsKey(val))
{
dic.Add(key, val);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="GCCHigh.Extensions.Graph" Version="6.3.800" />
<PackageReference Include="GCCHigh.Extensions.Graph" Version="6.4.800" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>6.8.800</VersionPrefix>
<VersionPrefix>6.9.800</VersionPrefix>
<LangVersion>latest</LangVersion>
<Company>Cornelius J. van Dyk</Company>
<Copyright>Copyright © 2009-2024</Copyright>
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 43 additions & 0 deletions Core/VersionHistory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# GCCHigh.Extensions.Core Version History.

### **4.9.700 (2023-03-28)**<br>
- Separate `Extensions.Identity` class from Extensions.cs.<br>

### **6.0.800 (2024-02-26)**<br>
- Rearchitected and Optimized.<br>
- Rebranded the `Extensions` set of NuGet packages as `GCCHigh.Extensions`.<br>

### **6.1.800 (2024-02-26)**<br>
- Added `ActiveAuth` validation to the `.GetSetting()` method.<br>

### **6.2.800 (2024-02-26)**<br>
- Added `TenantString` capture to the `.InitializeTenant()` method.<br>
### **6.3.800 (2024-02-27)**<br>
- Optimized tenant initialization.<br>
### **6.4.800 (2024-02-27)**<br>
- Optimized tenant initialization.<br>
### **6.5.800 (2024-02-27)**<br>
- Optimized tenant initialization.<br>
### **6.6.800 (2024-02-27)**<br>
- Optimized tenant initialization.<br>
### **6.7.800 (2024-02-27)**<br>
- Made `TryAdd()` on `List<>` and `Dictionary<>` in core internal.<br>
### **6.8.800 (2024-02-29)**<br>
- Added the `Core.GetHttpClient()` relay method.<br>
### **6.9.800 (2024-03-10)**<br>
- Added the `RUNNING_IN_AZURE` check to `Core.GetRunFolder()`.<br>
- Added `Core.ForEach()` method to do parallel foreach processing in<br>
batches. This is especially useful when the Action specified in<br>
body executes complex operations like making REST calls against big<br>
data sources e.g. having to call the /_api/web/ensureuser REST<br>
method in SharePoint when validating 200,000 users will inevitably<br>
lead to thread timeouts since the CPU just can't handle that many<br>
parallel threads concurrently.<br>
- Name shortening refactor.<br>
25 changes: 25 additions & 0 deletions DependencyTree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Extensions Dependency Tree.
[![icon](https://raw.githubusercontent.com/cjvandyk/Extensions/master/Images/Extensions-64x64.png)](https://github.com/cjvandyk/Extensions)
![GIF](https://raw.githubusercontent.com/cjvandyk/Extensions/master/Images/Extensions.gif)
![GIF](https://raw.githubusercontent.com/cjvandyk/Extensions/master/Images/Easy%20Date%20convertion%20GIF.gif)
[![License](https://img.shields.io/github/license/cjvandyk/Extensions)](https://github.com/cjvandyk/Extensions/blob/main/LICENSE) [![Maintained](https://img.shields.io/maintenance/yes/2024)](https://github.com/cjvandyk/extensions/releases) [![GitHub Release](https://img.shields.io/github/release/cjvandyk/extensions.svg)](https://GitHub.com/cjvandyk/extensions/releases/) [![NuGet Badge](https://buildstats.info/nuget/Extensions.CS)](https://www.nuget.org/packages/Extensions.cs) [![Repo Size](https://img.shields.io/github/repo-size/cjvandyk/extensions)](https://github.com/cjvandyk/Extensions) [![Closed Issues](https://img.shields.io/github/issues-closed/cjvandyk/extensions.svg)](https://GitHub.com/cjvandyk/extensions/issues?q=is%3Aissue+is%3Aclosed) [![Open Issues](https://img.shields.io/github/issues/cjvandyk/extensions.svg)](https://github.com/cjvandyk/extensions/issues) [![Contributors](https://img.shields.io/github/contributors/cjvandyk/extensions.svg)](https://GitHub.com/cjvandyk/extensions/graphs/contributors/) [![Languages](https://img.shields.io/github/languages/count/cjvandyk/extensions.svg)](https://github.com/cjvandyk/Extensions/search?l=c%23) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ExtensionsCS/Extensions?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Discord](https://raw.githubusercontent.com/cjvandyk/Extensions/master/Images/Discord.png?raw=true)](https://discord.com/channels/799027565465305088/799027565993394219) [![Twitter](https://img.shields.io/twitter/follow/cjvandyk?style=social)](https://twitter.com/intent/follow?screen_name=cjvandyk)

The following is the dependency tree for this solution:

Extensions
-> Azure
-> Core
-> Graph
-> Identity
-> Constants
-> List
-> Logit
-> String
-> Telemetry
-> State

Build sequence:

Constants -> String -> List -> State -> Logit -> Telemetry -> Identity -> Graph -> Core -> Azure

![Visitor Count](https://profile-counter.glitch.me/{cjvandyk}/count.svg)
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>6.11.806</VersionPrefix>
<VersionPrefix>6.12.800</VersionPrefix>
<LangVersion>latest</LangVersion>
<Company>Cornelius J. van Dyk</Company>
<Copyright>Copyright © 2009-2024</Copyright>
Expand Down
8 changes: 0 additions & 8 deletions Extensions.Constants/VersionHistory.md

This file was deleted.

32 changes: 0 additions & 32 deletions Extensions.Core/VersionHistory.md

This file was deleted.

19 changes: 0 additions & 19 deletions Extensions.Graph/VersionHistory.md

This file was deleted.

Loading

0 comments on commit 01e9524

Please sign in to comment.