Getting a complete list of contacts from Microsoft Graph - microsoft-graph-api

I am trying to get a complete list of contacts from the Microsoft Graph, but no matter which API I use, I only get a handful of contats.
https://graph.microsoft.com/v1.0/me/people seemingly returns the latest contacts I have been dealing with, not even people in my actual contact list.
https://graph.microsoft.com/v1.0/me/contacts returns like 10 random people from my contact list.
What I would like to accomplish is to get ALL contacts for a user, similar to how the "My People" app works in Windows 10. How, if at all, would this be accomplished?

https://graph.microsoft.com/v1.0/me/contacts returns like 10 random people from my contact list.
Like most of the Graph endpoints you need to page the data to get every item from the Contacts folder, 10 items is just the default return value but you could something like
https://graph.microsoft.com/v1.0/me/contacts?$Top=1000
To get the first 1000 and then page from there. This endpoint will just give you the contacts in the users default Contacts Folder.

Related

Retrieve contact list name and members via Graph API

I'm trying to retrieve "contact lists" (distribution lists) from a Microsoft 365 account using the Graph API and direct http calls. Right now I use this URL:
https://graph.microsoft.com/v1.0/users/{userid}/contactfolders/{folderid}/contacts?$top=500&$count=true
This does retrieve the various contacts I have, but not the names of any contact lists or their members. The "count" of items that is retrieved does include those contact lists but not their actual data.
I have tried the "people" and "groups" endpoints but those retrieve different information, not what I am looking for.
I know I can use EWS for this purpose, and I have, but I'm trying to convert my existing application to 100% Graph. I would appreciate any information, thanks.
I've sent a user voice requesting for this feature: https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/fetch-contact-group-using-graph-api/idi-p/3262621
Do support if you think there's no feature currently available in Graph API to fetch contact list!

Reading a Contact List from Office 365/Exchange using Microsoft Graph

I have read several StackOverflow questions (more than 2 years old) regarding the ability to read/write a contact list from a user's contact folder(s), and it appears that it is not supported. I believe I have confirmed this with my own testing. A response to
GET "https://graph.microsoft.com/v1.0/users/user#domain.com/contactfolders/{folderid}\contacts
will produce a list of individual contacts, but contact lists are ignored. (Interestingly, if I include the option "count=true" I will get a #odata.count value indicating the presence of my lists, but no actual data). I was hoping the beta endpoint would correct this deficiency but no joy that I can tell. Is there indeed no way to obtain or create a contact list using Graph? (I know I can do it using EWS). I have not yet tried the Groups API but from what I can this is something entirely different.

Add Last Login to Users api call

Our customer wants to see a report of all their current users' last login dates, but I couldn't find a way to get that information from the current API:
http://docs.valence.desire2learn.com/res/user.html
It's a little frustrating, because it's so easy to get this data in the UI itself:
Is there any way we can get that data through the API? Thanks!
Currently, there is no way to get this information via an API call; however, you are not the first person to inquire about this, and I suspect it's on D2L's list of improvement items for their developer platform.

Twitter Api: Autocomplete with friends

I'm trying to implement a "search for username" feature using the Twitter Api. Specifically, I need autocomplete.
I've noticed that /users/search/ doesn't work well, while looking for friends it keeps suggesting people that has nothing to do with me until i enter the full name.
I thought of loading the list of friends, but:
It only gives IDs. With the limitations of the number of requests, getting all the IDs and calling the API again to get the screen_names would consume it all
It gives chunks of 5000 users. Again, for people followin 100.000+ users it would not be usable.
Any suggestion?

How to get a list of all retweeters in Twitter?

I have seen numerous companies doing like Twitter lotteries where users got to retweet their tweet and then one of retweeters will get the prize or whatever.
I was wondering now how do they get the list of all retweeters or pick the winner?
I checked Twitter API and found only this thing: GET statuses/retweets/:id but it returns maximum of 100 retweeters. Is that the only way?
It looks likes there's a couple services out there doing almost exactly this. A quick google pulls up http://onekontest.com/ and there's a few other Twitter contest services, but they all seem to be different levels of broken since they haven't kept up with changes to the API.
As far as the Twitter API itself is concerned, if you were expecting more than 100 responses, I think using GET statuses/mentions makes the most sense. That API call returns any mentions of a user, and you can pass the flag include_rts to include any retweets of your tweets. Then, if you wanted to list RTs of a specific tweet, you could check the in_reply_to_status_id field in the returned data to see if it matches the original tweet ID. This API call only returns the last 800 status, 200 at a time, so if you expect a bunch of data, you would need to poll the API repeatedly over time to get all the tweets. I imagine services like favstar are doing exactly this, just on a larger scale.
If you're actually looking for code to do something like this, I wrote a sinatra app called twitter-rss-digest which handles querying Twitter over time to track different sorts of queries. It's pretty rough, and doesn't quite handle this specifically, but it might point you in the right direction if you want to code something.
The Twitter API has an endpoint that returns up to 100 retweeter IDs for a given tweet.
Note that for historical reasons, that endpoint only returns up to 100 results and the documentation about the cursor is useless. Twitter refused to fix the situation.
2013 note
That said, the first thread on the Developers site that surfaced in a quick google has #episod, a Twitter employee saying:
You can't likely get to all of them. The data is spread out. Your best bet is to use the REST API to determine many of the users who performed the retweet, but the data will still be constrained.
It's easiest to track retweets as they happen rather than try to find them from the past. Use the Streaming API for that.
I like muffinista's method, but I think if you want a 100% complete list of retweets, simply enable the retweet email notifications and write a script that polls the email box for those matching the subject "retweeted one of your Tweets!" and put the data into a table. Do this right from the start.
The site https://twren.ch/ enlists all the retweeters for a given tweet (note that it only enlists retweeters who are direct followers of the source tweeter.) Nevertheless its probably the only public source available.

Resources