Yvand / EntraCP

EntraCP (formerly AzureCP) is a claims provider that connects SharePoint to your Microsoft Entra ID tenant, in federated authentication
https://entracp.yvand.net/
Apache License 2.0
38 stars 8 forks source link

Sharepoint 2019 peoplepicker doesnt return azure AD users #139

Closed saep202009 closed 2 years ago

saep202009 commented 2 years ago

Hi we have some problem in our SharePoint (SP) 2019 project. When we trying to search people (azure AD users) in peoplepicker we return nothing in UI but we return following error in ULS log:

01/06/2022 15:12:36.09 w3wp.exe (0x3D90) 0x32F8 AzureCP Claims Picking 1337 Unexpected [AzureCP] Unexpected error occurred in FillSearch: System.ArgumentNullException: Value cannot be null. Parameter name: source, Callstack: at System.Linq.Enumerable.Contains[TSource](IEnumerable1 source, TSource value, IEqualityComparer1 comparer) at System.Collections.Generic.List1.FindAll(Predicate1 match) at azurecp.OperationContext.InitializeSearch(List`1 processedClaimTypeConfigList, Boolean exactSearch) at azurecp.AzureCP.FillSearch(Uri context, String[] entityTypes, String searchPattern, String hierarchyNodeID, Int32 maxCount, SPProviderHierarchyTree searchTree) 8d1e14a0-0847-b0e6-edce-cd6e1d2e7ade

We have instaled on SP lastest AzureCP solution (version 19.0.20210211.1285 )Could you somebody help us please? Thanks a lot. Michal

Yvand commented 2 years ago

hi @saep202009, this is very unexpected. Where do you get this error. Do you repro it whatever you type in the people picker? Can you check if you can reproduce the issue using this script:

Add-Type -AssemblyName "Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
Add-Type -AssemblyName "AzureCP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=65dc6b5903b51636"
# Set those 2 parameters based on your environment
$context = New-Object Uri ("http://spsites/")
$inputValue = "user"

[Microsoft.SharePoint.WebControls.PickerEntity []] $entities = $null
$claimsProvider = New-Object -TypeName azurecp.AzureCP ("AzureCP")
$entityTypes = @("User", "FormsRole")

Write-Host "Testing search with input '$inputValue'"
$entitiesList = New-Object -TypeName 'System.Collections.Generic.List[Microsoft.SharePoint.WebControls.PickerEntity]'
$result = $claimsProvider.Search($context, $entityTypes, $inputValue, $null, 30);
$entitiesList.AddRange($result.EntityData)
foreach ($children in $result.Children) {
    $entitiesList.AddRange($children.EntityData)
}
$entities = $entitiesList.ToArray()
Write-Host "Found $($entities.Count) entities:"
foreach ($entity in $entities) {
    Write-Host "Entity key: '$($entity.Key)', value '$($entity.DisplayText)'"
}
saep202009 commented 2 years ago

Hi Yvand i tried to run your script and result is 0 image

Yvand commented 2 years ago

@saep202009 can you check if it reproduced the error in the SharePoint logs ?

saep202009 commented 2 years ago

Yvand i try to get more details for you, this bug is in our SP UI when we trying to delegate task for approving document. this is not exactly SP picker see picture, we try to investigate in our custom code next. image

saep202009 commented 2 years ago

@saep202009 can you check if it reproduced the error in the SharePoint logs ?

no any errors in log after running your script

Yvand commented 2 years ago

how exactly do you reproduce the error then? Is it from central admin site only?

saep202009 commented 2 years ago

not from central admin site, its in portal site with url like https://ourservername.com/SitePages/Moje%20ke%20schválení.aspx (see picture above)

ondrejtucny commented 2 years ago

Let me clarify: The error happens when using the Office UI Fabric people picker component in a custom app part. Repro using your script from PowerShell. The original exception posted was located in ULS logs. That's why it seems as an AzureCP bug to us.

Yvand commented 2 years ago

@ondrejtucny yes it seems to be a bug in AzureCP, especially if you repro with the PowerShell script. Do you repro it all the time, regardless of the input? I think the FillSearch method is rarely used in latest versions of SharePoint, I'll test the method on my side soon (hoipefully tomorrow) and I'll let you know if I can repro.

Yvand commented 2 years ago

@saep202009 the exception occurs probably because there is something wrong/unexpected in your claim types list. Can you go to central admin > Security > AzureCP Claim types configuration and send me a screenshot of this page?

saep202009 commented 2 years ago

@Yvand here is screenshot of your requested page image

Yvand commented 2 years ago

The claim types configuration is the default one and is totally fine. I must be missing something but I'm not sure what. Do you have custom alternate access mappings with different private/external urls

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.