Google Calendar: freeBusy giving error “notFound” with one account but not another

倖福魔咒の 提交于 2019-12-12 03:29:43

问题


To start off I'm using a google apps for business account and I have 2 accounts test1@mycompany.com and test2@mycompany.com

After that I have an Api E-Mail that is registered in the API console to test1@mycompany.com which I'll represent as #####@developer.gserviceaccount.com

The query is a simple, I simply have a timeMin & timeMax & 2 items each with id's i send this using the Java client API

First query with GoogleAuthorizationCodeFlow and using test1@mycompany.com

{
 "kind": "calendar#freeBusy",
 "timeMin": "2013-03-26T22:50:16.501Z",
 "timeMax": "2013-03-26T22:50:22.501Z",
 "calendars": {
  "test1@mycompany.com": {
   "busy": []
  },
  "test2@mycompany.com": {
   "busy": []
  }
 }
}

This is what I get for the second authorization method using (Getting the error "notFound")

GoogleCredential.Builder()
.setServiceAccountId("#####@developer.gserviceaccount.com")
.setServiceAccountPrivateKeyFromP12File("key.p12").etc().etc()

{
 "kind": "calendar#freeBusy",
 "timeMin": "2013-03-26T22:19:14.770Z",
 "timeMax": "2013-03-26T22:19:20.770Z",
 "calendars": {
  "test1@mycompany.com": {
   "busy": []
  },
  "test2@mycompany.com": {
   "errors": [
    {
     "domain": "global",
     "reason": "notFound"
    }
   ],
   "busy": []
  }
 }
}

Even though test1@mycompany.com can gain access to test2@mycompany.com #####@developer.gserviceaccount.com cannot, why is this they are both really the same account are they not? #####@developer.gserviceaccount.com belongs to test1@mycompany.com anyways. Test2@mycompany.com is set to share the calendar(As evident in the first query) and I don't know why the developer account doesn't have access to that business.


回答1:


I expected a similar result as you, but I also got a notFound error when using the service_account credentials. The solution that worked for me was to go into the calendar sharing page and explicitly share my calendar with the #####@developer.gserviceaccount.com email address.




回答2:


I apologize for not having more specifics, but how this was eventually resolved was by having the owner of the Apps for Business account add the developer email address ( #####@developer.gserviceaccount.com) as a delegate, and now I can get freeBusy times of anyone on the business account. The other answer of adding the #####@developer.gserviceaccount.com as a user on the calendar itself also worked.(Though I would have had to do this for every user)



来源:https://stackoverflow.com/questions/15649046/google-calendar-freebusy-giving-error-notfound-with-one-account-but-not-anoth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!