Skip to content

[BUG] Get-PnPUser -WithRightsAssignedDetailed - The property or field 'Email' has not been initialized #5477

Open

Description

@dbahnms

Issue

Expected behavior

List of all users with rights assigned

Actual behavior

Error message:
Get-PnPUser: The property or field 'Email' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

Steps to reproduce behavior

$global:con = Connect-PnPOnline -Url $BaseUrl -CertificateBase64Encoded $global:base64 -CertificatePassword $global:certpass -ClientId $global:clientId -Tenant $aadDomain -TenantAdminUrl $spTenantAdminUrl -ReturnConnection -ErrorAction Stop
$users = Get-PnPUser -WithRightsAssignedDetailed -Connection $con

Get-PnPException:
Message : The property or field 'Email' has not been initialized. It has not been requested or the request has not been executed. It may need to be
explicitly requested.
Stacktrace : at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line
104
at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line 165
at System.Management.Automation.CommandProcessor.ProcessRecord()
ScriptLineNumber : 1

This is likely due to data from outdated objects, as the error does not occur on all pages. However, in this case, the module should continue to operate stably and simply ignore the faulty entries instead of failing to provide any data.

What is the version of the Cmdlet module you are running?

PnP.Powershell 3.4.1 and 2.12.0

Which operating system/environment are you running PnP PowerShell on?

  • [ X] Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Activity

  1. dbahnms commented on Oct 29, 2026

    @dbahnms
    Author

    Error details from Powershell 7.6.6 Runbook

    �[33;1mVERBOSE: Enumerating through all listitems of /sites/XXX/Freigegebene Dokumente�[0m
    ===== ERROR =====

    PSMessageDetails :
    Exception : System.Exception: Error while copying content to a stream.
    TargetObject :
    CategoryInfo : NotSpecified: (:) [Get-PnPUser], Exception
    FullyQualifiedErrorId : PnP.PowerShell.Commands.Principals.GetUser
    ErrorDetails :
    InvocationInfo : System.Management.Automation.InvocationInfo
    ScriptStackTrace : at , C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\rpwkampp.fne\Temp\0ue0ydg2.eun\137214ae-6914-488d-9782-cb2aa52c55f8.ps1: line 326
    at , : line 1
    PipelineIterationInfo : {}

    ===== EXCEPTION =====

    TargetSite :
    Message : Error while copying content to a stream.
    Data : {}
    InnerException :
    HelpLink :
    Source :
    HResult : -2146233088
    StackTrace :

    ===== EXCEPTION TOSTRING =====
    System.Exception: Error while copying content to a stream.
    ===== SCRIPT STACK =====
    at , C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\rpwkampp.fne\Temp\0ue0ydg2.eun\137214ae-6914-488d-9782-cb2aa52c55f8.ps1: line 326
    at , : line 1
    ===== ERROR VARIABLE =====

    ErrorRecord : Error while copying content to a stream.
    WasThrownFromThrowStatement : False
    TargetSite : Void CheckActionPreference(System.Management.Automation.Language.FunctionContext, System.Exception)
    Message : The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Error while copying content to a stream.
    Data : {[System.Management.Automation.Interpreter.InterpretedFrameInfo, System.Management.Automation.Interpreter.InterpretedFrameInfo[]]}
    InnerException :
    HelpLink :
    Source : System.Management.Automation
    HResult : -2146233087
    StackTrace : at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

  2. reshmee011 commented on Oct 29, 2026

    @reshmee011
    Collaborator

    @dbahnms : Thanks for reporting the issue, does get-pnpuser works successfully? I wonder if it's an issue with orphaned users.

  3. dbahnms commented on Oct 29, 2026

    @dbahnms
    Author

    Get-PnPUser without WithRightsAssignedDetailed parameter works fine. Errors occure only with a big amount of data.

  4. reshmee011 commented on Oct 29, 2026

    @reshmee011
    Collaborator

    I will try to replicate the issue on a large library. Do you reckon some users in the site are inactive?

  5. reshmee011 commented on Oct 29, 2026

    @reshmee011
    Collaborator

    How many items do you have in the site you are testing? I have tried against a big site, have not got any results despite waiting for several hours.

  6. dbahnms commented on Nov 2, 2026

    @dbahnms
    Author

    Sorry for delay, currently I see 52 sitecollections with these errors.
    I checked 2 sites (examples):
    The errors occur on sites with inactive users as well as on sites without inactive users.
    Number of files: ~50.000 and ~150.000 in one library

  7. reshmee011 commented on Nov 2, 2026

    @reshmee011
    Collaborator

    Thanks for coming back, the cmdlet worked for me on a large site returning around 900 users after 2-3 hours. Does the cmdlet consistently fail on those 52 site collections?

  8. dbahnms commented on Nov 9, 2026

    @dbahnms
    Author

    Before I added PnP-TraceLog command, the cmdlet consistently failed. After adding the PnP-TraceLog cmdlet sometimes it works. Can´t explain that. I already assumed that Azure runbooks encounters a timeout. I am still collecting logs, but I will get back to you shortly.

  9. dbahnms commented on Nov 10, 2026

    @dbahnms
    Author

    error message (in my case after 4 hours of running cmtlet Get-PnPUser)

    ===== ERROR =====

    PSMessageDetails :
    Exception : System.Management.Automation.PSInvalidOperationException: An error occurred while sending the request.
    ---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
    ---> System.Net.Http.HttpIOException: The response ended prematurely. (ResponseEnded)
    at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    --- End of inner exception stack trace ---
    at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
    at PnP.Framework.Http.RetryHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
    at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
    at PnP.Framework.Http.HttpClientSPWebRequestExecutor.ExecuteImplementation()
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
    at Microsoft.SharePoint.Client.ClientObjectExtensions.EnsurePropertyImplementation[T,TResult](T clientObject, Expression1 propertySelector) at Microsoft.SharePoint.Client.ClientObjectExtensions.EnsureProperty[T,TResult](T clientObject, Expression1 propertySelector)
    at PnP.PowerShell.Commands.Principals.GetUser.ExecuteCmdlet() in D:\a\powershell\powershell\src\Commands\Principals\GetUser.cs:line 45
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 55
    --- End of inner exception stack trace ---
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 104
    at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line 165
    at System.Management.Automation.CommandProcessor.ProcessRecord()
    TargetObject :
    CategoryInfo : InvalidOperation: (:) [Get-PnPUser], PSInvalidOperationException
    FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Principals.GetUser
    ErrorDetails :
    InvocationInfo : System.Management.Automation.InvocationInfo
    ScriptStackTrace : at , C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\4txa5mjf.kqc\Temp\xidyfmul.epd\9d61ab3a-6ec5-49e7-ac89-ebf5e3addbb4.ps1: line 335
    at , : line 1
    PipelineIterationInfo : {}

    ===== PNP Tracelog (last lines) =====

    pwsh Information: 0 : 2026-11-09 20:22:07.5781 [Get-PnPUser] [13] [Debug] Enumerating though listitems 121ms 1092d6cb-c80e-4db9-b5ca-86f7691bd53c
    pwsh Information: 0 : 2026-11-09 20:22:07.6903 [Get-PnPUser] [13] [Debug] Enumerating though listitems 112ms 1092d6cb-c80e-4db9-b5ca-86f7691bd53c
    pwsh Information: 0 : 2026-11-09 20:22:07.8106 [Get-PnPUser] [13] [Debug] Enumerating though listitems 120ms 1092d6cb-c80e-4db9-b5ca-86f7691bd53c
    pwsh Information: 0 : 2026-11-09 20:22:07.9225 [Get-PnPUser] [13] [Debug] Enumerating though listitems 111ms 1092d6cb-c80e-4db9-b5ca-86f7691bd53c
    pwsh Information: 0 : 2026-11-09 20:22:08.2908 [Get-PnPUser] [13] [Debug] Enumerating though listitems 368ms 1092d6cb-c80e-4db9-b5ca-86f7691bd53c
    pwsh Information: 0 : 2026-11-09 20:22:08.3977 [Get-PnPUser] [13] [Debug] Enumerating though listitems 106ms 1092d6cb-c80e-4db9-b5ca-86f7691bd53c
    pwsh Information: 0 : 2026-11-09 20:22:08.7086 [Stop-PnPTraceLog] [13] [Debug] Cmdlet execution started for Stop-PnPTraceLog
    0ms b7c17a6a-da76-4cf6-9a5e-5512bc535162
    pwsh Information: 0 : 2026-11-09 20:22:08.7107 [Stop-PnPTraceLog] [13] [Debug] Flushing log entries 2ms b7c17a6a-da76-4cf6-9a5e-5512bc535162
    pwsh Information: 0 : 2026-11-09 20:22:08.7122 [Stop-PnPTraceLog] [13] [Debug] Stopping logging to console 1ms b7c17a6a-da76-4cf6-9a5e-5512bc535162
    pwsh Information: 0 : 2026-11-09 20:22:08.7125 [Stop-PnPTraceLog] [13] [Debug] Stopping logging to file 0ms b7c17a6a-da76-4cf6-9a5e-5512bc535162

  10. reshmee011 commented on Nov 10, 2026

    @reshmee011
    Collaborator

    @dbahnms : Thanks so much for sharing the logs, I wonder if you break the list of sites in batches and ran each batch separately to help with random errors. Let me discuss with the team whether a try -catch would suffice or add a retry mechanism.

  11. dbahnms commented on Nov 11, 2026

    @dbahnms
    Author

    Thanks for this :)

    Other error message from different sites:

    • missing file (script run duration: 11 hours)
    • The property or field 'Email' has not been initialized (script run duration: 8 hours)

    ===== ERROR =====

    PSMessageDetails :
    Exception : System.Management.Automation.PSInvalidOperationException: Das Element ist nicht vorhanden. Möglicherweise wurde es von einem anderen Benutzer gelöscht.
    ---> Microsoft.SharePoint.Client.ServerException: Das Element ist nicht vorhanden. Möglicherweise wurde es von einem anderen Benutzer gelöscht.
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
    at Microsoft.SharePoint.Client.ClientObjectExtensions.EnsurePropertyImplementation[T,TResult](T clientObject, Expression1 propertySelector) at Microsoft.SharePoint.Client.ClientObjectExtensions.EnsureProperty[T,TResult](T clientObject, Expression1 propertySelector)
    at PnP.PowerShell.Commands.Principals.GetUser.ExecuteCmdlet() in D:\a\powershell\powershell\src\Commands\Principals\GetUser.cs:line 45
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 55
    --- End of inner exception stack trace ---
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 104
    at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line 165
    at System.Management.Automation.CommandProcessor.ProcessRecord()
    TargetObject :
    CategoryInfo : InvalidOperation: (:) [Get-PnPUser], PSInvalidOperationException
    FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Principals.GetUser
    ErrorDetails :
    InvocationInfo : System.Management.Automation.InvocationInfo
    ScriptStackTrace : at , C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\z5cgwhpq.0o2\Temp\mbacjvui.ynj\bd34388e-d736-4809-b7e8-d88de9b48ded.ps1: line 335
    at , : line 1
    PipelineIterationInfo : {}

    ===== EXCEPTION =====

    ErrorRecord : Das Element ist nicht vorhanden. Möglicherweise wurde es von einem anderen Benutzer gelöscht.
    TargetSite : Void ProcessRecord()
    Message : Das Element ist nicht vorhanden. Möglicherweise wurde es von einem anderen Benutzer gelöscht.
    Data : {}
    InnerException : Microsoft.SharePoint.Client.ServerException: Das Element ist nicht vorhanden. Möglicherweise wurde es von einem anderen Benutzer gelöscht.
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
    at Microsoft.SharePoint.Client.ClientObjectExtensions.EnsurePropertyImplementation[T,TResult](T clientObject, Expression1 propertySelector) at Microsoft.SharePoint.Client.ClientObjectExtensions.EnsureProperty[T,TResult](T clientObject, Expression1 propertySelector)
    at PnP.PowerShell.Commands.Principals.GetUser.ExecuteCmdlet() in D:\a\powershell\powershell\src\Commands\Principals\GetUser.cs:line 45
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 55
    HelpLink :
    Source : PnP.PowerShell
    HResult : -2146233079
    StackTrace : at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 104
    at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line 165
    at System.Management.Automation.CommandProcessor.ProcessRecord()

    ===== SCRIPT STACK =====
    at , C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\z5cgwhpq.0o2\Temp\mbacjvui.ynj\bd34388e-d736-4809-b7e8-d88de9b48ded.ps1: line 335
    at , : line 1

    ===== PNP TRACELOG =====
    pwsh Information: 0 : 2026-11-10 18:13:22.9606 [Get-PnPUser] [13] [Debug] Enumerating though listitems 113ms 09bad5e7-6419-4fc0-b7f5-7f2728817ec6
    pwsh Information: 0 : 2026-11-10 18:13:23.0775 [Get-PnPUser] [13] [Debug] Enumerating though listitems 116ms 09bad5e7-6419-4fc0-b7f5-7f2728817ec6
    pwsh Information: 0 : 2026-11-10 18:13:23.2461 [Get-PnPUser] [13] [Debug] Enumerating though listitems 168ms 09bad5e7-6419-4fc0-b7f5-7f2728817ec6
    pwsh Information: 0 : 2026-11-10 18:13:23.3644 [Get-PnPUser] [13] [Debug] Enumerating though listitems 118ms 09bad5e7-6419-4fc0-b7f5-7f2728817ec6
    pwsh Error: 0 : 2026-11-10 18:13:23.4805 [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: Das Element ist nicht vorhanden. Möglicherweise wurde es von einem anderen Benutzer gelöscht.
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
    at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
    at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
    ServerErrorCode: -2130575338
    ServerErrorTypeName: Microsoft.SharePoint.SPException
    ServerErrorTraceCorrelationId: 708d4da2-2033-4001-0789-6b59ee0bef3f
    ServerErrorValue:
    ServerErrorDetails:
    . 0ms
    pwsh Information: 0 : 2026-11-10 18:13:23.4981 [Stop-PnPTraceLog] [13] [Debug] Cmdlet execution started for Stop-PnPTraceLog
    0ms 438792f0-0a0d-4e6e-a471-f0dbe6b6a5cf
    pwsh Information: 0 : 2026-11-10 18:13:23.4983 [Stop-PnPTraceLog] [13] [Debug] Flushing log entries 0ms 438792f0-0a0d-4e6e-a471-f0dbe6b6a5cf
    pwsh Information: 0 : 2026-11-10 18:13:23.4984 [Stop-PnPTraceLog] [13] [Debug] Stopping logging to console 0ms 438792f0-0a0d-4e6e-a471-f0dbe6b6a5cf
    pwsh Information: 0 : 2026-11-10 18:13:23.4985 [Stop-PnPTraceLog] [13] [Debug] Stopping logging to file 0ms 438792f0-0a0d-4e6e-a471-f0dbe6b6a5cf


    ===== ERROR =====

    PSMessageDetails :
    Exception : System.Management.Automation.PSInvalidOperationException: The property or field 'Email' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
    ---> Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException: The property or field 'Email' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
    at Microsoft.SharePoint.Client.ClientObject.CheckUninitializedProperty(String propName)
    at Microsoft.SharePoint.Client.User.get_Email()
    at PnP.PowerShell.Commands.Principals.GetUser.ExecuteCmdlet() in D:\a\powershell\powershell\src\Commands\Principals\GetUser.cs:line 273
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 55
    --- End of inner exception stack trace ---
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 104
    at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line 165
    at System.Management.Automation.CommandProcessor.ProcessRecord()
    TargetObject :
    CategoryInfo : InvalidOperation: (:) [Get-PnPUser], PSInvalidOperationException
    FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Principals.GetUser
    ErrorDetails :
    InvocationInfo : System.Management.Automation.InvocationInfo
    ScriptStackTrace : at , C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\mblebwdw.sof\Temp\05cem3km.vuo\bd34388e-d736-4809-b7e8-d88de9b48ded.ps1: line 335
    at , : line 1
    PipelineIterationInfo : {}

    ===== EXCEPTION =====

    ErrorRecord : The property or field 'Email' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
    TargetSite : Void ProcessRecord()
    Message : The property or field 'Email' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
    Data : {}
    InnerException : Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException: The property or field 'Email' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
    at Microsoft.SharePoint.Client.ClientObject.CheckUninitializedProperty(String propName)
    at Microsoft.SharePoint.Client.User.get_Email()
    at PnP.PowerShell.Commands.Principals.GetUser.ExecuteCmdlet() in D:\a\powershell\powershell\src\Commands\Principals\GetUser.cs:line 273
    at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 55
    HelpLink :
    Source : PnP.PowerShell
    HResult : -2146233079
    StackTrace : at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPConnectedCmdlet.cs:line 104
    at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in D:\a\powershell\powershell\src\Commands\Base\PnPSharePointCmdlet.cs:line 165
    at System.Management.Automation.CommandProcessor.ProcessRecord()

    ===== SCRIPT STACK =====
    at , C:\ProgramData\Microsoft\System Center\Orchestrator\7.2\SMA\Sandboxes\mblebwdw.sof\Temp\05cem3km.vuo\bd34388e-d736-4809-b7e8-d88de9b48ded.ps1: line 335
    at , : line 1

    ===== PNP TRACELOG =====
    pwsh Information: 0 : 2026-11-10 15:26:56.0381 [Get-PnPUser] [13] [Debug] Enumerating though listitems 114ms cb1bc085-cdf3-4313-9219-04be7bbf9a8f
    pwsh Information: 0 : 2026-11-10 15:26:56.1423 [Get-PnPUser] [13] [Debug] Enumerating though listitems 104ms cb1bc085-cdf3-4313-9219-04be7bbf9a8f
    pwsh Information: 0 : 2026-11-10 15:26:56.2568 [Get-PnPUser] [13] [Debug] Enumerating though listitems 114ms cb1bc085-cdf3-4313-9219-04be7bbf9a8f
    pwsh Information: 0 : 2026-11-10 15:26:56.3928 [Stop-PnPTraceLog] [13] [Debug] Cmdlet execution started for Stop-PnPTraceLog
    0ms 3c04e779-9353-4b4a-a5d6-d084f148ac04
    pwsh Information: 0 : 2026-11-10 15:26:56.3931 [Stop-PnPTraceLog] [13] [Debug] Flushing log entries 0ms 3c04e779-9353-4b4a-a5d6-d084f148ac04
    pwsh Information: 0 : 2026-11-10 15:26:56.3932 [Stop-PnPTraceLog] [13] [Debug] Stopping logging to console 0ms 3c04e779-9353-4b4a-a5d6-d084f148ac04
    pwsh Information: 0 : 2026-11-10 15:26:56.3932 [Stop-PnPTraceLog] [13] [Debug] Stopping logging to file 0ms 3c04e779-9353-4b4a-a5d6-d084f148ac04

  12. reshmee011 commented on Nov 13, 2026

    @reshmee011
    Collaborator

    @dbahnms : I have added a try catch while enumerating list items in the code. Not sure if it will fix the issue as it may be related to a timing out issue. The potential fix is in PR #5509. To test, you can download and extract the files from the https://github.com/reshmee011/PnPPowerShell_Build_Draft/blob/main/PnP.PowerShell.zip and import the PnP PowerShell module referencing its path.

    import-module \PnP.PowerShell\PnP.PowerShell.psd1

    Let me know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions