I have corporate account that I logged in to Graph Explorer. When I try to fetch my profile, or manager details, it works. When I click in on "my mail", I get the following error:
{
"error": {
"code": "ResourceNotFound",
"message": "Resource could not be discovered.",
"innerError": {
"request-id": "f838caba-d769-4873-b7ba-80fd8e7016e4",
"date": "2017-12-19T21:04:30"
}
}
}
If I switch to my private #outlook.com account everything works as it should. What could be the problem in this case ?
You're receiving this error because the mailbox you're attempting to access is located on a local Exchange Server and isn't accessible to Microsoft Graph.
On-prem Exchange Servers are not supported by Microsoft Graph at this time. There is however a preview/beta available for Hybrid Deployments where you have a mix of Exchange On-Prem and Exchange Online mailboxes:
Use REST APIs to access mailboxes in Exchange hybrid deployments (preview)
Related
I need help in understanding the exact path I should follow to solve my problem.
I hava a gmail address(I can say this gmail is used by my java application) Whenever a mail comes to this gmail address. I want my application to know and get the email from my gmail inbox and proceed with the further logic.
So far Going through the google docs I have created a topic and a subscribe which has subscribed to that topic. Using push mechanism I'm also able to call my endpoint whenever a message get published manually from google console to that topic.
Now I want if any email comes to my gmail address, it should notify my endpoint and after I can just fetch the email from the gmail and proceed with the logic.
Here As I have only mine gmail address which I will be accessing I don't think I need to go for Oauth2 mechanism for gmail authentication purpose.
I went through the documentation which says. I should create a watch request, then maybe if any gmail inbox receives a mail it will notify my endpoint and then I can fetch the mail and proceed further. But I'm not sure what and how exactly I should proceed Do I need a service account if yes I have already created a service account and downloaded my private key.
GoogleCredential.fromStream(new FileInputStream("file.json"))
.createScoped(Collections.singleton(GmailScopes.MAIL_GOOGLE_COM)).createDelegated("xxxxx.iam.gserviceaccount.com");
then I'm calling watch request as :
Gmail gm = new Gmail.Builder(GoogleNetHttpTransport.newTrustedTransport(), JSON_FACTORY, googleCredBuilder()).build();
WatchResponse res = gm.users().watch("me", request).execute();
I got this error.
POST https://www.googleapis.com/gmail/v1/users/me/watch
{
"code": 400,
"errors": [
{
"domain": "global",
"message": "Precondition check failed.",
"reason": "failedPrecondition"
}
],
"message": "Precondition check failed.",
"status": "FAILED_PRECONDITION"
}
Can someone please help how exactly I should proceed to achieve my goal.
Thank you.
"Precondition check failed.",
Means that you are trying to use a service account with a standard google gmail address.
Service account authorization only works with gmail api and google workspace accounts once domain wide delegation has been configured.
You have two options
swtich to using a google workspace domain account.
Use Oauth2, set your application to production and not test so that the refresh token wont expire. Authorize your application once store the refresh token, then upload it to the server. It will be able to use the refresh token to request a new access token whenever it needs.
I'm trying to build out a migration from Google Workspace into MS365. I've tried each of MS's recommended methods; Automatic, Manual, and PowerShell. For each one, I get the same error message
post-migration
uri=https://www.googleapis.com/calendar/v3/users/me/calendarList?maxResults=250 response={ "error": { "code": 403, "message": "Google Calendar API has not been used in project 206754733531 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=206754733531 then retry.
If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"errors": [ { "message": "Google Calendar API has not been used in project 206754733531 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=206754733531 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.", "domain": "usageLimits", "reason": "accessNotConfigured", "extendedHelp": "https://console.developers.google.com" } ], "status": "PERMISSION_DENIED", "details": [ { "#type": "type.googleapis.com/google.rpc.Help", "links": [ { "description": "Google developers console API activation", "url": "https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=206754733531" } ] }, { "#type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "SERVICE_DISABLED", "domain": "googleapis.com", "metadata": { "consumer": "projects/206754733531", "service": "calendar-json.googleapis.com" } } ] } } . --> The remote server returned an error: (403) Forbidden.
When I follow the link
https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=206754733531**
I see the following screen
Relating to the PERMISSION_DENIED portion of the error, I have ensured that the ServiceAccount associated with the project has been added to the project and has the requisite permissions based on MS's documentation.
I really don't know what I'm doing incorrectly or where I'm going wrong. I'm incredibly new to all things programming and development so I apologize if this isn't nearly enough detail. I'm happy to provide more context/info as needed.
Google Calendar API has not been used in project 206754733531 before or it is disabled
Means that the Google calendar api has not been enabled in your app or its disabled.
Here are a few things to check in order of likelihood of causing your issue.
I would double check that you are in fact checking the correct project on google developer console for the service account credentials you are using. You may have downloaded a file for a different project and are checking the wrong one.
After that i would check the quota allotment you have for the google calendar api. Click the manage button in that link. If your quota is 0 then google has disabled your access for some reason. If they have check your email they should have told you why it was disabled.
SERVICE_DISABLED
If you have created the service account on google developer console logged in as a standard gmail user its not going to work. Service accounts only work with google calendar api with google workspace.
PERMISSION_DENIED
Make sure that you are creating this service account on the domain that you intended to access. Google calendar only works with service accounts from google workspace domain accounts with domain wide delegation setup. Great guide in setting up delegation Perform Google Workspace Domain-Wide Delegation of Authority just change the scopes to the google calendar scope you are using.
I tried to access GMB account list api with an access token having scope
https://www.googleapis.com/auth/business.manage
{
"error": {
"code": 403,
"message": "Google My Business API has not been used in project xxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=xxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url": "https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=xxxxx"
}
]
}
]
}
}
Whenever I tried to submit request from I got an email from GMB that
Your company already has a whitelisted project to access the Google My Business API. At this time, we are only whitelisting one project per business..
I checked, but there is no library with name Google My Business.
Current enabled Libraries are
Have you submitted the form to get access to the GMB API?
https://docs.google.com/forms/d/e/1FAIpQLSfC_FKSWzbSae_5rOpgwFeIUzXUF1JCQnlsZM_gC1I2UHjA3w/viewform
When you fill it, you have to precise the email addresses that Google will grant access to. Maybe someone else filled in for your company but didn't mention your email address.
In my case, when I received a confirmation email from the GMB team, I was able to see the GMB API when I searched for it in the console (see screenshot)
Then, all I had to do was to click to enable it.
While I test my latest Bot skills developed in Azure, I get below error. I didn't get this error for my other bots.
{
"error": {
"code": "ServiceError",
"message": "Bot should use its own storage"
}
}
How do I prevent my code from using Bot storage.
Regards,
Pradeep
As per the documentation of Azure Bot Service 3.0, it is mandatory to manage state data. You cannot "prevent" your code from using storage.
Scenario 1:
According to this article: Remove a G Suite service: An administrator can uninstall Gmail for all users.
Scenario 2:
According to this article: Turn Gmail on or off for a group of users: An administrator can put a user in an organization unit and turn on/off Gmail for the organization.
My question is: how to check if Gmail is turned on/off for a user in G Suite by Google API? (both Scenario 1 & Scenario 2)
I know that if I send API https://www.googleapis.com/gmail/v1/users/me/labels by the user in Scenario 2, I'll get a response like
{
"error": {
"errors": [
{
"domain": "global",
"reason": "failedPrecondition",
"message": "Mail service not enabled"
}
],
"code": 400,
"message": "Mail service not enabled"
}
}
But I'm afraid that this response is not specific enough and the message "Mail service not enabled" may vary as time goes by.
Directory API, Users resource, isMailboxSetup can be used for checking the mail service
Indicates if the user's Google mailbox is created. This property is
only applicable if the user has been assigned a Gmail license.
My test result:
a normal user's isMailboxSetup with Gmail service eanbled: true
a suspended user's isMailboxSetup: true
the user's isMailboxSetup in scenario 1 (uninstall Gmail for all users): false
the user's isMailboxSetup in scenario 2 (turn off Gmail for the organization): false