The code example in the graph API reference for upload is misaligned to sdk 5.77.x

Gtman Chin 65 Reputation points
2024-01-17T01:12:41.98+00:00

Hi I am working on development of the item upload using graph java sdk in Android. However, I am confused because the method PUT seems to be different from the one provided in sdk 5.77.x. The sdk api reference of 5.77.XUser's image

The code example in the microsoft graph documentation for uploading a item smaller than 240MB is attached below. It obviously the input parameters are different. The PUT method in sdk referencer requires a DriveItem but the one in the code example requires a byte array. Does anyone encounter this kind of problem? (page link: https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=java#example-updating-an-existing-file)

GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();

byte[] stream = Base64.getDecoder().decode("The contents of the file goes here.");
	graphClient.me().drive().items("{item-id}")
	.buildRequest()
	.put(stream);
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,751 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.