Error while accessing oneDrive: User's mysite not found - json

I'm trying to access oneDrive via Graph api, and when I hit the api, I get User's mysite not found.
GET https://graph.microsoft.com/beta/me/drive
{
"error": {
"code": "ResourceNotFound",
"message": "User's mysite not found.",
"innerError": {
"request-id": "13eb583d-c29a-42af-8868-bae06d554538",
"date": "2018-05-18T06:06:55"
}
}
}
So, looking out for the solution, I saw an issue where they said to get OneDrive for Business' location, But this returns UnauthorizedAccessException
GET https://graph.microsoft.com/beta/me?select=mySite
{
"error": {
"code": "-2147024891, System.UnauthorizedAccessException",
"message":
"Access denied. You do not have permission to perform this action or access this resource.",
"innerError": {
"request-id": "3489894e-faa0-42c6-9f3b-e76c4708ce15",
"date": "2018-05-18T06:10:00"
}
}
}
And when I hit for /me endpoint, there I see an empty array for provisionedPlans.
GET https://graph.microsoft.com/beta/me
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#users/$entity",
"id": "7e8397a6-b299-34a2-af06-d3487t5b5174",
//...
"onPremisesProvisioningErrors": [],
"provisionedPlans": []
}
My access token is
eyJ0eXAiOiJKV1QiLCJub25jZSI6IkFRQUJBQUFBQUFEWDhHQ2k2SnM2U0s4MlRzRDJQYjdySGc5dDJ4SmxkODFMRURNY1FuN3pMYVgyektLaDR2SF9FSFltd1JaQ3Y5TU55VDJOR250VmlDQVFmTXpiTWxoYkZWQ19nSEdtaWhfWlJfcVlpaGRyMHlBQSIsImFsZyI6IlJTMjU2IiwieDV0IjoiaUJqTDFSY3F6aGl5NGZweEl4ZFpxb2hNMllrIiwia2lkIjoiaUJqTDFSY3F6aGl5NGZweEl4ZFpxb2hNMllrIn0.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20vIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvM2FjMThiOGMtNjY4ZC00NzBhLWJhMDctYWU0MjdlMTkwZGEyLyIsImlhdCI6MTUyNzE0MDg2MCwibmJmIjoxNTI3MTQwODYwLCJleHAiOjE1MjcxNDQ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rb21hbC5oZW5kcmVAcmF5a29yLmNvbSIsInV0aSI6IkxtTnJoX1FZbUVHbUtSY1JHcWtGQUEiLCJ2ZXIiOiIxLjAifQ.JtXMDO2Whs24ItQIIPBEZj93Go5z0QowyZCy-msAw7-heGu7yQZrppuvBfv-rrAS1bvFw_aBDBALzX7rlHwsiU9KaEzrRdzUgc9lciDhuGsPZddGEZrSpTuhBPvLa-xI8_1bLMhSChLECU63rMnBYHZJesenWqPL0w1DsmkUHeR01Ff7l8pgsH3jemRK2NAr4LD-wyQrumJxz2h45luO9dICqPOGjI9hwrjNpSDJnhienDkUsrcOA2ijnWglCJ3GRN9RfrJ93osCaO3WpUoTIy66NApYR__YDGzO4HsTk_MA9OSQCHcw5mOaOeRKZmRTDPIokyYpeNgXBK9FmZivBg
Can't figure out that it is a access problem or provisioning problem. Can anyone suggest what's going wrong here.

Related

google drive API verified domain not working with changes watch

According to https://developers.google.com/drive/api/v3/reference/changes/watch,
you need an https address to make it works if you need to watch over a change of resources.
I've configured the domain successfully by going to Google Cloud Console > Domain Verification > Add Domain.
Then I use Postman to make a call to test it:
https://www.googleapis.com/drive/v3/changes/watch?pageToken=nextPageToken
{
// "kind": "api#channel",
"id": "1234231",
"expiration": 1656402233000,
"type": "webhook",
"payload": true,
"address": "https://mrnoc.blogspot.com",
"params": {
"pageToken": "nextPageToken"
}
}
However, it failed and generated this error message:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "push.webhookUrlUnauthorized",
"message": "Unauthorized WebHook callback channel: https://mrnoc.blogspot.com"
}
],
"code": 401,
"message": "Unauthorized WebHook callback channel: https://mrnoc.blogspot.com"
}
}
I have no idea how it doesn't work, I've tried to look around but it a dead end as it seems like I've configured everything properly.
Please help if you know what might stop it from working.
Thank you

Api response gives generic response

I am trying to generate a oauth token for a service account on google. I am getting a generic response
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
I am not sure which field is invalid https://cloud.google.com/iam/credentials/reference/rest/v1/projects.serviceAccounts/generateAccessToken
I followed the steps in this url https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials
Any help would be really appreciated.

"Status Code: NotFound; Reason: Not Found" when creating subscription to on-premise mailbox

We have a hybrid Exchange deployment. Trying to create a subscription to get updates, creates, deletes on Calendar and Contacts.
In Graph Explorer I'm logged in as an Office 365 user that has full access to the On-Premise mailbox I'm trying to access (user#domain.com). I'm entering:
POST | v1.0 | https://graph.microsoft.com/v1.0/subscriptions
Request Body:
{
"changeType": "updated",
"notificationUrl": "https://our.URL/WebHooks/Graph/GraphMessagesHook.php",
"resource": "users/user#domain.com/contacts",
"expirationDateTime": "2018-10-23T04:00:00Z",
"clientState": "secret"
}
Response is:
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: NotFound; Reason: Not Found]",
"innerError": {
"request-id": "981c0892-e6d8-490b-838d-880d8268037f",
"date": "2018-10-20T20:32:07"
}
}
}
As a test, I created another user in Office 365 and did the same request body:
{
"changeType": "updated",
"notificationUrl": "https://our.URL/WebHooks/Graph/GraphMessagesHook.php",
"resource": "users/userOn365#domain.com/contacts",
"expirationDateTime": "2018-10-23T04:00:00Z",
"clientState": "secret"
}
This time instead of a 404 NotFound, I got a 403:
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: Forbidden; Reason: Forbidden]",
"innerError": {
"request-id": "1f378cf0-b1ec-4b87-ba03-8dee120b748b",
"date": "2018-10-21T20:42:46"
}
}
}
What am I missing?
The Microsoft Graph API for on premise mailboxes is only a subset of the cloud functionality.
Don’t think they implemented subscriptions for on-premise mailboxes. That would be pretty resource intensive on both sides.
To my knowledge they just proxy the request to your local Exchange (which is configured to accept the Azure tokens). For rest calls that is easy, for subscriptions the routing would be difficult.

Google Drive API v3: how to set canCopy capabilities on a file

I want to limit the capabilities of a file in personal Google Drive. When I use the API explorer Google Drive v3 API with the following request:
POST https://www.googleapis.com/drive/v3/files?key={YOUR_API_KEY}
{
"capabilities": {
"canCopy": false
},
"name": "testfile"
}
I get the following response:
403
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "fieldNotWritable",
"message": "The resource body includes fields which are not directly writable."
}
],
"code": 403,
"message": "The resource body includes fields which are not directly writable."
}
}
Which is the same response that I get when trying to update a file with:
PATCH https://www.googleapis.com/drive/v3/files/FileIdHere?key={YOUR_API_KEY}
{
"capabilities": {
"canCopy": false
}
}
It seems that there are no methods to accomplish this or has anyone a workaround?
If you check file resource you will notice that some fields are writeable while others are not.
The message you are seeing is because the field you are trying to set is not writeable this means you can not change it from the API

Unable to share a file in Team Drive with anyone with link and for people outside organization

I would like to use Google Drive API to share a file with anyone that has the link to view the file.
However, i failed with error 403, even if I used admin account
"code": 403,
"message": "The user does not have sufficient permissions for this file."
I tried using the API Explorer but still failed.
Followings are my parameters, please help
fileID:"xxxxxxx"
Request Body
{
"role": "reader",
"type": "anyone"
}
And the response
Response
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientFilePermissions",
"message": "The user does not have sufficient permissions for this file."
}
],
"code": 403,
"message": "The user does not have sufficient permissions for this file."
}
}
Please check and help.
Thanks