microsoftgraph / msgraph-sdk-java-auth

Authentication Providers for Microsoft Graph Java SDK
34 stars 21 forks source link

Getting HTTP 400 Bad Request when trying to add permission to a folder #21

Closed PiercarloSlavazza closed 5 years ago

PiercarloSlavazza commented 5 years ago

I am getting HTTP error code 400 when I try to add a "write" permission for a group to a folder with the following code (I haven't found any example in the docs):

Identity identity = new Identity();
identity.id = "id_of_the_group";
identity.displayName = "name_of_the_group";
IdentitySet identitySet = new IdentitySet();
identitySet.user = identity;

Permission permission = new Permission();
permission.grantedTo = identitySet;
permission.roles = Arrays.asList("write");

graphServiceClient.users("user_which_owns_the_folder").drive().items("folder_id").permissions().buildRequest().post(permission);

Please note that with similar code I am able to retrieve existing permiossions, list childrens of a folder etc.

Is it a bug, or the code is somehow wrong?

PiercarloSlavazza commented 5 years ago

Sorry, wrong place where to file the issue.