IPWorks Cloud 2020 .NET Edition

Questions / Feedback?

UpdateResource Method

Updates the currently selected resource.

Syntax

public void UpdateResource();
Public Sub UpdateResource()

Remarks

This method updates the metadata for the file or folder resource currently selected by RemoteId or RemotePath. For file resources, the file data can optionally be updated as well.

Usage

There must be a OneDriveResource item in the Resources collection whose Id or Path field matches RemoteId or RemotePath before this method is called.

  1. If necessary, call GetResourceInfo or ListResources to ensure an item with the resource's latest information is present in the Resources collection.
  2. Modify the OneDriveResource item's fields as desired; the following fields are supported: If the ClientCreatedTime and/or ClientModifiedTime configuration settings is non-empty, the corresponding timestamps will be sent as well.
  3. For file resources, you may call SetUploadStream or set LocalFile or ResourceData if you wish to update the file data on the server. (Refer to UploadFile for more information about simple vs. resumable uploads and encrypting the file data before uploading.)
  4. Finally, call this method to update the resource.

// Load the latest information about the resource into the Resources collection.
onedrive.RemotePath = "/folder/CoolStuff1.txt";
onedrive.GetResourceInfo();

// We'll update the file resource's name, description, and content.
onedrive.ResourceData = "new file content";
onedrive.Resources[0].Name = "CoolStuff2.txt";
onedrive.Resources[0].Description = "This is a text file with cool stuff in it";

onedrive.UpdateResource();

Name Conflict Resolution

When updating a resource's name and/or parent, keep in mind that the server's name conflict resolution behavior will follow these steps:
  1. If the RenameIfExists configuration setting is enabled, the server will modify the new name of the resource to be unique, if necessary. Refer to the RenameIfExists configuration setting for more information.
  2. Otherwise, if the Overwrite property is enabled, the server will replace the existing (other) resource with the one being updated.
  3. Otherwise, the server will return an error.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 .NET Edition - Version 20.0 [Build 8265]