IPWorks Cloud 2020 C++ Edition

Questions / Feedback?

UpdateResource Method

Updates a resource.

Syntax

ANSI (Cross Platform)
int UpdateResource(const char* lpszResourceId);

Unicode (Windows)
INT UpdateResource(LPCWSTR lpszResourceId);
- (void)updateResource:(NSString*)resourceId;
#define MID_BOX_UPDATERESOURCE 32

IPWORKSCLOUD_EXTERNAL int IPWORKSCLOUD_CALL IPWorksCloud_Box_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method updates the information for the resource specified by ResourceId. For file resources, the file data can optionally be updated as well.

Usage

There must be an item in the Resource* properties whose ResourceId property matches the given ResourceId parameter 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 Resource* properties.
  2. Modify the item's Resource* properties as desired; the following properties are supported:
  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.
string resId = "f:09876";
box.GetResourceInfo(resId);

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

box.UpdateResource(resId);

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

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