Sometimes missing single or multiple Contacts when fetching a Folder of Contacts
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 22/100
Rechercherichtung
Start from the reporter's snippet, which pages through contacts() with top=100 and a PageIterator whose processPageItemCallback adds each contact to a list, then compares that list with the contacts().count() value. Reproducing the bug needs a user whose contact folder misses items, so the first step is to log which contact IDs are returned on each page and find where the gap appears. Done means a reproducible case that explains the dropped contacts, or a clear finding about the paging or serialization path in the SDK.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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 Office365 Contact folder.
What i do exactly:
I use the MS Graph to fetch the Contacts, and dump them into a .csv file, before importing it into the pbx.
Those 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.
But if i check the Office365, the contact is there.
- If i trigger the script to fetch all contacts again, the contact still doesn't show up in my csv
- 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.
- 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
I use the following code to fetch the contacts:
O365Provider O365P = new O365Provider(TenantID, ClientID, ClientSecret, Scopes, log); //Wrapper for the GraphServiceClient with my custom logger
GraphServiceClient GSC = O365P.getGSC();
User U = GSC.users().byUserId(UserIDorUPN).get();
Integer Amount = GSC.users().byUserId(U.getId()).contacts().count().get();
log.debug("Amount in Folder: " + Amount);
List<Contact> Contacts = new ArrayList<Contact>();
ContactCollectionResponse Request= GSC.users().byUserId(U.getId()).contacts().get(requestConfiguration -> {
requestConfiguration.queryParameters.top = 100; //Pagination of 100
});
// This Code is based on the MS example: https://learn.microsoft.com/en-us/graph/sdks/paging?tabs=java
PageIterator<Contact, ContactCollectionResponse> pageIterator = new PageIterator.Builder<Contact, ContactCollectionResponse>()
.client(GSC)
.collectionPage(Request)
.collectionPageFactory(ContactCollectionResponse::createFromDiscriminatorValue)
.requestConfigurator( requestInfo -> {
requestInfo.addQueryParameter("%24top", 100);
return requestInfo;
})
.processPageItemCallback( contact -> {
Contacts.add(contact);
return true;
}).build();
pageIterator.iterate();
log.debug("Fetched: " + Contacts.size() +" Contacts");
Now 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.
I cannot pinpoint the source of this issue.
I 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.
[2026-10-09T13:43:57,859] [DEBUG] [] [] [O365 Connector MSGraph] Scopes: [https://graph.microsoft.com/.default]
[2026-10-09T13:43:57,859] [DEBUG] [] [] [O365 Connector MSGraph] Setting Up Provider...
[2026-10-09T13:43:57,859] [DEBUG] [] [] [O365 Connector MSGraph] Looking for: [[email protected]]
[2026-10-09T13:43:58,098] [DEBUG] [] [] [O365 Connector MSGraph] [[email protected]] found!
[2026-10-09T13:43:58,189] [DEBUG] [] [] [O365 Connector MSGraph] Amount in Folder: 2133
[2026-10-09T13:43:59,791] [DEBUG] [] [] [O365 Connector MSGraph] Fetched: 2133 Contacts
[2026-10-09T13:43:59,838] [DEBUG] [] [] [O365 Connector MSGraph] Writing: 2133 Contacts to File: [/path/to/csv.csv]
[2026-10-09T13:43:59,838] [DEBUG] [] [] [O365 Connector MSGraph] Writing Header
[2026-10-09T13:43:59,858] [DEBUG] [] [] [O365 Connector MSGraph] Done Writing
I'm at a loss how to go about this, and can't find anything useful about this isuse.
Any ideas how to go about this?
//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
Sincerely
Fabian95qw
- Vorherrschende Sprache
- Java
- Sterne
- 446
- Forks
- 154
- Ø Merge
- 10 Std. 54 Min.
- Gemergte PRs (30 T.)
- 5
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoftgraph/msgraph-sdk-java
-
status:waiting-for-triage type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
microsoftgraph/msgraph-sdk-java#2610 ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:waiting-for-triage type:bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
microsoftgraph/msgraph-sdk-java#2656 ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:waiting-for-triage type:bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
microsoftgraph/msgraph-sdk-java#2654 ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:waiting-for-triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
microsoftgraph/msgraph-sdk-java#2639 ·
Maintainer antworten meist innerhalb von 1 Tag
-
status:waiting-for-triage type:bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
microsoftgraph/msgraph-sdk-java#2589 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in microsoftgraph/msgraph-sdk-java
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
NationalSecurityAgency/ghidra#9884 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Status: Pending Review Type: Feature Request
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
OpenRefine/OpenRefine#8019 ·
Maintainer antworten meist innerhalb von 1 Tag
-
`timer` rule rejects dates the engine acceptsEvtl. vergeben @MFA-G hat das heute übernommen. Offenbug ready
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
camunda/bpmnlint-plugin-camunda-compat#281 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
status: waiting-for-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100