Skip to content

Commit

Permalink
Correct code snippets in README
Browse files Browse the repository at this point in the history
When playing around with the samples from the README page, I found some compile errors in the snippets.
 This PR fixes them
  • Loading branch information
bakito authored Jul 14, 2023
1 parent d402445 commit 1920a2d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,14 @@ import (
result, err := client.Users().Get(context.Background(), nil)
if err != nil {
fmt.Printf("Error getting users: %v\n", err)
printOdataError(err error)
printOdataError(err)
return err
}

// Use PageIterator to iterate through all users
pageIterator, err := msgraphcore.NewPageIterator(result, client.GetAdapter(), models.CreateUserCollectionResponseFromDiscriminatorValue)
pageIterator, err := msgraphcore.NewPageIterator[models.Userable](result, client.GetAdapter(), models.CreateUserCollectionResponseFromDiscriminatorValue)

err = pageIterator.Iterate(context.Background(), func(pageItem interface{}) bool {
user := pageItem.(models.Userable)
err = pageIterator.Iterate(context.Background(), func(user models.Userable) bool {
fmt.Printf("%s\n", *user.GetDisplayName())
// Return true to continue the iteration
return true
Expand Down

0 comments on commit 1920a2d

Please sign in to comment.