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

CalendarView.Delta - Error Parsing OData Select and Expand failed: Value cannot be null. (Parameter 'initialState') #2678

Closed
adryone opened this issue Sep 23, 2024 · 6 comments
Labels

Comments

@adryone
Copy link

adryone commented Sep 23, 2024

Describe the bug

In the below code lines:

        string expand = "SingleValueExtendedProperties($filter=Id eq 'String {f0b37059-bb45-47a2-b119-44ecdf894aed} Name NumeroPratica')";

            var calendarView = await _graphClient.Me.Calendars[calendarId].CalendarView
            .Delta
            .GetAsDeltaGetResponseAsync(rq =>
            {
                rq.QueryParameters.StartDateTime = startDate.UtcStringFromTimeZone(TIME_ZONE);
                rq.QueryParameters.EndDateTime = endDate.UtcStringFromTimeZone(TIME_ZONE);
                rq.QueryParameters.Expand = new string[] { expand };
                rq.Headers.Add("Prefer", $"outlook.timezone=\"{TIME_ZONE}\"");
                rq.QueryParameters.Select = EVENT_FIELDS;
            });

the .Expand setting produces the error
"Parsing OData Select and Expand failed: Value cannot be null. (Parameter 'initialState')"

Omitting the .Expand setting, there is no error.

The same .Expand setting is used in normal (no Delta) .CalendarView.GetAsync() request without error.

Expected behavior

Correct response (no exception).

How to reproduce

string expand = "SingleValueExtendedProperties($filter=Id eq 'String {f0b37059-bb45-47a2-b119-44ecdf894aed} Name NumeroPratica')";

            var calendarView = await _graphClient.Me.Calendars[calendarId].CalendarView
            .Delta
            .GetAsDeltaGetResponseAsync(rq =>
            {
                rq.QueryParameters.StartDateTime = startDate.UtcStringFromTimeZone(TIME_ZONE);
                rq.QueryParameters.EndDateTime = endDate.UtcStringFromTimeZone(TIME_ZONE);
                rq.QueryParameters.Expand = new string[] { expand };
                rq.Headers.Add("Prefer", $"outlook.timezone=\"{TIME_ZONE}\"");
                rq.QueryParameters.Select = EVENT_FIELDS;
            });

SDK Version

5.56.1

Latest version known to work for scenario above?

No response

Known Workarounds

No wotkaround

Debug output

image

Configuration

OS: windows 11 pro, x64

Other information

No response

@adryone adryone added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 23, 2024
@andrueastman
Copy link
Member

Thanks for raising this @adryone

According to the API documentation at the link below, it looks like passing $select is not supported in this endpoint. Any chance you are able to get a successful response if you don't pass a select parameter?

https://learn.microsoft.com/en-us/graph/delta-query-events?tabs=http#use-query-parameters-in-a-delta-query-for-calendar-view

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Sep 25, 2024
@adryone
Copy link
Author

adryone commented Sep 25, 2024

Hi andrueastman,
thanks for your reply.

First of all a precisation: the error I receive is for the Expand parameter, not for the Select; I use the Select without problem (the fields returned are corresponding to my Select value).

I'm confused searching further documentation on this question.

At the link https://learn.microsoft.com/en-us/graph/api/event-delta?view=graph-rest-1.0&tabs=http#odata-query-parameters (dated on 10/27/2023) it seems you'll right.
But at the link https://learn.microsoft.com/en-us/graph/delta-query-overview#optional-query-parameters (dated on 01/12/2024) it seems that the Expand parameter is NOT possible ONLY for USER and GROUP resource; the explanation of this limitation is here https://learn.microsoft.com/en-us/graph/delta-query-overview#limitations.

Thanks

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Sep 25, 2024
@adryone
Copy link
Author

adryone commented Sep 25, 2024

Hi andrueastman,

starting from the issue at OData/odata.net#1162,
I've found the following pull request OData/odata.net#2701.

I don't understand if this pr will be never solved; can you help me? is there a possible solution for my issue?

Thanks

@andrueastman
Copy link
Member

At the link https://learn.microsoft.com/en-us/graph/api/event-delta?view=graph-rest-1.0&tabs=http#odata-query-parameters (dated on 10/27/2023) it seems you'll right.

As we are making the request to the calendar API, I believe we should rely on this documentation as the other document only addresses limitation in the groups/users api.

Any chance you can also post the question at the link below? As this repo is mainly intended for SDK related issues, we may not know if this is really supported and the API owners should be able to give clarity here.

https://aka.ms/askGraph

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Sep 26, 2024
@adryone
Copy link
Author

adryone commented Sep 27, 2024

Hi andrueastman,

yes, I switch to the link you suggested.

Thanks

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Sep 27, 2024
@andrueastman
Copy link
Member

Thanks for this. We'll close this for now and re-open incase for anything SDK related. Feel free to create a new issue incase of anything.

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

No branches or pull requests

2 participants