Put - Schwenkner/SugarSyncNet GitHub Wiki

The Http Put request is used to rename [Files] (File) or [Folders] (Folder).

It is a templated method with objects providing the according data to be sent to SugarSync service.

public HttpWebResponse Put<T>(string URL, T data)
public async Task<HttpWebResponse> PutAsync<T>(string url, T data)

The URL is the reference of the

  • [Folder] (Folder) or
  • [File] (File)

to be renamed, whereas the following data types are allowed

  • [FolderRequest] (FolderRequest) to rename a [Folder] (Folder)
  • [File] (File) to rename a [File] (File)

Sample

Rename a Folder

// instantiate SugarSync client
Client client = new Client("API key", "API private", "application Id");

// Login with existing refresh token
client.UserLogin = new UserLogin("refreshToken");

// rename the folder
HttpWebResponse response = await client.PutAsync("folderReference", new FolderRequest {  DisplayName = "new foldername" });

Rename a File

// instantiate SugarSync client
Client client = new Client("API key", "API private", "application Id");

// Login with existing refresh token
client.UserLogin = new UserLogin("refreshToken");

// rename the file
HttpWebResponse response = await client.PutAsync("fileReference", new File {  DisplayName = "new filename" });