Outlook api. How to search emails with oauth token? - oauth

Is there any working and complete code samples that demonstrate how to work with hotmail api?
For example I've already made for gmail api with web application:
oAuth
search mail by uuid inside mail body
get Message Content
get Message Attachment
some processing code
Now I need to integrate hotmail.
done only:
oAuth with scope https://graph.microsoft.com/mail.read
That code samples that I found in official documentation doesn't shows how to pass oauth token - thats why have a lot of questions
Share some links that will help me, please!

I recommend you use the Microsoft Graph to read and search emails. It works for work, school and personal Microsoft accounts (hotmail, live, outlook.com, etc).
Since you already have an access token, just pass it through with an Authorization header. More information about using access tokens with the Microsoft Graph can be found in their documentation.
Authorization: Bearer [Access Token]
For searching email, try the following query:
GET https://graph.microsoft.com/v1.0/me/messages?$search="hello world". If you're trying to search for emails in a different user's mail, try:
GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/messages?$search=foobar
I also recommend trying the Microsoft Graph Explorer since it has sample queries for Outlook Mail. To show the Outlook samples, click the show more samples link. Also, clicking the icon to the right of each query will bring you to the documentation page for that sample.

Related

Outlook add in with Graph API

I want to develop an add in for Outlook which after click on button forward selected email to hardcoded address. What I find is that I must use Graph API to do this, but I lost in documentation on how I get token to make an API call. In Outlook API it is simple as call getCallbackTokenAsync. Is it similar way to get token for Graph API? What is the simplest way of getting this token, best if it could be done without user interaction?
It's straightforward. First you need to register you application in Azure AD, make sure you provide right roles/permissions so that you can get a token. Using the token you can access a protected resource like Microsoft Graph API. You may want to get it started following the documentation/javascript sample.

LinkedIn company feed/updates in v2 API

I would like to show a company's feed/updates/post on a website. I am the owner/admin of the LinkedIn page. Most of the related questions are old and uses V1. This similar questions also seems unanswered (LinkedIn Company Feed in API v2?). LinkedIn support are of no help and they instruct me to ask questions on Stackoverflow.
I created an App on LinkedIn and they assigned default permissions (r_emailaddress, r_liteprofile, w_member_social). But these permissions are of no use to me since I just want to show the company feeds on the website. Neither I want any user to login to LinkedIn nor I want to read the users/visitors email addresses or profile. Already went through a lot of their documentation but there is no clear mentioning of how to do this.
I read that company updates can be retrieved using the /ugcPosts API. GET https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(url-encoded organization Urn). But in order to do that I need r_organization_social permission. How to get this permission?
Also in this scenario, since I just want to retrieve company posts, I can use 2 legged oauth: https://learn.microsoft.com/en-us/linkedin/shared/authentication/client-credentials-flow?context=linkedin/context instead of 3 legged oauth. But when I try to generate access token I get error "access_denied: This application is not allowed to create application tokens"
https://www.linkedin.com/oauth/v2/accessToken?grant_type=client_credentials&client_id=xxxxx&client_secret=xxxxx&redirect_uri=http://xxxxx.local/&state=fasdfasdfs
Does anyone know how to achieve this?
Thanks!
You need to apply for the LinkedIn Marketing Partner Program. You can do so by adding this product to the app you have created.
Once you have access, you can read the company feed using the following API endpoint:
https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:organization:12345&sharesPerOwner=100&count=25
Hope this helps.

How do I generate a link that requests access to read non-public sheet using the google-drive api?

My company is trying to get requests to access non-public user sheets. Here is how we want to go about it:
The user receives a link which contains all the necessary authentication information , and when they open the link, it gives them an alert saying something like "Grant client_id/client_email access to google_sheet"?, and when they click "yes", we get access to read the dataset?
is something like this possible with the google-drive api ?
I have looked at the google-sheet api here and the google-drive-sdk here , but I have not found what I am looking for.
When your application requests non-public user data, it must include an authorization token. The token also identifies your application to Google. Check this Google documentation. Requests to the Google Sheets API for non-public user data must be authorized by an authenticated user. The details of the authorization process, or "flow," for OAuth 2.0 vary somewhat depending on what kind of application you're writing. Check this example.

Is it possible to integrate Outlook Social Connector with Rails?

I'm currently investigating the possibility to connect rails applicatrion with exchange for getting user information. I think to create rails page with user profile, and get profile information from exchange.
I found this: Outlook Social Connector
As I understand, this is an API for getting information about user (contact list, updates, new e.g.) from exchange, isn't it?
So, please, help me to understand this thing...
Is it possible to get facebook-updates of my outlook-contacts using some of EWS/Social Connector APIs ?
No, the Outlook Social Connector is a way that Outlook can connect to social networks. It sounds like you want to access data in the Exchange server. Have you looked at the REST APIs? There's a Rails sample here: https://github.com/jasonjoh/o365-vcftool. The code from that sample is also wrapped in the ruby_outlook gem.

AdWords API, getRefreshToken url not working

I am trying to get the refresh access token from AdWords API but the url generated by GetRefreshToken does not really work despite the fact I am logged in with the user that owns and created the API token.
Any ideas?
For other people who also get stuck in the new oAUTH2 auth. of AdWords, here's the solution.
In the google code console, when you create your project, in the consent screen you must fill in all the fields required for WEB application. This is because the url you hit provided by the php script requires web access permissions and if not provided you get a bunch of weird unrelated errors.
Hope this helps.

Resources