I have the following code which successfully processes the 196 first site pages before panicing:
func (c *Client) GetSitePage(ctx context.Context, siteID string, id string) (*models.SitePage, error) {
idFilter := fmt.Sprintf("id eq '%s'", id)
pages, err := c.client.Sites().BySiteId(siteID).Pages().GraphSitePage().Get(ctx, &sites.ItemPagesGraphSitePageRequestBuilderGetRequestConfiguration{
QueryParameters: &sites.ItemPagesGraphSitePageRequestBuilderGetQueryParameters{
Filter: &idFilter,
},
})
if err != nil {
return nil, err
}
pageIterator, err := msgraphcore.NewPageIterator[*models.SitePage](pages, c.client.GetAdapter(), models.CreateListItemCollectionResponseFromDiscriminatorValue)
if err != nil {
return nil, err
}
var page *models.SitePage
err = pageIterator.Iterate(ctx, func(sitePage *models.SitePage) bool { // <-- panic on this row
page = sitePage
return false
})
return page, err
}
On 197 and all(?) subsequent IDs, it panics:
panic: interface conversion: interface {} is *models.ListItem, not *models.SitePage
goroutine 71 [running]:
github.com/microsoftgraph/msgraph-sdk-go-core.convertToPage[...]({0x2751b80, 0xc000abb6c0})
github.com/microsoftgraph/msgraph-sdk-go-core@v1.0.1/page_iterator.go:228 +0x529
github.com/microsoftgraph/msgraph-sdk-go-core.(*PageIterator[...]).next(0x2fbf040?, {0x2fb41c8, 0xc00019a6e0?})
github.com/microsoftgraph/msgraph-sdk-go-core@v1.0.1/page_iterator.go:136 +0x91
github.com/microsoftgraph/msgraph-sdk-go-core.(*PageIterator[...]).Iterate(0x2fbf040, {0x2fb41c8, 0xc00019a6e0}, 0xc00019a4b0)
github.com/microsoftgraph/msgraph-sdk-go-core@v1.0.1/page_iterator.go:96 +0xc8
xxx.(*Client).GetSitePage(0xc000598d80, {0x2fb41c8, 0xc00019a6e0}, {0xc00005ea80, 0x24}, {0xc00089ce10, 0x24})
mycode.go:181 +0x728
There does not appear to be anything particular about the triggering site page:
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#sites('root')/pages/$entity",
"@odata.type": "#microsoft.graph.sitePage",
"@odata.etag": "\"{UUID},23\"",
"createdDateTime": "2023-02-02T14:56:01Z",
"eTag": "\"{UUID},23\"",
"id": "uuid",
"lastModifiedDateTime": "2023-03-02T10:19:59Z",
"name": "Mypage.aspx",
"webUrl": "https://zesite.sharepoint.com/SitePages/Mypage.aspx",
"title": "Samtal",
"pageLayout": "article",
"thumbnailWebUrl": "https://zesite.sharepoint.com/_layouts/15/getpreview.ashx?path=mypage.jpg",
"promotionKind": "page",
...
}
Issue arises on latest release v0.92.0.
Can someone help me make sense of this?
I have the following code which successfully processes the 196 first site pages before panicing:
On 197 and all(?) subsequent IDs, it panics:
There does not appear to be anything particular about the triggering site page:
Issue arises on latest release v0.92.0.
Can someone help me make sense of this?