Skip to content

Refactor GetCopilotAgent to streamline agent retrieval and improve query execution #4877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

gautamdsheth
Copy link
Collaborator

@gautamdsheth gautamdsheth commented Apr 24, 2025

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #4798

What is in this Pull Request ?

Adding proper pagination for the cmdlet

@gautamdsheth gautamdsheth requested a review from Copilot April 24, 2025 19:40
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors GetCopilotAgent to improve agent retrieval by implementing proper pagination and more robust query execution. Key changes include:

  • Updating the list query to use the DocumentLibrary enum rather than a magic number.
  • Replacing ExecuteQuery with ExecuteQueryRetry for improved reliability.
  • Refactoring the GetAgents method to internally manage pagination and directly process query batches.
Comments suppressed due to low confidence (1)

src/Commands/Copilot/GetCopilotAgent.cs:50

  • [nitpick] The method name 'GetAgents' might be misleading as it not only retrieves but also writes out agent data with pagination. Consider renaming it to more clearly indicate its side effects, for example, 'WriteAgentsWithPagination'.
private void GetAgents(List list)

@gautamdsheth gautamdsheth merged commit 8423287 into pnp:dev Apr 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Get-PnPCopilotAgent - The attempted operation is prohibited because it exceeds the list view threshold
1 participant