microsoftgraph / microsoftgraph/msgraph-sdk-powershell

Implementation of the paging is incorrect

Aperta
#2,869 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Status: Needs Investigation
Lingua principale
C#
Stelle
898
Fork
230
Merge medio
2g 5h
PR unite (30g)
31

Descrizione

Describe the bug

When used together, -Top and -PageSize return incorrect number of items when $topValue cannot be divided by $PageSizeValue without a remainder.

# it returns 4 items, although 3 items are requested; `4 items = 2 pages X 2 items` instead of `3 items = (1 page X 2 items) + 1 item`
PS> get-mguser -top 3 -PageSize 2

DisplayName        Id                                  
-----------        --                                  
Abby Brown2        7d1a89a8-0029-4e19-a256-cac05295a1
Adele Mance        ac4de573-e369-4dcb-bbd2-170c4a0b66
Adele Vance        7ff931dc-2ecf-4e51-8e0b-04e7aaf347
Aleksandar Nikolic cc6166e6-acf1-419b-b06d-f44abb945b

# returns 9 items although 7 items are requested; `9 items = 3 pages X 3 items` instead of `7 items = (2 pages X 3 items) + 1 item`
PS> get-mguser -top 7 -PageSize 3

DisplayName        Id                                  
-----------        --                                  
Abby Brown2        7d1a89a8-0029-4e19-a256-cac05295a1
Adele Mance        ac4de573-e369-4dcb-bbd2-170c4a0b66
Adele Vance        7ff931dc-2ecf-4e51-8e0b-04e7aaf347
Aleksandar Nikolic cc6166e6-acf1-419b-b06d-f44abb945b
Aleksandar Nikolic 177fdb14-fa62-4d84-a8fb-bd635c3981
Alex Wilber        3626d3fe-5bf7-4f85-9e40-9fd5a22663
Bob Brown          78b8ffac-8bea-44a0-961a-62870b2c87
Diego Siciliani    4b1fda38-cc2e-42e9-afd1-18f1d18874
Grady Archie       ae0342e9-5cf9-416e-9fb7-154ec6eb27
Expected behavior

It's expected to get the number of items specified with the -Top parameter.

How to reproduce
# it returns 4 items, although 3 items are requested
PS> get-mguser -top 3 -PageSize 2

# returns 9 items although 7 items are requested
PS> get-mguser -top 7 -PageSize 3
SDK Version

2.20.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema con Get-MgUser usando -Top 3 -PageSize 2 e -Top 7 -PageSize 3, quindi traccia il comportamento di paginazione dell'SDK per questi parametri. Il lavoro è completato quando ogni comando restituisce esattamente il numero di elementi richiesto da -Top, anche quando i valori non sono divisibili in modo uniforme.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell
Ambito
api
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.