You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/upgrade-to-v4.md
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,63 @@ var device = await graphClient.DeviceManagement.ManagedDevices["1"].Request().Ge
126
126
Assert.Equal("1",device.Id);
127
127
```
128
128
129
+
### Collection responses do not have @odata.nextLink in the AdditionalData
130
+
131
+
Response for collection types are now deserialized into the NextLink property in the collection response object(example [here](https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/23e9386538993ebe08ba88c084831b6163304e27/src/Microsoft.Graph/Generated/requests/AccessPackageAssignmentFilterByCurrentUserCollectionResponse.cs#L31)) and are not available in the additionalData bag. The property is then used to automatically initialize the nextPage request for the collection page and can be accessed as below.
It is recommended to use the PageIterator when paging through collections as this allows for advance functionality such as configuring pausing, managing state and access to the DeltaLink and NextLink if needed. An example of using the PageIterator with delta is shown below.
140
+
141
+
```cs
142
+
intcount=0;
143
+
intpauseAfter=25;
144
+
145
+
varmessages=awaitgraphClient.Me.Messages
146
+
.Request()
147
+
.Select(e=>new {
148
+
e.Sender,
149
+
e.Subject
150
+
})
151
+
.Top(10)
152
+
.GetAsync();
153
+
154
+
varpageIterator=PageIterator<Message>
155
+
.CreatePageIterator(
156
+
graphClient,
157
+
messages,
158
+
(m) =>
159
+
{
160
+
Console.WriteLine(m.Subject);
161
+
count++;
162
+
// If we've iterated over the limit,
163
+
// stop the iteration by returning false
164
+
returncount<pauseAfter;
165
+
}
166
+
);
167
+
168
+
awaitpageIterator.IterateAsync();
169
+
170
+
while (pageIterator.State!=PagingState.Complete)
171
+
{
172
+
if (pageIterator.State==PagingState.Delta)
173
+
{
174
+
stringdeltaLink=pageIterator.Deltalink;
175
+
Console.WriteLine($"Paged through results and found deltaLink : {deltaLink}");
176
+
}
177
+
178
+
Console.WriteLine("Iteration paused for 5 seconds...");
0 commit comments