Graph API - Unable to Use Valid Access Token to Upload file
I am unable to upload a file using a valid access token (the token allows me to list groups, drive items etc.). The error that appears is:
invalidRequest: One of the provided arguments is not acceptable.
Using the following PUT request:
https://graph.microsoft.com/v1.0/groups/my group id/drive/items/my item(folder) id:/test.txt:/content
using content type: text/plain
I tested this exact same request using the graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer and my office 365 user account and the upload worked, so I though it might be an app permissions thing, however this did not work even after granting absolutely every permission to the app and regenerating the access tokem.
Please help as I would rather use an access token than my user account to perform the uploads.
Thankyou
Oliver
microsoft-graph
add a comment |
I am unable to upload a file using a valid access token (the token allows me to list groups, drive items etc.). The error that appears is:
invalidRequest: One of the provided arguments is not acceptable.
Using the following PUT request:
https://graph.microsoft.com/v1.0/groups/my group id/drive/items/my item(folder) id:/test.txt:/content
using content type: text/plain
I tested this exact same request using the graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer and my office 365 user account and the upload worked, so I though it might be an app permissions thing, however this did not work even after granting absolutely every permission to the app and regenerating the access tokem.
Please help as I would rather use an access token than my user account to perform the uploads.
Thankyou
Oliver
microsoft-graph
add a comment |
I am unable to upload a file using a valid access token (the token allows me to list groups, drive items etc.). The error that appears is:
invalidRequest: One of the provided arguments is not acceptable.
Using the following PUT request:
https://graph.microsoft.com/v1.0/groups/my group id/drive/items/my item(folder) id:/test.txt:/content
using content type: text/plain
I tested this exact same request using the graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer and my office 365 user account and the upload worked, so I though it might be an app permissions thing, however this did not work even after granting absolutely every permission to the app and regenerating the access tokem.
Please help as I would rather use an access token than my user account to perform the uploads.
Thankyou
Oliver
microsoft-graph
I am unable to upload a file using a valid access token (the token allows me to list groups, drive items etc.). The error that appears is:
invalidRequest: One of the provided arguments is not acceptable.
Using the following PUT request:
https://graph.microsoft.com/v1.0/groups/my group id/drive/items/my item(folder) id:/test.txt:/content
using content type: text/plain
I tested this exact same request using the graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer and my office 365 user account and the upload worked, so I though it might be an app permissions thing, however this did not work even after granting absolutely every permission to the app and regenerating the access tokem.
Please help as I would rather use an access token than my user account to perform the uploads.
Thankyou
Oliver
microsoft-graph
microsoft-graph
asked Oct 30 '18 at 2:25
OBSOBS
11
11
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Just add a worked endpoint on my side:
PUT https://graph.microsoft.com/v1.0/groups/my-group-id/drive/root:/test.txt:/content
Request body: The contents of the file goes here.
The content type of request header does not need to be configured.
You need to check your folder path too.
Thank you for your response. However I tried your suggestion and still get the same issue. I tried just placing the test file in the root, exactly as you have done (this should work shouldn't it?). And it failed. I also remove the Content-Type header and no success. I'm not sure where too look now as I am tempted just to use a different service like Dropbox to store my files.
– OBS
Oct 31 '18 at 22:51
Another question - did you use an authentication token or a user account to access the endpoint?
– OBS
Oct 31 '18 at 23:07
I use oauth token
– Seiya Su
Oct 31 '18 at 23:19
Me too, however mine is a daemon style token (not attached to a user). Is yours also a user independent token? Perhaps this is where the issue lies?
– OBS
Nov 2 '18 at 3:13
add a comment |
I managed to resolve by creating a new app definition in Azure AD with the same permissions and it worked! Perhaps there was some corruption in my original Azure application - maybe the manifest was corrupt (due to a bug)?
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53056511%2fgraph-api-unable-to-use-valid-access-token-to-upload-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Just add a worked endpoint on my side:
PUT https://graph.microsoft.com/v1.0/groups/my-group-id/drive/root:/test.txt:/content
Request body: The contents of the file goes here.
The content type of request header does not need to be configured.
You need to check your folder path too.
Thank you for your response. However I tried your suggestion and still get the same issue. I tried just placing the test file in the root, exactly as you have done (this should work shouldn't it?). And it failed. I also remove the Content-Type header and no success. I'm not sure where too look now as I am tempted just to use a different service like Dropbox to store my files.
– OBS
Oct 31 '18 at 22:51
Another question - did you use an authentication token or a user account to access the endpoint?
– OBS
Oct 31 '18 at 23:07
I use oauth token
– Seiya Su
Oct 31 '18 at 23:19
Me too, however mine is a daemon style token (not attached to a user). Is yours also a user independent token? Perhaps this is where the issue lies?
– OBS
Nov 2 '18 at 3:13
add a comment |
Just add a worked endpoint on my side:
PUT https://graph.microsoft.com/v1.0/groups/my-group-id/drive/root:/test.txt:/content
Request body: The contents of the file goes here.
The content type of request header does not need to be configured.
You need to check your folder path too.
Thank you for your response. However I tried your suggestion and still get the same issue. I tried just placing the test file in the root, exactly as you have done (this should work shouldn't it?). And it failed. I also remove the Content-Type header and no success. I'm not sure where too look now as I am tempted just to use a different service like Dropbox to store my files.
– OBS
Oct 31 '18 at 22:51
Another question - did you use an authentication token or a user account to access the endpoint?
– OBS
Oct 31 '18 at 23:07
I use oauth token
– Seiya Su
Oct 31 '18 at 23:19
Me too, however mine is a daemon style token (not attached to a user). Is yours also a user independent token? Perhaps this is where the issue lies?
– OBS
Nov 2 '18 at 3:13
add a comment |
Just add a worked endpoint on my side:
PUT https://graph.microsoft.com/v1.0/groups/my-group-id/drive/root:/test.txt:/content
Request body: The contents of the file goes here.
The content type of request header does not need to be configured.
You need to check your folder path too.
Just add a worked endpoint on my side:
PUT https://graph.microsoft.com/v1.0/groups/my-group-id/drive/root:/test.txt:/content
Request body: The contents of the file goes here.
The content type of request header does not need to be configured.
You need to check your folder path too.
answered Oct 30 '18 at 5:46
Seiya SuSeiya Su
1,4371210
1,4371210
Thank you for your response. However I tried your suggestion and still get the same issue. I tried just placing the test file in the root, exactly as you have done (this should work shouldn't it?). And it failed. I also remove the Content-Type header and no success. I'm not sure where too look now as I am tempted just to use a different service like Dropbox to store my files.
– OBS
Oct 31 '18 at 22:51
Another question - did you use an authentication token or a user account to access the endpoint?
– OBS
Oct 31 '18 at 23:07
I use oauth token
– Seiya Su
Oct 31 '18 at 23:19
Me too, however mine is a daemon style token (not attached to a user). Is yours also a user independent token? Perhaps this is where the issue lies?
– OBS
Nov 2 '18 at 3:13
add a comment |
Thank you for your response. However I tried your suggestion and still get the same issue. I tried just placing the test file in the root, exactly as you have done (this should work shouldn't it?). And it failed. I also remove the Content-Type header and no success. I'm not sure where too look now as I am tempted just to use a different service like Dropbox to store my files.
– OBS
Oct 31 '18 at 22:51
Another question - did you use an authentication token or a user account to access the endpoint?
– OBS
Oct 31 '18 at 23:07
I use oauth token
– Seiya Su
Oct 31 '18 at 23:19
Me too, however mine is a daemon style token (not attached to a user). Is yours also a user independent token? Perhaps this is where the issue lies?
– OBS
Nov 2 '18 at 3:13
Thank you for your response. However I tried your suggestion and still get the same issue. I tried just placing the test file in the root, exactly as you have done (this should work shouldn't it?). And it failed. I also remove the Content-Type header and no success. I'm not sure where too look now as I am tempted just to use a different service like Dropbox to store my files.
– OBS
Oct 31 '18 at 22:51
Thank you for your response. However I tried your suggestion and still get the same issue. I tried just placing the test file in the root, exactly as you have done (this should work shouldn't it?). And it failed. I also remove the Content-Type header and no success. I'm not sure where too look now as I am tempted just to use a different service like Dropbox to store my files.
– OBS
Oct 31 '18 at 22:51
Another question - did you use an authentication token or a user account to access the endpoint?
– OBS
Oct 31 '18 at 23:07
Another question - did you use an authentication token or a user account to access the endpoint?
– OBS
Oct 31 '18 at 23:07
I use oauth token
– Seiya Su
Oct 31 '18 at 23:19
I use oauth token
– Seiya Su
Oct 31 '18 at 23:19
Me too, however mine is a daemon style token (not attached to a user). Is yours also a user independent token? Perhaps this is where the issue lies?
– OBS
Nov 2 '18 at 3:13
Me too, however mine is a daemon style token (not attached to a user). Is yours also a user independent token? Perhaps this is where the issue lies?
– OBS
Nov 2 '18 at 3:13
add a comment |
I managed to resolve by creating a new app definition in Azure AD with the same permissions and it worked! Perhaps there was some corruption in my original Azure application - maybe the manifest was corrupt (due to a bug)?
add a comment |
I managed to resolve by creating a new app definition in Azure AD with the same permissions and it worked! Perhaps there was some corruption in my original Azure application - maybe the manifest was corrupt (due to a bug)?
add a comment |
I managed to resolve by creating a new app definition in Azure AD with the same permissions and it worked! Perhaps there was some corruption in my original Azure application - maybe the manifest was corrupt (due to a bug)?
I managed to resolve by creating a new app definition in Azure AD with the same permissions and it worked! Perhaps there was some corruption in my original Azure application - maybe the manifest was corrupt (due to a bug)?
answered Nov 15 '18 at 3:09
OBSOBS
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53056511%2fgraph-api-unable-to-use-valid-access-token-to-upload-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown