2

the graph API request to create a folder in one drive is

POST /me/drive/root/children Content-Type: application/json

My code:

callMap = Map();
callMap.putAll({"name":"New Folder","folder":"{}","@microsoft.graph.conflictBehavior":"rename"});
headerMap = Map();
headerMap.putAll({"Content-Type":"application/json"});
r = invokeurl
[
url :"https://graph.microsoft.com/v1.0/me/drive/root/children"
type :POST
parameters:callMap.toString()
headers:headerMap
connection:"onedrive"
];
info r;

but gives the error "code": "BadRequest","message": "Property folder in payload has a value that does not match schema." Anyone have a solution?

ZohoCoder
  • 385
  • 5
  • 15
Maxima
  • 69
  • 8

2 Answers2

1

The issue is that your definition of folder is "{}" (i.e. a string), when it should be {} (i.e. an object).

Brad
  • 4,089
  • 2
  • 16
  • 26
0
callMap = Map();
callMap.putAll({"name":"New Folder","folder":{ "@odata.type": "microsoft.graph.folder" },"@microsoft.graph.conflictBehavior":"rename"});
headerMap = Map();
headerMap.putAll({"Content-Type":"application/json"});
r = invokeurl
[
    url :"https://graph.microsoft.com/v1.0/me/drive/root/children"
    type :POST
    parameters:callMap.toString()
    headers:headerMap
    connection:"onedrive"
];
info r;
Maxima
  • 69
  • 8
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 14 '22 at 01:45