Skip to content

Conflict Behaviors

Kunal Varma edited this page Mar 9, 2016 · 1 revision

Conflict Behavior

The default Conflict Behavior if set to fail. Thus, if an item with the same name already exists, OneDrive will return an error.

Replace an Item

If Conflict Behavior is set to replace and an item with the same name already exists in the destination, the new item will override the existing one.

$folder = $client->createFolder("Test Folder", null, "replace");

Auto-Rename

If Conflict Behavior is set to rename and an item with the same name already exists in the destination, the new item name will be updated to be unique.OneDrive will append a number to the end of the item name (for files - before the extension).

For example, hello.txt would be renamed hello 1.txt. If hello 1.txt is taken, then the number would be incremented again until a unique filename is discovered.

$file = "helloworld.txt";
$conflictBehavior = "replace";
$createdFile = $client->uploadFile($file, null, null, "rename");

Table of Contents

Getting Started

Examples

Clone this wiki locally