Skip to content
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

Microsoft.Graph 5.34.0 The Parsable does not contain a collection property (Places.GraphRoomList.GetAsync) #2223

Closed
ashleywb opened this issue Nov 18, 2023 · 2 comments

Comments

@ashleywb
Copy link

ashleywb commented Nov 18, 2023

Describe the bug
I get the following error when trying to get a list of rooms using the following with a pageIterator
https://learn.microsoft.com/en-us/graph/api/place-list?view=graph-rest-1.0&tabs=csharp#request-1

The Parsable does not contain a collection property System.ArgumentException The Parsable does not contain a collection property at Microsoft.Graph.PageIterator2.ExtractEntityListFromParsable(TCollectionPage parsableCollection)
at Microsoft.Graph.PageIterator2.CreatePageIterator(IRequestAdapter requestAdapter, TCollectionPage page, Func2 callback, Func2 requestConfigurator, Dictionary2 errorMapping)`

To Reproduce
Steps to reproduce the behavior:
Running the following gives me the above error
var roomListCollectionResponse = await graphClient.Places.GraphRoomList.GetAsync(); var pageIterator = PageIterator<Room, RoomListCollectionResponse>.CreatePageIterator(Application.Client, roomListCollectionResponse, room => { return true; }); await pageIterator.IterateAsync();

Expected behavior
I should not encounter the error and a list of rooms should be returned. I can see in the initial response (roomListCollectionResponse) contains two rooms

Additional context
I'm currently using Microsoft.Graph 5.34.0

@andrueastman
Copy link
Member

andrueastman commented Nov 20, 2023

Thanks for raising this @ashleywb

As calling await graphClient.Places.GraphRoomList.GetAsync(); will return a collection of RoomList and not Room any chance your issue is resolved if you initialize the pageIterator as below with the right entity type?

var pageIterator = PageIterator<RoomList, RoomListCollectionResponse>.CreatePageIterator(graphClient, roomListCollectionResponse, room => { return true; });

@ashleywb
Copy link
Author

Thanks for raising this @ashleywb

As calling await graphClient.Places.GraphRoomList.GetAsync(); will return a collection of RoomList and not Room any chance your issue is resolved if you initialize the pageIterator as below with the right entity type?

var pageIterator = PageIterator<RoomList, RoomListCollectionResponse>.CreatePageIterator(graphClient, roomListCollectionResponse, room => { return true; });

This looks to have resolved my issue, many thanks. Can#t believe I didn't spot/try this. Thanks again

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

No branches or pull requests

2 participants