79284870

Date: 2024-12-16 13:54:07
Score: 3.5
Natty:
Report link

SharePoint Subscription Edition seems to be supporting .Net Framework 4.8.

Based on this article, Beginning with .NET 4.5, System.Security.Claims classes should be used instead of those in the System.IdentityModel.Claims namespace. Probably at some point, Microsoft removed the backwards compatibility.

Check these images for how this change has been done: Identity Model Claims, New Claim Class - based on this, adjust your code.

"ICliamsIdentity extends this interface to access to claims collection. Windows Identity Foundation represents a claim within the Claim class."

In my case all I need to change was:

using Microsoft.IdentityModel.Claims; to using System.Security.Claims;

((IClaimsIdentity) CurrentPrincipal.Identity) to (CurrentPrincipal.Identity as ClaimsIdentity)

IClaimsIdentity ClaimsIdentity references become ClaimsIdentity ClaimsIdentity

Please pay attention to the class differences - some properties have changed: e.g. claim.ClaimType becomes claim.Type (claim is an iteration variable from foreach (Claim claim in ClaimsIdentity.Claims)

Please let me know if this works for you or if I should add more details.

Reasons:
  • Blacklisted phrase (1): this article
  • Blacklisted phrase (0.5): I need
  • RegEx Blacklisted phrase (2.5): Please let me know
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Andrei Nechita