Title: Sometimes missing single or multiple Contacts when fetching a Folder of Contacts · Issue #2678 · microsoftgraph/msgraph-sdk-java · GitHub
Open Graph Title: Sometimes missing single or multiple Contacts when fetching a Folder of Contacts · Issue #2678 · microsoftgraph/msgraph-sdk-java
X Title: Sometimes missing single or multiple Contacts when fetching a Folder of Contacts · Issue #2678 · microsoftgraph/msgraph-sdk-java
Description: I have written a Module, that should import the Exchange Contacts from Office365 directly in the PBX's addressbook. This has been working for a long time. But from time to time i get a report about a missing contact, that exists in the O...
Open Graph Description: I have written a Module, that should import the Exchange Contacts from Office365 directly in the PBX's addressbook. This has been working for a long time. But from time to time i get a report about...
X Description: I have written a Module, that should import the Exchange Contacts from Office365 directly in the PBX's addressbook. This has been working for a long time. But from time to time i get a report a...
Mail addresses
email@example.com
e.mail@example.com
Opengraph URL: https://github.com/microsoftgraph/msgraph-sdk-java/issues/2678
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sometimes missing single or multiple Contacts when fetching a Folder of Contacts","articleBody":"I have written a Module, that should import the Exchange Contacts from Office365 directly in the PBX's addressbook.\n\nThis has been working for a long time.\nBut from time to time i get a report about a missing contact, that exists in the Office365 Contact folder.\n\nWhat i do exactly:\n\nI use the MS Graph to fetch the Contacts, and dump them into a .csv file, before importing it into the pbx.\nThose missing contacts don't show in the .CSV dump, which means that the contacts wasn't fetched or wasn't written due to some odd reason. \n\nBut if i check the Office365, the contact is there.\n\n- If i trigger the script to fetch all contacts again, the contact still doesn't show up in my csv\n- If i copy the original, missing contact, and trigger the script, the copy shows up in the .csv if i delete the copy the original still won't show up in the .csv if i trigger it again.\n- If i update the existing contact by for example adding \"Test\" to their name, and save, and trigger the script, the contact shows up in the .csv\n\nI use the following code to fetch the contacts:\n\n```\nO365Provider O365P = new O365Provider(TenantID, ClientID, ClientSecret, Scopes, log); //Wrapper for the GraphServiceClient with my custom logger\nGraphServiceClient GSC = O365P.getGSC();\n\nUser U = GSC.users().byUserId(UserIDorUPN).get();\n\nInteger Amount = GSC.users().byUserId(U.getId()).contacts().count().get();\nlog.debug(\"Amount in Folder: \" + Amount);\n\nList\u003cContact> Contacts = new ArrayList\u003cContact>();\n\nContactCollectionResponse Request= GSC.users().byUserId(U.getId()).contacts().get(requestConfiguration -> {\nrequestConfiguration.queryParameters.top = 100; //Pagination of 100\n});\n\n// This Code is based on the MS example: https://learn.microsoft.com/en-us/graph/sdks/paging?tabs=java\nPageIterator\u003cContact, ContactCollectionResponse> pageIterator = new PageIterator.Builder\u003cContact, ContactCollectionResponse>()\n\t\t\t\t\t\t.client(GSC)\n\t\t\t\t\t\t.collectionPage(Request)\n\t\t\t\t\t\t.collectionPageFactory(ContactCollectionResponse::createFromDiscriminatorValue)\n\t\t\t\t\t\t.requestConfigurator( requestInfo -> {\n\t\t\t\t\t\t\trequestInfo.addQueryParameter(\"%24top\", 100);\n\t\t\t\t\t\t\treturn requestInfo;\n\t\t\t\t\t\t})\n\t\t\t\t .processPageItemCallback( contact -> {\n\t\t\t\t \tContacts.add(contact);\n\t\t\t\t return true;\n\t\t\t\t }).build();\n\t\t\t\tpageIterator.iterate();\nlog.debug(\"Fetched: \" + Contacts.size() +\" Contacts\");\n```\n\nNow the thing is, most of the time these contacts aren't new, most of them have been existing for a while in the office365 contacts, or even have been migrated there from old exchange servers. In one case i had a newly created contact show the exact issue for a customer.\n\nI cannot pinpoint the source of this issue.\nI might have tought the pagination might be wrong, but i created a Test folder with 2'133 Contacts, and all of them have been dumped to the .csv successfully using this code.\n\n> [2026-10-09T13:43:57,859] [DEBUG] [] [] [O365 Connector MSGraph] Scopes: [https://graph.microsoft.com/.default] \n> [2026-10-09T13:43:57,859] [DEBUG] [] [] [O365 Connector MSGraph] Setting Up Provider... \n> [2026-10-09T13:43:57,859] [DEBUG] [] [] [O365 Connector MSGraph] Looking for: [email@example.com]\n> [2026-10-09T13:43:58,098] [DEBUG] [] [] [O365 Connector MSGraph] [e.mail@example.com] found! \n> [2026-10-09T13:43:58,189] [DEBUG] [] [] [O365 Connector MSGraph] Amount in Folder: 2133 \n> [2026-10-09T13:43:59,791] [DEBUG] [] [] [O365 Connector MSGraph] Fetched: 2133 Contacts \n> [2026-10-09T13:43:59,838] [DEBUG] [] [] [O365 Connector MSGraph] Writing: 2133 Contacts to File: [/path/to/csv.csv] \n> [2026-10-09T13:43:59,838] [DEBUG] [] [] [O365 Connector MSGraph] Writing Header \n> [2026-10-09T13:43:59,858] [DEBUG] [] [] [O365 Connector MSGraph] Done Writing \n\nI'm at a loss how to go about this, and can't find anything useful about this isuse.\n\nAny ideas how to go about this?\n\n//edit: I think it's actually close or the same issue as this: https://stackoverflow.com/questions/70374893/loading-all-contacts-using-the-microsoft-graph-api-sometimes-looses-skips-pages\n\nSincerely\nFabian95qw","author":{"url":"https://github.com/Fabian95qw","@type":"Person","name":"Fabian95qw"},"datePublished":"2026-10-09T11:49:59Z","url":"https://github.com/microsoftgraph/msgraph-sdk-java/issues/2678"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d406af25-7b3a-e16c-da22-161a91b042a7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D5B2:2511F8:A9E3D:E8924:6AF6BACD |
| html-safe-nonce | 9ee48117d0521590e5c427ae5e9ff59accc328ead5c368d35d5f49218b84da3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUIyOjI1MTFGODpBOUUzRDpFODkyNDo2QUY2QkFDRCIsInZpc2l0b3JfaWQiOiIzMzgzOTU2NTE3OTgxMjExNjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2865833ee36bbd4b7627318d61d815447727ffb392628c956ed43e34091addc8 |
| hovercard-subject-tag | issue:5777609419 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoftgraph/msgraph-sdk-java/2678/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fc430990ca4e9f23010d987b38ac0a04a89f71fdf1be11fbbf77f14265980b94/microsoftgraph/msgraph-sdk-java/issues/2678 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fc430990ca4e9f23010d987b38ac0a04a89f71fdf1be11fbbf77f14265980b94/microsoftgraph/msgraph-sdk-java/issues/2678 |
| og:image:alt | I have written a Module, that should import the Exchange Contacts from Office365 directly in the PBX's addressbook. This has been working for a long time. But from time to time i get a report about... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Fabian95qw |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8dfae1499400ee498ab0f86538d1c034e6c1b4f51c63ecade775c3b0894e3379 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoftgraph/msgraph-sdk-java git https://github.com/microsoftgraph/msgraph-sdk-java.git |
| octolytics-dimension-user_id | 17304259 |
| octolytics-dimension-user_login | microsoftgraph |
| octolytics-dimension-repository_id | 103300409 |
| octolytics-dimension-repository_nwo | microsoftgraph/msgraph-sdk-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 103300409 |
| octolytics-dimension-repository_network_root_nwo | microsoftgraph/msgraph-sdk-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ee168845eb2be91203b179104ac9977fe4ea69a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width