"Expired or Invalid pagination request. Default Expiry time is 00:30:00" Error when returning 1000 or more entries with Get-User - Exchange Online Powershell V3 with Certificate Based Authentication

Ryan Graham 15 Reputation points
2023-06-01T16:11:38.1566667+00:00

Hello,

I'm upgrading my scripts to EXO v3.1.0 due to Microsoft's depreciation of version 2.0.5 at the end of June. Now, I'm running into an error with the below command.

$UserList = Get-User -ResultSize unlimited 

When I use certificate-based authentication for Exchange Online and the Get-User command returns over 1000 users, I get the below error every time: "Expired or Invalid pagination request. Default Expiry time is 00:30:00"

TerminatingError(Invoke-WebRequest): "{"error":{"code":"BadRequest","message":"Invalid Operation","innererror":{"message":"Invalid Operation","type":"Microsoft.Exchange.Admin.OData.Core.ODataServiceException","stacktrace":" at Microsoft.Exchange.AdminApi.CommandInvocation.CommandInvocation.InvokeCommand(QueryContext queryContext, CmdletInvokeInputType cmdletInvokeInputType)\r\n at Microsoft.Exchange.Admin.OData.Core.PathSegmentToExpressionTranslator.Translate(OperationImportSegment segment)\r\n at Microsoft.Exchange.Admin.OData.Core.QueryContext.ResolveQuery(ODataContext context, Int32 level)\r\n at Microsoft.Exchange.Admin.OData.Core.Handlers.OperationHandler.Process(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)\r\n at Microsoft.Exchange.Admin.OData.Core.Handlers.RequestHandler.Process(Stream requestStream)","internalexception":{"message":"Expired or Invalid pagination request. Default Expiry time is 00:30:00","type":"System.Exception","stacktrace":""}}}}"

The newer commands, like Get-ExoMailbox, work fine regardless of the number of users/objects. Any help would be greatly appreciated.

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,568 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Shaofan Lv-MSFT 6,915 Reputation points Microsoft Vendor
    2023-06-02T08:38:24.6566667+00:00

    Hi @Ryan Graham ,

    I tried searching a lot but didn't find any official document explicitly stating if this is a limitation in V3. I've tried submitting feedback for your post below the documentation and we can see if we can get any more information there.

     https://github.com/MicrosoftDocs/office-docs-powershell/issues/10907

    Meanwhile, if you need to use "Get-user" urgently, you can uninstall the V3 module for the time being and install the old version V2.

    Best regards

    Shaofan


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.