getBucketName
Returns the name of the bucket configured for your org. In the case of multi-bucket configuration, it returns the name of the default bucket unless you include a parameter.
This is an optional, supporting piece for anyone making their own direct calls to the storage backend (S3). Most integrations won't need it unless they're bypassing S-Drive's own upload/download flow.
How to call this method
global static String getBucketName()
global static String getBucketName(String objectId, String fileObjectName)
global static String getBucketName(String bucketId)
Three ways to resolve a bucket name, depending on what you already know:
|
Overload |
Use it when... |
|---|---|
|
|
You just want your org's default configured bucket. |
|
|
You already have an existing file record's own Id and its file object type, and want to know which bucket that specific file is stored in. |
|
|
You already have a specific bucket's Id (from a |
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
|
|
Id of the existing file record itself (not its parent record) — e.g. an Account File record's own Id. |
|
|
|
Full API name of the file object, e.g. |
|
|
|
Id of a specific |
Return value
Returns a String — the bucket name.
If your org hasn't configured Multi-Bucket Settings for that file object type, this returns your org's default bucket without ever looking up the file record.
Example
String bucketName = cg.SDriveTools.getBucketName(existingFile.Id, 'cg__AccountFile__c');