Get activities of user based on user id - microsoft-graph-api

I am looking to fetch activities of user based on their user id. I can see that there is a Get user activities API to get my activities but is there any way to get activity of other users? Given the fact that i have admin account and i can assign permissions.

To get the activity of other users you can use this API
GET https://graph.microsoft.com/v1.0/users/{id}/activities
It requires UserActivity.ReadWrite.CreatedByApp permission.

Related

Microsoft Graph API get all user messages for tenant in single API call

Is there a way to get all user messages (emails) for a tenant in a single API call? This would be for a daemon app with admin consent not logging in on behalf of a user.
such as:
"endpoint": "https://graph.microsoft.com/v1.0/users/messages"
instead of:
GET /users/{id | userPrincipalName}/messages
Or is it required to get a list of active users first and make API calls for each user id to get messages individually?
Obviously, you could not get all user's messages directly with the single API. As you said, you could get a list of users then loop to call this API by the user's object id.
There is a sample as a reference about looping to query using Powershell.

How to get a list of shared Calendars in Microsoft graph?

Is it possible to get a list of users (or user ids) who shared their calendars with the person logged in?
I want to have a list of calendars where I can call as I do with
https://graph.microsoft.com/v1.0/users('user shared the calendar')/calendars
There's a way you can take it one step closer to what you want using the beta endpoint: do a GET /calendars for the signed-in user, and for each calendar, check the isSharedWithMe property. If that property is true, the owner property would show the display name and SMTP address of the user who shared the calendar.
Other than the user ID, you can use the SMTP address to index into the users collection in a tenant as well.
You can see a description of the calendar properties in the Graph documentation.
Please be aware that isSharedWithMe, and in general, APIs in the beta endpoint, are subject to change without notice. For that reason, production apps should not take a dependency on such APIs.

How to get the user information who are not in my roster list?

I am working on group chat using robbiehanson/XMPPFramework. I have done sending invitation,accepting invitation and messaging in group chat.
Here I want to show some information of user who sent message in group chat including his avatar.
I can get the users information from XMPPUserCoreDataStorageObject. this case is applicable only if those users are present in my friend list. I need to get the users information who are not in my friend list. Is there any possible way to achieve this. Please suggest me
In XMPP, avatar (vcard) of any user can be fetched irrespective of roster entries. So if you are trying to query vcard of any other user of your service, then it should work. If it's not working, please provide the both "get" and "result" IQ here for vcard request.
However, if you are trying to query presence status of other user's then yes there is restriction of roster. This can be overcome by implementing following logic:
User registers in your application (Android or iPhone), determine registered contacts of your service from user contact book and automatically add them in your roster.
Also Implement roster request handling in your application that when it get's request for allowing other user to add you in his roster, automatically accept the request and send request to that user to add him in your roster too.
Now again accept that request.
In this way, you can add users in roster behind the scenes and user's can view the information of other users just like WhatsApp.

How to get checkins of a user's particular friend from foursquare?

I am trying to get checkin information of a user's particular friend in my application. In application, user authenticates to foursquare at the start which make me able to get his/her friend list.
I am getting the friend list with this API end point : https://api.foursquare.com/v2/users/self/friends. According to documentation it's response should include user objects which should have include checkins field but it seems there is no checkins field in the response. I can get other informations like first name, bio etc.
I also tried this API endpoint with user ID of friend which I want to get information of https://api.foursquare.com/v2/users/USER_ID/checkins but it returns an error states that I am not authorized for getting this information.
What am I doing wrong? Should I be authorized for this information since the information is about checkins of user's friends?
Thanks in advance.
Unfortunately this isn't a use case that's supported very well by the API. The way to see a list of check-ins of a particular user is through users/self/checkins. This will return the check-ins of the owner of the OAuth token that made the call.
As stated here https://developer.foursquare.com/docs/users/checkins:
USER_ID | self | For now, only self is supported

Get user information through the Access Token Application

Can I get and show pictures of users through the Graph API with just the access token application?, for example collect the user information for show it in a same page, of course those users been accepted the permissions of the web app and then other user can access to the web and see the information of all those users. All this only storing the ids of facebook, I mean, for get in the same page the information of the users, I want to make a call through the API and retrieve his information by the facebook ID stored in database.
You can show public data of user using his/her user ID and Application Access token , which include name and profile picture.
https://graph.facebook.com/<user_id>
Submitting a GET HTTP request on above URL with correct user id will give you publicly available data. You can add fields to get more public data like profile photo.

Resources