@@ -41,14 +41,14 @@ public function deleteFile($id, $type = 'me')
41
41
return MsGraph::delete ($ type ."/drive/items/ $ id " );
42
42
}
43
43
44
- public function createFolder ($ name , $ path , $ type = 'me ' )
44
+ public function createFolder ($ name , $ path , $ type = 'me ' , $ behavior = ' rename ' )
45
45
{
46
46
$ path = $ path === null ? $ type .'/drive/root/children ' : $ type .'/drive/root: ' .$ this ->forceStartingSlash ($ path ).':/children ' ;
47
47
48
48
return MsGraph::post ($ path , [
49
49
'name ' => $ name ,
50
50
'folder ' => new \stdClass (),
51
- '@microsoft.graph.conflictBehavior ' => ' rename ' ,
51
+ '@microsoft.graph.conflictBehavior ' => $ behavior ,
52
52
]);
53
53
}
54
54
@@ -66,9 +66,9 @@ public function rename($name, $id, $type = 'me')
66
66
]);
67
67
}
68
68
69
- public function upload ($ name , $ uploadPath , $ path = null , $ type = 'me ' )
69
+ public function upload ($ name , $ uploadPath , $ path = null , $ type = 'me ' , $ behavior = ' rename ' )
70
70
{
71
- $ uploadSession = $ this ->createUploadSession ($ name , $ path , $ type );
71
+ $ uploadSession = $ this ->createUploadSession ($ name , $ path , $ type, $ behavior );
72
72
$ uploadUrl = $ uploadSession ['uploadUrl ' ];
73
73
74
74
$ fragSize = 320 * 1024 ;
@@ -110,13 +110,13 @@ public function upload($name, $uploadPath, $path = null, $type = 'me')
110
110
}
111
111
}
112
112
113
- protected function createUploadSession ($ name , $ path = null , $ type = 'me ' )
113
+ protected function createUploadSession ($ name , $ path = null , $ type = 'me ' , $ behavior = ' rename ' )
114
114
{
115
115
$ path = $ path === null ? $ type ."/drive/root:/ $ name:/createUploadSession " : $ type .'/drive/root: ' .$ this ->forceStartingSlash ($ path )."/ $ name:/createUploadSession " ;
116
116
117
117
return MsGraph::post ($ path , [
118
118
'item ' => [
119
- '@microsoft.graph.conflictBehavior ' => ' rename ' ,
119
+ '@microsoft.graph.conflictBehavior ' => $ behavior ,
120
120
'name ' => $ name ,
121
121
],
122
122
]);
0 commit comments