---
language: "en"
---
# S-Drive Overview Home

## S-Drive Overview Home

The Overview article provides a brief introduction to S-Drive and its features

### S-Drive Documentation

*

  #### [Overview](https://docs.sdriveapp.com/s-drive-overview/overview.md)

  What is S-Drive? S-Drive is a Salesforce App created by Cyangate. At its core, S-Drive provides a way to store files that you need in Salesforce in a less expe...

---
language: "en"
---
# Overview

## What is S-Drive?

S-Drive is a Salesforce App created by Cyangate.

At its core, S-Drive provides a way to **store files** that you need in Salesforce in a **less expensive, more organized**way than you can with native Salesforce files.

S-Drive stores your files in the**Amazon Web Services (AWS) S3** **cloud storage system** while providing a robust user interface to them from within Salesforce. S-Drive allows you to organize your files inside **folders and subfolders.**

## How S-Drive Works

There are 3 pieces to S-Drive that work together:

1. Your Salesforce org with S-Drive installed

2. Your AWS S3 bucket

3. Your S-Drive Portal Account

This diagram shows how the 3 pieces communicate.  
![sdrive architecture.png](https://docs.sdriveapp.com/__attachments/a_32e9e557805fded8221096efe0139b030cb71a13afc963decb5d2d54a9dbc418/sdrive%20architecture.png?cb=90a5f072d7db4a6b8dcdc184b7a0c17c)

### 1. Salesforce Org

Inside of Salesforce, S-Drive shows you your files and folders. When you upload a file, S-Drive seamlessly stores the file your AWS S3 bucket. When you open a file, S-Drive goes to your AWS S3 bucket and seamlessly retrieves the file.

Here is a Contact record with an S-Drive component on the Contact lightning page. S-Drive files uploaded to a Contact use a custom object called Contact File.  
![image-20230606-210357.png](https://docs.sdriveapp.com/__attachments/a_a96dc99aa77708a9cb86206ac148a5c9208921ce7caffb7406fc7a0ba6d213b8/image-20230606-210357.png?cb=083bf48fccbecb9b623e5db8988f723a)

### 2. AWS Account

To use S-Drive you will set up an AWS Account. **This account belongs to you/your company**. It does not belong to S-Drive/Cyangate. Our Admin Guide will walk you through how to open an account.  
It is important that someone in your organization keep track of this account as well as the **Access Key** and**Secret Key** you'll create in your AWS Account.

The S3 bucket will be in your AWS Account, but it will be created inside Salesforce when you configure S-Drive.

S-Drive files are uploaded to your **Amazon S3 bucket.** S-Drive finds your files using information on **S-Drive File Object records**in your Salesforce org. There is an S-Drive file record for each file. The file record stores metadata, such as file name, file size, type of file, as well as a Key field that tells where the file is in the bucket.

### 3. S-Drive Portal Account

In addition to an AWS account, you'll need to set up an S-Drive Portal Account. This is how we keep track of your orgs and track storage costs. This is where you'll get invoices or statements. Your Salesforce org will "connect" with S-Drive in in the portal, which will then make S-Drive accessible in Salesforce.

Your company should typically have one S-Drive Portal Account that can have a shared login. Multiple SF orgs (production as well as sandboxes) can be connected in one portal account.

## Major Features Overview

S-Drive is loaded with **features** . You can read more about them on our [website](https://www.sdriveapp.com/features/). Here is a simple overview.

### Folder organization

Use folders and subfolders to organize files. Folders can be created manually, or can be created automatically using a trigger or flow.

### Upload Folders

Choose folders full of files on your desktop and upload them while preserving the folder structure

### Zip and Download

When downloading multiple files, S-Drive will automatically zip them into a folder and download them to your local machine. If the files are very large, you can run a zip and download job with the click of a button that will run in the background.

### File Sync

Upload files to Salesforce Files and have them automatically be synched to S-Drive and optionally deleted from Salesforce files to save storage.

### Shortcuts

Create a shortcut of an S-Drive file on another record. For example, have shortcuts from an Opportunity to an Account so that from the Account, you can see the Opportunity's files.

### Preview and Thumbnail

See a thumbnail of your file in the main file list and a preview when clicked on. This allows you to page through a file without downloading it.

### Content Authoring/Online Editing of Microsoft files

With a Microsoft 365 account, you can edit Word, Excel, and PowerPoint files directly in S-Drive without ever leaving your Salesforce org.

### E-Signature

With DocuSign integration, send S-Drive files directly to DocuSign for a signature. Once signed, the files return to S-Drive as a new version.

### File Activities

Track who's accessing files, who they are shared with, when urls are created and more.

### Retention Policy

Set policies to automatically delete files after a certain period of time. This saves on storage and helps comply with legal requirements.

### Public Share

Create a secure link to a document to share it outside of Salesforce. You can also send a link to a folder to request uploads from someone outside of Salesforce.

### Digital Experience/Communities

Allow your customers to access and upload files in your customer Experience site.

### Multiple Bucket support

Create multiple S3 buckets to store files. This can be used for different regions or for different levels of classification or other user. Set up rules to determine which files go to which bucket.

### Docufetch - end-to-end document management

Create a request asking for particular documents to be uploaded and send the request link to a user outside of Salesforce. The link will provide an upload button for each requested document. Requestees can sign documents and Requesters can approve or reject received documents.

---
language: "en"
---
# S-Drive 2.22 Documentation Home

## S-Drive 2.22 Documentation Home

**Release Date:**10/19/2022

**Release Highlights**

E-Signature integration (DocuSign) \~ E-Mail default address \~ Performance Improvements

### S-Drive Documentation

*

  #### [2.22 Release Notes](https://docs.sdriveapp.com/2.22/2-22-release-notes.md)

  Released 10/19/2022 E-Signature integration, Email enhancements, Faster upload
*

  #### [2.22 S-Drive Admin Guide](https://docs.sdriveapp.com/2.22/2-22-s-drive-admin-guide.md)

  Use this guide to configure S-Drive and set up the features you want
*

  #### [2.22 S-Drive Developer Guide](https://docs.sdriveapp.com/2.22/2-22-s-drive-developer-guide.md)

  This guide contains detailed information about S-Drive customization with special APIs and intended for developer use. Refer to the S-Drive Admin Guide and S-D...
*

  #### [User guide for Salesforce Lightning](https://docs.sdriveapp.com/2.22/user-guide-for-salesforce-lightning.md)

  This section includes information about how to use S-Drive in Salesforce Lightning Experience. S-Drive Lightning Component The S-Drive Lightning Component is d...

---
language: "en"
---
# 2.22 Release Notes

Released 10/19/2022

* E-Signature integration,

* Email enhancements,

* Faster upload

## Upgrade Notes

Once this release is downloaded from AppExchange, there are no additional steps to upgrade to this release from the previous release. If you are upgrading from an older release, please refer to [Upgrade Paths.](https://docs.sdriveapp.com/upgrading-s-drive/upgrade-paths.md)

## New Features

### E-Signature Support for DocuSign

With E-Signature, you can send documents out to DocuSign directly from S-Drive and the signed document will be uploaded back to S-Drive.  
![image-20220923-183629.png](https://docs.sdriveapp.com/__attachments/a_0b41973fc89d998a4ae371253ec2ed45ccfb0ca1b81ceaa80687cdd646f0c900/image-20220923-183629.png?cb=40164ee091aa67a16a847ab16cafb34d)

E-Signature solutions other than DocuSign will be supported in the future.

*** ** * ** ***

## Enhancements

### Expanded Default Email Address

When configuring S-Drive Lightning component, you can now use a lookup to specify the default email address. For example, on a Case, you can configure the default email address to be the Case Contact's email.  
![image-20220923-192045.png](https://docs.sdriveapp.com/__attachments/a_63febae381a63ed5eb286b0556eb81503cfa449dccffe71341ad3ac0e0de6163/image-20220923-192045.png?cb=bb542a9407a2336bddb2ac8f8d1cd5bb)

You can also now list more than one email address in a comma separated list  
![image-20220923-192307.png](https://docs.sdriveapp.com/__attachments/a_44fa734a358b7e7f4553dd0a523ecf0cbed5569cf571444206bf0f179b81a6f8/image-20220923-192307.png?cb=d81fb2e3862286c69bed0125e2c00e45)

#### Faster Upload

Processing that takes place before the file begins to upload has been improved, leading to overall improvement the time it takes to upload a file.

#### Faster Loading for S-Drive Configuration Page

S-Drive Configuration Page and some sub-pages (Preview and Thumbnail Configuration, Bucket Folder Configuration) will load faster. Records Management is now on a separate sub-page.  
![image-20221011-152648.png](https://docs.sdriveapp.com/__attachments/a_7e3daceed892cbbfc49523e42b5bbb471332acdf0070b737f968613aa1ffa64f/image-20221011-152648.png?cb=f7f817e095bd9bcc1a92f7734eddc8bd)

#### Sign Up for S-Drive Emails

You may be missing important emails from S-Drive if you are not the person who installed it. Now you can subscribe to our mailing list from your S-Drive Portal Account. You'll receive critical emails about action you may need to take, along with information about new releases and invitations to our webinars. You can sign up as many people in your company as you like. (Please make sure you have their permission.)

In the Portal ([portal.sdriveapp.com](http://portal.sdriveapp.com/)) go to the Account Tab and sign up.  
![image-20221012-172901.png](https://docs.sdriveapp.com/__attachments/a_f6457b52405ec2ba32796fff6c911c3896f71d5d0f2e72ca6be2e53a2d980ad0/image-20221012-172901.png?cb=951b9ee546416f0b2dc9d2a1d6f781e5)

*** ** * ** ***

## Bug Fixes

* Provide error message when accessing a shortcut and the underlying file has been deleted

* Fix thumbnails not showing in mobile

* Fix folder size on compact/mobile views

* Fix file sync not working when file uploaded by guest user

* Fix cleanup when new version upload fails

## Deprecated

## Retired

* MyDrive - the MyDrive toggle button on S-Drive Tab has been removed. If you used MyDrive, the files still exist in your S3 bucket. If you have any concerns, please [Open a Support Ticket.](https://support.sdriveapp.com/)

---
language: "en"
---
# 2.22 S-Drive Admin Guide

Use this guide to configure S-Drive and set up the features you want

This guide will walk Admins through the steps needed to get S-Drive set up. See the [INTRODUCTION](https://docs.sdriveapp.com/2.22/introduction.md) page for what each section contains and choose which sections are relevant for you.

---
language: "en"
---
# 2.22 S-Drive Developer Guide

This guide contains detailed information about S-Drive customization with special APIs and intended for developer use. Refer to the *S-Drive Admin Guide and S-Drive User Guide* for more information about installation/configuration and usage of S-Drive product.

---
language: "en"
---
# abortMultiPartUpload

This method is used to abort a multipart upload.

void abortMultiPartUpload(String awsLocation, String uploadId)

**Parameters:**

**awsLocation:** The name of key to be uploaded as file location. You can get this value from the fileLocation of UploadRequestInfo object.

**uploadId:** The upload Id that you get this Id from the initializeMultipartUpload request as a return value.

**Example code:**

    cg.SDriveTools.abortMultiPartUpload(uploadRequestInfos .fileLocation, uploadId);

---
language: "en"
---
# Add your Custom File Object to the S-Drive File Object List

S-Drive needs to know which custom objects in your org are S-Drive file objects. The out-of-the-box S-Drive file objects (Account File, Contact File, Case File, Opportunity File and Lead File) are automatically on the list. New custom file objects must be added.  
If you don't add your custom file object to the list, not all functionality will work and your files may not be fully accessible.

To add your file object:

* From the App Launcher, go to **S-Drive Configuration**

* Go to the **General Settings** tab

* Scroll down to **File Settings**

* Click "**Configure** " next to Configure S-Drive Objects. You will see a page like this

  ![image-20220127-222832.png](https://docs.sdriveapp.com/__attachments/a_0cbcd225489ddbf71466cb9ae71896b905dcdb60678fcae0c9c73a904b434b45/image-20220127-222832.png?cb=6cf8b0019f3d1ec9076d695a4b7bb8a0)

  * To add File Objects**automatically** , click **Find File Objects**.

    * File Objects will be added to the list.

    * Check to make sure they look correct

    * Click **Go Back** when finished.

  * To add File Objects **manually** , click **Add New Object Configuration.** You'll see the following:

    ![image-20220126-181803.png](/__attachments/a_447a978b2710354dbe7e764a52cb926c94084220f51c514db212fc8350ad03f8/image-20220126-181803.png?cb=06893679ebd466f71d019e00c4481269)
    * Enter the information in the boxes

      * **File Object Prefix**This will usually be blank. The out-of-the-box file objects have a namespace prefix of "cg__" for Cyangate (makers of S-Drive), but your custom file object should not normally have a prefix

      * **File Object Name** The API name of your custom object, such as My_Object_File__c

      * **Parent Object Prefix** Namespace prefix for parent object, which is the object your file object relates to. If your parent object is from a managed package, then it would have a prefix. If you created the custom object yourself, it won't have a prefix.

      * **Parent Object Name** API name of the object your file object looks up to.

      * **Relationship Name** This should be "Parent__c" for custom file objects

    * Click **Save**

---
language: "en"
---
# Advanced Features

This section contains information about the following features:

[S-Actions](https://docs.sdriveapp.com/2.22/s-actions-custom-actions.md) - custom actions for S-Drive files

[Lead Conversion](https://docs.sdriveapp.com/2.22/lead-conversion-with-s-drive-files.md) - copy files to Account, Contact, and/or Opportunity when a lead is converted

[Custom Settings](https://docs.sdriveapp.com/2.22/custom-settings-s-drive-config.md) - fine tune some configuration options by changing custom settings

[File Sync/Attachment Sync](https://docs.sdriveapp.com/2.22/file-sync-attachment-sync.md) - files uploaded to Salesforce can by copied or moved to S-Drive

[S-Drive Reports](https://cyangate.atlassian.net/l/cp/arCxKt1m) - run reports on file objects

[Email "S-Drive Tab" Files from an Object using a Custom Button (Classic)](https://docs.sdriveapp.com/2.22/email-s-drive-tab-files-from-an-object-using-a-cus.md) - easily email S-Drive Tab files from another object

[Public Share using S-URL (short URL)](https://docs.sdriveapp.com/2.22/public-share-using-s-url-short-url.md) - set up short URL and create links to files to share outside of Salesforce

[Creating Custom HTML Upload Page](https://docs.sdriveapp.com/2.22/creating-custom-html-upload-page.md) - upload files using a button at the top of your object page

[Bucket Folders](https://docs.sdriveapp.com/2.22/bucket-folders.md) - create a top-level folder in your AWS bucket to more easily find files directly

[User-defined Metadata](https://docs.sdriveapp.com/2.22/user-defined-metadata.md) - configure metadata to be assigned to uploaded files stored in AWS

[Content Authoring](https://docs.sdriveapp.com/2.22/content-authoring-microsoft-office-integration-pai.md) - edit Microsoft Word, Excel, and PowerPoint files without leaving S-Drive

[Translation](https://docs.sdriveapp.com/2.22/translation.md) - Use Translation Workbench to translate S-Drive

[Wrapping Headings and Setting Column Widths on S-Drive Lightning Component](https://docs.sdriveapp.com/2.22/wrapping-headings-and-setting-column-widths-on-s-d.md) - customize S-Drive columns

[Multi-Bucket Support](https://docs.sdriveapp.com/2.22/multi-bucket-support.md) - use multiple S3 buckets for security and compliance

[S-Drive Email Lightning Component](https://docs.sdriveapp.com/2.22/s-drive-email-lightning-component.md) - use S-Drive email to send files

[S-Drive Upload Standalone Component](https://docs.sdriveapp.com/2.22/s-drive-upload-standalone-component.md) - an upload only option for S-Drive

[S-Drive for File Objects Component](https://docs.sdriveapp.com/2.22/s-drive-for-file-objects-component.md) - access file details, including preview, on file object record

[E-Signature](https://docs.sdriveapp.com/2.22/e-signature.md) - send documents to DocuSign directly from S-Drive and have them returned to S-Drive

---
language: "en"
---
# Amazon S3 Transfer Acceleration (Free on S-Drive)

![image-20220405-203037.png](https://docs.sdriveapp.com/__attachments/a_f556dba458f550314601f03e3d3fb56d8f961bc1f3163df6b32ff193de7e72b7/image-20220405-203037.png?cb=0a23ebbdacaaa84f8afc652841917fb9)

This setting has move to the [S-Drive Authentication And Bucket Settings tab](https://docs.sdriveapp.com/2.22/s-drive-authentication-and-bucket-settings.md). It can be configured on each bucket you use.

**Enable S3 Transfer Acceleration**This configuration is used to enable/disable S3 Transfer Acceleration feature. Amazon S3 Transfer Acceleration is a faster way to move data into your Amazon S3 bucket over the internet. It is designed to maximize transfer speeds when you need to move data over long distances, for instance, across countries, or continents to your Amazon S3 Bucket. Transfer Acceleration takes advantage of Amazon CloudFront's globally distributed edge locations. As the data arrives at an edge location, data is routed to Amazon S3 over an optimized network path.

You might want to use Transfer Acceleration on a bucket for various reasons, including the following:

* You have customers that upload to a centralized bucket from all over the world.

* You transfer gigabytes to terabytes of data on a regular basis across continents.

* You underutilize the available bandwidth over the Internet when uploading to Amazon S3.

When you enable Amazon S3 Transfer Acceleration using S-Drive Configuration Tab, it will also be enabled in Amazon Web Services and you will have a new S3 bucket endpoint in the form "BUCKET_NAME.s3-accelerate.amazonaws.com". Afterwards, S-Drive starts using this endpoint for uploads and downloads. You can see the transfer acceleration at bucket properties, and you can enable/suspend S3 Transfer acceleration using AWS Management Console. But whatever the status is your acceleration endpoint in your bucket, it must be the same in S-Drive. We recommend you, enable/suspend acceleration endpoint only using S-Drive. To see this bucket property, click on S3 service and then click on your bucket name from AWS Console and click on "Properties" tab at top right corner.

When using Transfer Acceleration, **additional charges may apply** for transfer where Transfer Acceleration can potentially improve performance. For more information about pricing, see [Amazon S3 Pricing](http://aws.amazon.com/s3/pricing/). S-Drive won't charge you for this service.

Only HTML Upload Manager supports Amazon S3 Transfer Acceleration. When you enable acceleration endpoint, it will be used for both downloads and uploads in S-Drive. To learn more about S3 Transfer Acceleration, please visit [here](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)++.++

---
language: "en"
---
# Apex Classes, Visualforce Pages, Custom Setting Definitions

When S-Drive is installed from AppExchange for "All Users", **internal custom profiles** as well as the **System Administrator profile** are updated to include access to all Apex Classes, Visualforce Pages, and Custom Setting Definitions. However **standard profiles and external profiles** (those used in partner or customer experiences) are not updated. These profiles should be checked and updated. Alternatively, you can create a Permission Set to enable the necessary classes, pages and definitions and assign it to users who need S-Drive access.

In each external profile and internal standard profile that needs to access S-Drive, or using a permission set:

* Go to Apex Classes and include all classes that start with "cg." Then click Save.

  ![image-20221207-215623.png](https://docs.sdriveapp.com/__attachments/a_4e26272ae958f78c7513b4c17c3eae9c5c6dbb91d9ca27ab0d50c370b719621c/image-20221207-215623.png?cb=b0ad6557ecaec450dce9d29cdc2fef15)

* Go to Visualforce Pages and add all pages that start with "cg." Click Save.

  ![image-20221207-215758.png](https://docs.sdriveapp.com/__attachments/a_c5cd13f0826008f12a688c928b30341814a148502d6d504b5e7740a9136ae059/image-20221207-215758.png?cb=f3d39bdc65c0f8e12217b62a792e07bc)

* Go to Custom Setting Definitions and add all settings that start with "SD[rive.cg."](http://sdrive.cg/) Click Save.

  ![image-20221207-215950.png](https://docs.sdriveapp.com/__attachments/a_27d4c3907e2a9d67f698688e97066fafdcbac371f85a051baf88a4a4ac588355/image-20221207-215950.png?cb=04cce68919b3750f2d9a963b2614313a)

---
language: "en"
---
# Authentication

Authentication for REST services deployed on Salesforce are done with OAuth 2.0 You may find Salesforce's documentation on using OAuth 2.0 for Salesforce authentication [here.](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/quickstart_oauth.htm)

To establish an authenticated connection to an outside app you would have to first create a "connected app" on Salesforce and get the Client Id and the Client Secret token. To find Salesforce's detailed documentation on connected apps you may go [here.](https://help.salesforce.com/articleView?id=connected_app_overview.htm&type=5)

Authentication is always included in the header.

---
language: "en"
---
# Automatic Folder Creation

If you want to build an automatic folder creation process in S-Drive for any type of object you have when you insert a new record, please refer to this section. We will use Account and cg_*AccountFile*_c object for our example.

1. For the object you have, create an Apex Trigger.

2. If you want this folder creation to take place after you create a new record, the trigger should work with an "after insert" statement.

3. In the Apex Trigger, paste the following lines:

       trigger AccountFoldersTrigger on Account (after insert) {
       List<cg__AccountFile__c> folders = new List<cg__AccountFile__c>();
       for(Account c : Trigger.new{
         cg__AccountFile__c folder = new cg__AccountFile__c();
         folder.cg__WIP__c = false;
         folder.cg__Content_Type__c = 'Folder';
         folder.cg__File_Size_in_Bytes__c = 0;
         folder.cg__File_Name__c = 'Test Folder 1';
         folder.cg__Description__c = 'Some description for folder'; //use
         a description field if needed.
         folder.cg__Account__c = c.Id;
         folders.add(folder);
         
         cg__AccountFile__c folder2 = new cg__AccountFile__c();
         folder2.cg__WIP__c = false;
         folder2.cg__Content_Type__c = 'Folder';
         folder2.cg__File_Size_in_Bytes__c = 0;
         folder2.cg__File_Name__c = 'Test Folder 2'; //use name as
         appropriate
         folder2.cg__Description__c = 'Some description for folder'; //use a
         description field if needed.
         folder2.cg__Account__c = c.Id;
         folders.add(folder2);
         
         if(folders.size() > 0){
         insert folders;
         }
       }

4. Add up to your requirement the number of folders created.

5. Change the Folder Names by changing the "File Name" section.

   For our example, the field is written as "cg__File_Name__c".

6. You can add descriptions to your folders by changing the "Description" field.

   For our example, the field is written as "cg__Description__c".

7. Make sure your Apex Trigger is active.

8. Test by inserting a new test record and you can use these folders according to your needs

---
language: "en"
---
# Branding a Public Share Site

To style and use your branding colors in the S-URL site -- (The visualforce page that is the Active Site Home Page -- cg.SURLRedirect.page), you can follow these steps.

1. Create a CSS stylesheet in .css format and upload it as a static resource to Salesforce. You can name it as "sdrivecustom.css". You can upload a static resource from Setup \> Static Resources \> New. The stylesheet should be in the following format.

       body {
       background: url('https://www.cyangate.com/wp-content/uploads/2015/02/bgSlider.jpg') !important;
       }

       #SDrive {
       position: absolute !important;
       width: calc(100% - 38px) !important;
       bottom: 0 !important;
       }

       #SDrive .slogan {
       color: #192B55 !important;
       }

       .sdrive-btn {
       border-radius: 5px !important;
       background-color: #192B55 !important;
       border: 1px solid #314472 !important;
       }

       .sdrive-btn:hover {
       background-color: #314472 !important;
       }

       .cgToolbar .slds-button{
       background-color: #64C8CB !important;
       color: white !important;
       border: 1px solid #64C8CB !important;
       }

       .slds-scope .slds-button_icon-border-filled[disabled], .slds-scope .slds-button_icon-border-filled:disabled{
       background-color: #96c5c7 !important;
       }

       #SDriveCmp{
       background-color: #a0a0a0 !important;
       border: 1px solid #314472 !important;
       }

       #SDriveCmp .slds-box{
       border: 1px solid #314472 !important;
       }

       #global-search-01{
       background: #D3D3D3;
       border: 2px solid #314472;
       }

       .cgSDrive .sd-search-btn.slds-input__icon{
       border-radius: 2px !important;
       width: 34px !important;
       top: 2px !important;
       height: 29px !important;
       color: #314472 !important;
       }

       .file-list-table{
       background-color: #D3D3D3 !important;
       }
       .slds-scope .slds-table:not(.slds-no-row-hover) tbody tr:hover > td{
       background-color:#e0e0e0 !important;
       }

       .slds-scope .slds-button_icon-border-filled{
       background-color: #64C8CB !important;
       }

       .community-toolbar{
       background-color: #192B55 !important;
       }

       .cgActions lightning-primitive-icon{
       color:#fff;
       }

       .pass-container{
       background-color: #192B55 !important;
       color: white !important;
       border: 1px solid #64C8CB !important;
       }

       .pass-container input[type='password']{
       background-color: #D3D3D3 !important;
       border-radius: 2px !important;
       }

       .pass-container input[type='submit']{
       background: #64C8CB !important;
       border: 1px solid #959595 !important;
       font-size: 1em !important;

   **Note: It is required that you set your stylings as "!important", in order to override the styles of regular S-URL page.**

   Use the following styles for the following scenarios to change:

   * The background color or image of the page: Line 2

   * The width or position of the card or hide the card at the bottom of the page: Lines 5-8

   * The colors of the slogan: : Lines 11-12

   * The button styles and button hover colors: Lines 21- 22

   * The S-Drive Toolbar buttons: Lines 25-29

   * The S-Drive component's colors: Line 31-32

   * The S-Drive component's background color: Lines 35-37

   * The search-bar colors and style: Lines 44-55

   * The background color of the S-Drive file-list: Lines 57-58

   * The S-Drive toolbar color: Lines 68-69

   * The colors of action menu items and quick actions: Lines 72-73

   * The password pop-up style: Line 76-90

   You can set the Cache Control as public when you upload the static resource.

   ![image-20210518-161125.png](https://docs.sdriveapp.com/__attachments/a_4e6d0b65423ff3341e8e746112a0fe9778f5b8976f58c7f42869d5af5417517c/image-20210518-161125.png?cb=183580843828c246333c420df2815094)
2. Create a Javascript script in .js format and upload it as a static resource to format the

   following sections in the S-URL page. You can name it as "sdrivecustomscript.js". You

   can upload a static resource from Setup \> Static Resources \> New.

   ![image-20210518-161036.png](https://docs.sdriveapp.com/__attachments/a_21490d7ceb6720bddb5d47994735757969c1730592c2192f60847122c53a6931/image-20210518-161036.png?cb=f19f80c02da02069971ca2811e9771c7)

       window.addEventListener('load', function () {
       setSDriveComponentTitle();
       setDriveComponentBrandLogo();
       setSurlPageSlogan();
       setSurlPageSloganUrl();
       setSurlPageButton1();
       setSurlPageButton2();
       setSurlPageBrandLogo();
       setSurlPageBrandLogoUrl();
       });

       function setSDriveComponentTitle(){
       var element = document.querySelector("span[title='S-Drive ']");
       if(!element){
       setTimeout(function(){
       setSDriveComponentTitle();
       },200);
       }
       else{
       element.innerHTML = 'CyanGate S-Drive';
       }
       }

       function setDriveComponentBrandLogo(){
       var element = document.querySelector("img[title='S-Drive']");
       if(!element){
       setTimeout(function(){
       setDriveComponentBrandLogo();
       },200);
       }
       else{
       element.setAttribute('src', 'https://www.cyangate.com/wp-content/uploads/2019/10/cyangate_logo.png');
       }
       }

       function setSurlPageSlogan(){
       var element = document.querySelector("span[class='slogan']");
       if(!element){
       setTimeout(function(){
       setSurlPageSlogan();
       },200);
       }
       else{
       element.innerHTML = 'CyanGate Storage';
       }
       }

       function setSurlPageSloganUrl(){
       var element = document.querySelector("a[id='slogan-url']");
       if(!element){
       setTimeout(function(){
       setSurlPageSloganUrl();
       },200);
       }
       else{
       element.innerHTML = 'CyanGate.com';
       element.setAttribute('href', 'https://www.cyangate.com/');
       }
       }

       function setSurlPageButton1(){
       var element = document.querySelector("a[id='surl-button-1']");
       if(!element){
       setTimeout(function(){
       setSurlPageButton1();
       },200);
       }
       else{
       element.innerHTML = 'BUTTON 1';
       element.setAttribute('href', 'https://www.cyangate.com/');
       }
       }

       function setSurlPageButton2(){
       var element = document.querySelector("a[id='surl-button-2']");
       if(!element){
       setTimeout(function(){
       setSurlPageButton2();
       },200);
       }
       else{
       element.innerHTML = 'BUTTON 2';
       element.setAttribute('href', 'https://www.sdriveapp.com/');
       }
       }

       function setSurlPageBrandLogo(){
       var element = document.querySelector("img[id='surl-brand-logo']");
       if(!element){
       setTimeout(function(){
       setSurlPageBrandLogo();
       },200);
       }
       else{
       element.setAttribute('src', 'https://www.cyangate.com/wp-content/uploads/2019/10/cyangate_logo.png');
       }
       }

       function setSurlPageBrandLogoUrl(){
       var element = document.querySelector("a[id='surl-brand-url']");
       if(!element){
       setTimeout(function(){
       setSurlPageBrandLogoUrl();
       },200);
       }
       else{
       element.setAttribute('href', 'https://www.cyangate.com/');
       }
       }

   You can set the Cache Control as **public** when you upload the static resource.

   ![image-20210518-160945.png](https://docs.sdriveapp.com/__attachments/a_ee18f08ed1639179677cdeacef935e3135541e93631f2f06cdf1a7fccde1a96f/image-20210518-160945.png?cb=afb091e8f26c8b9fa07dbe2662064b45)
3. Click on "View File" link in the Static resources page and copy the URLs for both

   resources from the browser starting with "/resource"

   ![image-20210518-160928.png](https://docs.sdriveapp.com/__attachments/a_8728675ce31621a87eeb1068576f4f27c8272565510d5886a5b2dd3cad79f651/image-20210518-160928.png?cb=695a1c3b44937e63f9c870785007040d)
4. Navigate to S-Drive Configuration page and click on "Micro Services" tab and paste the

   URLs for the custom style sheet and the custom script that you installed as a static

   resource, respectively.

5. Copy the Base URL from the first box and prepend it to the "/resource...." in the custom

   boxes as shown.

   ![image-20210518-160908.png](https://docs.sdriveapp.com/__attachments/a_b8b46dfabcb8b8cc5a34927e70fb5c128542e812d921fe271560a0e2c10ca534/image-20210518-160908.png?cb=85831aea765f8e70df035965a2497805)
6. The S-URL page will look like the following screenshot when the example css and js

   changes are applied.

   ![image-20210518-160856.png](https://docs.sdriveapp.com/__attachments/a_d8a0027b139e70d8d87fc807bdaf9d5ee086e6442e571dc71ce339c4b005b605/image-20210518-160856.png?cb=5537871f53f7e210dcd6bd396d39a650)

---
language: "en"
---
# Bucket Folders

## Overview

Bucket Folders allow you to define where files are stored in your AWS bucket.

S-Drive files are stored in AWS using a folder path that, by default, contains the parent object record id (such as the Account record id) as the top level folder, as shown here.  
![image-20210730-195316.png](https://docs.sdriveapp.com/__attachments/a_0f6724d1e9f206b99feaf73f5a111cef70746da66251134064e62ee13c1c88d7/image-20210730-195316.png?cb=fa6cc6619006d67aabf35627834a9bac)

Most users only interact with S-Drive files using the S-Drive user interface, so the location of files in AWS is not important. However if you want to see your files in the AWS bucket, it can be difficult to find them because of the way they're stored.

Using a**Bucket Folder** makes seeing and organizing your files in AWS easier by allowing you to define the top folder of the path, as shown below.

![image-20210730-195626.png](https://docs.sdriveapp.com/__attachments/a_4a044bc10e7bcab47d0e77923484379631d02c7ddb5ee59fb69043ee0296bf05/image-20210730-195626.png?cb=571fb04cde27e181789f112760449155)

Bucket Folders are very flexible. You can configure them as a text field, number field, picklist, even a formula field.

## Setting up Bucket Folder

Setting up a Bucket Folder has two steps:

1. Create a field on the parent object to define the Bucket Folder.

2. Specify that field in S-Drive Configuration.

### Creating a Bucket Folder field

The Bucket Folder field is defined on the file object's parent. For example, for Account File, you must create a bucket folder field on Account. The exception is S-Drive Tab (S3Object), which we'll get into below. We'll use Account Files as an example here.

* Go to Setup-\>Object Manager-\>Account

* Go to Fields and Relationships

* Click New to create a new field

* Choose what type of field it is, such as Text, Formula, Picklist.

* Give your field a name (ex: Bucket Folder)

* You can choose a default value if you wish, or you can choose to populate the Bucket Folder field on each account you create

* Once you've finished, click Save

### Configuring Bucket Folder

* Go to S-Drive Configuration General Settings Tab

* Scroll down to Upload Settings.

* Next to Configure Bucket Folder, click Configure.

  ![image-20210730-190613.png](https://docs.sdriveapp.com/__attachments/a_05bf5d35756d13c4d4ff37fe476700c7fb57a623d71bd012634834cbfc98468d/image-20210730-190613.png?cb=71d051d8bffe0d68acd245091ab392cb)
* This will open the following page:

  ![image-20210730-190740.png](https://docs.sdriveapp.com/__attachments/a_d3825b59b989e1413b51971afc133f92e21acd14bc053b0485b51c6b5234a14b/image-20210730-190740.png?cb=120b86aa38ec6ca07087ce4bd8be2a62)
* The Bucket Folder Field is the field you created above. Fill in the field name and click the "Enabled" checkbox.

* Click Save

Once defined, the Bucket Folder field needs to be populated. This can be done in various ways:

* Setting the Bucket Folder field to a default value

* Filling in the Bucket Folder field manually when a new parent record is created

* Using automation to fill in the Bucket Folder value

* Defining the Bucket Folder field as a formula field, which will automatically populate on the parent record.

Now when you upload files, they will show in the bucket with the top level folder your specified.

---
language: "en"
---
# cancelUpload ()

This method is used to cancel attachment upload operation.

List\<ResultObject\> cancelUpload(List\<ID\> wipIds, String objectId)

***Parameters:***

**wipIds:** List of [Salesforce.com](http://salesforce.com/) IDs of attachment "file" records.

**objectId:** Id of the parent object. You can use 15-character or 18-character [Salesforce.com](http://salesforce.com/) ID.

***Return Value:*** The method will return a list of ResultObject (Figure 127) which holds cancel status information for each file record.

*Example code:*

    List<Id>wipIds = new List<Id>();
    wipIds.add(ID.valueOf(uploadRequestInfos .fileWipId));
    List<cg.ResultObject>resultObjects = cg.SDriveTools.cancelUpload(wipIds, objectId);

---
language: "en"
---
# Classic Override Page for S-Drive

In order to display S-Drive files in Classic, you need to create a custom object file's Visualforce page. This page can be used to override the object's view, or it also can be used as an inline section for the object's layout. At the end of this section, use cases for both scenarios will be displayed.

To create an object file page, follow these steps:

1. Go to **Setup \> App Setup -\> Develop\> Pages** and click the **New** button at the top of the page

2. In the "**Page Edit** " screen you'll create your new page. Give an appropriate name to your page. For our example, we will use "MyExamplePage". Type "MyExamplePage" inside Label field (a). Type "MyExamplePage" inside Name field (b).

   ![image-20210513-201155.png](https://docs.sdriveapp.com/__attachments/a_f1d409b2f0e2f3bb5b75cd7ee9b20cfe18588d326eb12b8b521919cd8976ee96/image-20210513-201155.png?cb=afe7e67eab0a8d656cc12659c80ca226)
3. You need to set the "[Salesforce.com](http://salesforce.com/) API" version to 22.0 or above to use S-Drive 2.0 features. To set the version number click the "Version Settings" tab next to the "Visualforce Markup" tab and change the version number from drop- down.

   ![image-20210513-201523.png](https://docs.sdriveapp.com/__attachments/a_c7494f6ed22b44a31c41011e6c38354bff48b320e2efae25135a93110b39acee/image-20210513-201523.png?cb=346f1092df7bb78162ca76ce28958aa3)

4. In the Visualforce Markup, add the following code. The [attributes](https://docs.sdriveapp.com/2.22/classic-override-page-for-s-drive.md#Attributes) are explained at the bottom of this page.

       <apex:page standardController="My_Example_Object_c" tabStyle="My_Example_Object_c">
       <cg:AttachmentComponent
       title="My Example Object Files"
       customObjectName="My_Example_Object__c"
       customObjectFileName="My_Example_Object_File__c"
       objectId="{!Id}"
       objectNamespacePrefix="mynamespaceprefix__"
       fileNamespacePrefix="mynamespaceprefix __"
       enableCopyURL="true/false"
       enableDelete="true/false"
       enableDownload="true/false"
       enableEdit="true/false"
       enableEmail="true/false"
       enableUpload="true/false"
       enableChatter="true/false"
       inline="true/false"
       inlineEdit="true/false"
       legacyIdSupport="true/false"
       privateEnabled="true/false"
       orderBy="File_Name__c"
       allowedFileExtensions =".avi;.txt"
       defaultEmailAddress="user@company.com"
       enableAttachFromSDriveFolders="true/false"
       enableFolders="true/false"
       relationshipName="Parent__r"
       pageSize="100"
       useUploadAsPopup="true/false" />
       </apex:page>

   Click Save.

5. Set the security for your page on other profiles. Go to **Setup -\> App Setup -\> Develop -\> Pages** and click **Security** link next to your page name

Move all profiles (or select based on your needs) from "Available Profiles" to "Enabled Profiles" as shown If you skip this step, your users that belong to the disabled profiles will see an "insufficient privileges" error page.  
![image-20210513-210640.png](https://docs.sdriveapp.com/__attachments/a_ac46083e85ce7adfc2f251850feb74999540d9035ee3930ec83203e4c7d0c412/image-20210513-210640.png?cb=17979317910ec02e8866c59b145cbd7e)

At this point, we can [override](https://docs.sdriveapp.com/2.22/classic-override-page-for-s-drive.md#override) the custom object's view or we can use S-Drive Attachments as an [inline section](https://docs.sdriveapp.com/2.22/classic-override-page-for-s-drive.md#inline) in the page layout.

## Overriding the View of the Object

"Overriding the view of the object" means that the page will be used as an override to the standard object page. In this case, the S-Drive Attachments section will be a section at the end of the standard page layout.

1. Go to **Setup \> App Setup -\> Create\> Object** and click the label of your custom object. You'll see "Object Definition Detail" screen. Scroll down and find **"Standard Buttons and Links"** page block and click **Edit** action next to the **View** label (Figure 714-a). Then select **Visualforce Page** for *Override With* section and pick **MyExampleFilePage** (the custom page you created previously for this object) from the drop-down box. Click **Save** button to complete the override (Figure 7 14-b).

   ![image-20210513-211909.png](https://docs.sdriveapp.com/__attachments/a_a9eef209eca6b031d3e57a85bcd2e972eb43f9207cd9f5c808861af2c5829119/image-20210513-211909.png?cb=59c9b418ad7d7beda3caf3524f6c7bab)

2. Now it will display **View** as **Overridden** in the *Standard Buttons and Links* section

   ![image-20210513-211941.png](https://docs.sdriveapp.com/__attachments/a_41d19d52b10530911bd9affa354797c2183c099392edf00ccfd46a897a914a82/image-20210513-211941.png?cb=d5fb7fc89defdc163094c221c0dae1f4)

3. After creating a test object, you should see "My Example Object Files" page block at the end of the object detail page (Figure 716). See "User Guide" for more information on how to use the buttons and functions in this page block.

   ![image-20210513-212130.png](https://docs.sdriveapp.com/__attachments/a_4913f9592d3bfd430ab500641b8f2093d4da03120b44ee7234cf1abc556f71a6/image-20210513-212130.png?cb=9e3d62c3a2dd4f7eaf37271ff14b57d6)

## Using as Inline Attachment

"Using as inline Attachment" means that the attachment component will be used as a section in the object's page layout. So, your customizations to the page layout won't be affected and you can append S-Drive Attachments in the page layout anywhere you would like. *Please note that "inline" component attribute for the custom page must be set to* ***"true"*** *to use the S-Drive Attachments as inline.*

1. Go to **Setup \> App Setup -\> Create\> Object** and click the label of your custom object. You'll see "Object Definition Detail" screen. Scroll down and find **"Page Layouts"** page block and click **Edit** action next to the main layout of the object

   ![image-20210513-212304.png](https://docs.sdriveapp.com/__attachments/a_3f3173f4acdb8b32f91590dd6d8bd7b4c5aa399824cea0c6dbcf05ae3375edae/image-20210513-212304.png?cb=de8c2dc6300f5c98a76b6fae5ab177e2)
2. Click Fields and drag-drop a **Section** to an appropriate place in the layout

   ![image-20210513-212329.png](https://docs.sdriveapp.com/__attachments/a_8520ce1eeb879fc7e1efc0c167df83e97711a4eb4710c9d90d8b0c551ffce590/image-20210513-212329.png?cb=a936e1015dd0c9da609e507155ffac68)

3. After dropping the "section", you'll see the properties screen for the dropped "section". Type in a section name and select if you want to display section header on *"Detail Page"* and *"Edit Page"* . Also select *"1-Column"* for the layout. Then click OK button. You can customize these settings based on your layout needs

4. Now, go to **Visualforce Pages** from the top. Select the "custom page name" you created (e.g. TestPage) and drag it into the section that you created previously

   ![image-20210513-212958.png](https://docs.sdriveapp.com/__attachments/a_6c11c3d7e485faf6f861558be350cfeeda321dd72cc262f47d6c9010123f5056/image-20210513-212958.png?cb=f70db1700e5e988a6d8221a705496ef1)
5. fter dropping the page into the section, click the properties icon for the page on the top-right corner of the page in the section

   ![image-20210513-213024.png](https://docs.sdriveapp.com/__attachments/a_063a5070ac69c69b43e30fbfeccc130120ca39bba9611fbadd7070e7ca3e7ebc/image-20210513-213024.png?cb=3908e1481b712a77956d2b5101048198)
6. Keep **"Width (in pixels or %)"** as **"100%"** , set **"Height (in pixels)"** to **"500"** . And check **"Show scrollbars"** option. You can optionally check **"Show label"** . Click OK button

   ![image-20210513-213056.png](https://docs.sdriveapp.com/__attachments/a_0214b6254cf69b775823059a859e84b885d23d89e87c55e9001ee4d86183d262/image-20210513-213056.png?cb=058e5f07700a9385afaac3243f5bbb6e)
7. You can use "Inline Visualforce Expander" tool to automatically resize inline S-Drive page based on the size. So if you apply this tool to inline S-Drive Attachments page, page's height will be dynamic based on the number of items in the list. For this type of a configuration we suggest you to set the **"useUploadAsPopup"** attachment component property to set "true". You can install the "Inline Visualforce Expander" from AppExchange: <http://appexchange.salesforce.com/listingDetail?listingId=a0N30000004cEEyEAM>

8. Save the layout by clicking the "Save" button on the left-top corner of the screen

9. Now if you go to your object's tab (page), you'll see the S-Drive Attachments inline in the page layout

*** ** * ** ***

### Component Attributes

**standardController** You need to set this standard controller to the object that you want to use with. For our example this is the custom object name that we created: "My_Example_Object_*c". As you can see from the example we appended "c" to the end of the name. This means this object is a custom object. You can use standard objects also. For standard objects you will not append "*_c" at the end of the object name (e.g. Solution). Also, do not prepend your account's namespace prefix.

**tabStyle** This is the tab style of the page. Normally you can set it same with standardController. That means tab style will be derived from the standard controller you chose.

**title (optional)**This is the title of the page block inside the object page. You can set it to "Custom Object Name" Files. For our example it will be "My Example Object Files". This field is optional and if you don't provide a value for this field, it will be set as "Attached Files".

**customObjectName** This is the name of the custom or standard object that will be the object that the files will be attached to. For our example, it is "My_Example_Object_*c". If this is a custom object you need to append "c" to the end of the name. If this is a standard object you won't append "*_c" at the end of the object name (eg. Solution). Also do not prepend your account's namespace prefix.

**customObjectFileName**This is the name of the S-Drive file object that we created in previous sections. This object holds the information regarding the attached files. For our example, it is "My_Example_Object_File__c".

**objectId** You need to pass in the "**{!Id}**" value for this attribute. This attribute is required to retrieve object id.

**objectNamespacePrefix (optional)** This is the object's namespace prefix that your [Salesforce.com](http://salesforce.com/) organization uses. If your organization has a namespace prefix and you created this custom object inside your organization, your object namespace prefix is same as your organization namespace prefix. If this object belongs to a managed package, you need to use that managed package's namespace prefix. If your object does not belong to any namespace you do not need to set this attribute. If your namespace prefix is "exampleprefix" you need to set objectNamespacePrefix as "exampleprefix__".

**fileNamespacePrefix (optional)** This is the file object's namespace prefix that your [Salesforce.com](http://salesforce.com/) organization uses. If your organization has a namespace prefix and you created this custom object file inside this organization, your file namespace prefix is same with your organization namespace prefix. If this file object belongs to a managed package, you need to use that managed package's namespace prefix. If your file object does not belong to any namespace you do not need to set this attribute. If your namespace prefix is "exampleprefix" you need to set fileNamespacePrefix as "exampleprefix__".

**enableCopyURL (optional)** This option is used to enable/disable "Copy URL" link in the page. There are two possible values for this attribute: **"true", "false"**. If "false" is set "Copy URL" links won't be displayed in this page. This field is optional and if you don't provide a value for this field, it will be set as "true", therefore "Copy URL" link will be visible for each asset. Note that security and permission set

**enableDelete (optional)** This option is used to enable/disable "Del" links for all attachments in the page and "Delete Selected" button for the whole page. There are two possible values for this attribute: **"true", "false"**. If "false" is set "Del" links and "Delete Selected" button won't be displayed in this page. This field is optional and if you don't provide a value for this field, it will be set as "true" therefore, "Del" links and "Delete Selected" button will be visible. Note that security and permission settings override this option.

**enableDownload (optional)** This option is used to enable/disable "Download", "Open" and "Zip \& Download" for all attachments in the page. There are two possible values for this attribute: **"true", "false"**. If "false" is set "Download", "Open" and "Zip \& Download" won't be displayed in this page. This field is optional and if you don't provide a value for this field, it will be set as "true" therefore, "Download", "Open" and "Zip \& Download" links will be visible for each asset. Note that security and permission settings override this option.

**enableEdit (optional)** This option is used to enable/disable "Edit" link for all attachments in the page. There are two possible values for this attribute: **"true", "false"**. If "false" is set "Edit" links won't be displayed in this page. This field is optional and if you don't provide a value for this field, it will be set as "true" therefore, "Edit" links will be visible for each asset. Note that security and permission settings override this option.

**enableEmail (optional)** This option is used to enable/disable "Email Selected" button in the page. There are two possible values for this attribute: **"true", "false"**. If "false" is set "Email Selected" button won't be displayed in this page. This field is optional and if you don't provide a value for this field, it will be set as "true", therefore "Email Selected" button will be visible for each asset. Note that security and permission settings override this option.

**enableUpload (optional)** This option is used to enable/disable "Upload File(s)" button in the page. There are two possible values for this attribute: **"true", "false"**. If "false" is set "Upload File(s)" button won't be displayed in this page. This field is optional and if you don't provide a value for this field, it will be set as "true", therefore "Upload File(s)" button will be visible for each asset. Note that security and permission settings override this option.

**enableChatter (optional)** This option is used to enable/disable Chatter related activities for files. There are two possible values for this attribute: **"true", "false"**. If "false" is set, "Post to Chatter" and Chatter Feed won't be displayed in the page. This field is optional and if you don't provide a value for this field, it will be set as "true", therefore the "Post to Chatter" button and Chatter Feed in the details page will be displayed for each asset. Note that security and permission settings override this option.

**inline (optional)** This option is used to decide if the page is used with override for the view or as a section in the page layout. There are two possible values for this attribute: **"true", "false"** . Set this attribute to "true" to use this component inside an inline Visualforce page. The default for this attribute is false. One important note about "inline" is it needs to be set to true for "*typical custom override Visualforce page with inline edits and chatter enabled* " example

because of a bug related to [Salesforce.com](http://salesforce.com/).

**inlineEdit (optional)** This option is used to decide if the inline edit feature will be available for the other parts of the page or not. If inline option is set to true, inlineEdit option is ignored, meaning that inlineEdit feature can only be used when the view of the object is overridden. So, you cannot use this option with the use as inline attachment feature. Set this attribute to "true" to enable the inlineEdit feature for the Visualforce page. Also note that this feature is supported for the pages with version 21.0 and above (Spring 2011). The default for this attribute is false.

There are three possible scenarios for the usage of the inlineEdit:

If *inline is set to true* (using inline attachment feature), *inlineEdit's value does not have any meaning* (it is ignored).

If *inline is set to false* (default is false, using with the override for the view of the object), and we set *inlineEdit to true* , it means *inline editing for the page elements is enabled*.

If *inline is set to false* (default is false, using with the override for the view of the object), and we set *inlineEdit to false* , it means *inline editing for the page elements is disabled*.

**legacyIdSupport (optional)** This option is used for legacy id support. There are two possible values for this attribute: **"true", "false"**. Set this attribute to true to use 18-character ids. The default for this attribute is false.

**privateEnabled (optional)** This option is used for enabling public/private file access to the S-Drive attachments and commonly used to limit the customer portal users' access to individual files. Before setting this property, you need to add a new field to your custom object file named 'Private' (See 'Creating Custom Object Files' section for more information). Set this attribute to true if you want to enable private/public flag. Setting the private flag on a file hides the file from customer portal users. There are two possible values for this attribute: **"true", "false"** . The default for this attribute is "false" except for the Case Files custom page.

**orderBy (optional)** This option is used to order/sort S-Drive attachments based on a field. You need to set the name of the field that should be used to order the list of files with namespace prefix. This attribute is optional and leaving this empty will not order the results in any specific order. For example: "cg_*File_Name* _c". Note that Salesforce does not allow Long Text Area fields to be ordered/sorted. So, if you want to order/sort by a long text are field (e.g. Description__c), you need to change its type from 'Long Text Area' to 'Text Area'. This will limit your description to be 255 characters long.

**allowedFileExtensions (optional)** You can use this option if you want to limit the file types to be uploaded into selected object's S-Drive attachments. Semicolon separated list of file extensions that are allowed to upload. This attribute is optional and leaving this empty will allow all kind of files to be uploaded. For example: "**.jpg;** .txt" will limit the files to be uploaded to jpg and txt files.

**defaultEmailAddress (optional)** You can use this option, if you want to set a default "TO" email address for sending emails from your S-Drive Attachments. This option is automatically set for out of the box Contact, Opportunity, Case and Account S-Drive Attachments.

For example, if you select a Contact S-Drive Attachment for a contact and click "Email Selected" button, "Email Files" screen will be opened and "To..." field will be filled with the contact name.

**enableAttachFromSDriveFolders (optional)** This option is used to enable/disable "Attach from S-Drive Folders" button in the page. There are two possible values for this attribute: **"true", "false"** . If "false" is set "Attach from S-Drive Folders" button won't be displayed in this page. This field is optional and if you don't provide a value for this field, it will be set as "true"; therefore "Attach from S-Drive Folders" button will be visible for each asset. Note that security and permission settings override this option. Also note that "Attach from S-Drive Folders" button is not visible for customer portal users, no matter what the *enableAttachFromSDriveFolders* value is.

**enableFolders (optional)** This option is used to enable/disable folders support for S-Drive Attachments. Set this attribute to false to disable folders. If you disable folders for S-Drive Attachments, "New Folder" button and breadcrumb will be removed from the buttons section. This

configuration won't hide/delete currently created folders. The default for this attribute is true.

**relationshipName (optional)**Master-detail relation used for selected standard/custom object. This attribute is optional and default value is 'Parent__r'.

**pageSize (optional)**Page size for pagination. Attachment items will be paginated based on this value. So, if this value is set to '30', and object has 91 total items, 4 page will be displayed. This attribute is optional and default value is 100.

**useUploadAsPopup (optional)** Set this attribute to true to enable drag and drop functionality and upload widget as a popup window for selected S-Drive Attachment object. The default for this attribute is false. This value overrides the "Default Upload Manager" configuration in "S-Drive Configuration".

f you want to get more information about component attributes, you can click "**Component References** " button and find **cg:attachmentcomponent** reference from the list.

---
language: "en"
---
# completeMultiPartUpload

This method is used to complete a multipart.

String completeMultiPartUpload(String awsLocation, String uploadId, List\<String\> eTagList)

***Parameters:***

**awsLocation:** The name of key to be uploaded as file location. You can get this value from the fileLocation of UploadRequestInfo object.

**uploadId:** The upload Id that you get this Id from the initializeMultipartUpload request as a return value.

**eTagList:** List of Etags. You can get Etags by copyPartMultiPart requests.

***Return Value:*** The method will return the ETag as a String.

*Example code:*

String ETag = cg.SDriveTools.completeMultiPartUpload(**uploadRequestInfos** .fileLocation, **uploadId** , **eTagList**);

---
language: "en"
---
# completeUpload()

This method is used to complete attachments upload once the files have been uploaded to Amazon S3.

List\<ResultObject\> completeUpload(List\<ID\> wipIds)

***Parameters:***

**wipIds:** List of Salesforce ids for attachment "file" records. These IDs have been returned from the initializeUpload() method for each file record.

**versionIds(Optional):** List of AWS S3 versionIds ids for the attachment "file" record. These versionIds have been returned from the `x-amz-version-id` field from the AWS REST API response Headers. The array should match the order of of wipIds.

attachment "file" records. These IDs have been returned from the initializeUpload() method for each file record.

***Return Value:*** The method will return the list of Result Object (Figure 127), which holds filecompletion status information.

Notes:

1. If you want to confirm that file(s) are successfully uploaded to Amazon, you can use the *getAmazonHeader()* method to get headers which is returned by Amazon S3 for a given file*.* You can also compare the *ETag* header, the MD5 checksum calculated by Amazon when the file is uploaded to S3, with the MD5 that you calculate for the file(s).

2. If you set the success{_}*action_status* to *201* status code during the upload process, you can also use XML document which is returned by Amazon S3 to compare *ETag* header with MD5 check sum.

*Example code:*

    List<Id>wipIds = new List<Id>();
    wipIds.add(ID.valueOf(uploadRequestInfos .fileWipId));
    List<cg.ResultObject>resultObjects = cg.SDriveTools.completeUpload(wipIds);

**With VersionIds.**

Assume you have a method `uploadToS3` that uses `uploadRequestInfos` as a parameter and returns a RestResponse object.

    List<Id>wipIds = new List<Id>();
    wipIds.add(ID.valueOf(uploadRequestInfos.fileWipId));
    RestResponse restResponse = uploadToS3(uploadRequestInfos);
    Map<String, String> headers = restResponse.getHeaders();
    String versionId = headers.get('x-amz-version-id');
    List<String> versionIds = new List<String>();
    versionIds.add(versionId);
    List<cg.ResultObject>resultObjects = cg.SDriveTools.completeUpload(wipIds, versionIds);

---
language: "en"
---
# Configuring Custom S-Drive file object on  Lightning Page

You can configure the S-Drive Lightning Component to work with your custom file object. The configuration is similar to using one of the file objects that comes with S-Drive.

Open a record from your custom object (My_Example_Object__c) and click on the Setup gear wheel on the top right and click "edit page."

To display the S-Drive file component on Lightning pages for your custom objects (or standard objects that don't come with an S-Drive file object) you need to edit the object's pages, add the S-Drive Lightning Component to the page and configure it.

1. Edit the Lightning page for a MyExampleObject: Go to an MyExampleObject, click on the **"Setup"** icon (gear wheel) on the top right corner and choose **"Edit Page"** option.

2. You will see **"Lightning Components"** section on the left-hand side. Scroll down to see the **"SDrive"** component, under **"Custom** ".

   ![image-20210513-214941.png](https://docs.sdriveapp.com/__attachments/a_e733536dad521d67dcd473f62d207ca963c34292a871c924047dcbce391d61c5/image-20210513-214941.png?cb=98a6fd090c80d2c55971770ce4804977)
3. Grab the **SDrive** component and drag it onto the page. Drop wherever you want the S-Drive component to be placed.

4. Edit the following required fields correctly to configure the S-Drive component for your object. You can also change the settings for a selection of checkboxes , which are explained next in the Component Attributes section.

## Component Attributes

![image-20220830-150826.png](https://docs.sdriveapp.com/__attachments/a_7cc2597228b3e8a47c771876b4c6ab0ee25447eab85dadc14bd5524c70d93c11/image-20220830-150826.png?cb=460f087b70eaf9f9e772f5d443ecdb8e)

![image-20220525-150031.png](https://docs.sdriveapp.com/__attachments/a_06d924a6a88e6d6de8a68d1720e1c7f93198a1b1962fa1ff789eddf3a8f376f7/image-20220525-150031.png?cb=e48cef424bec7066bef61933146bef30)  
![image-20220525-150053.png](https://docs.sdriveapp.com/__attachments/a_7d28983dd794e18206b7ae14b131206d5c5b614a70104677df2f3e2bd2f83f49/image-20220525-150053.png?cb=b647f8c7f9ab9496a83f75610acfe3f9)

The component attributes shown above are discussed in this section in detail. For the API names of these attributes, see [Attribute Names for use in coding custom S-Drive Lightning Components](https://docs.sdriveapp.com/s-drive-knowledge-articles/attribute-names-for-use-in-coding-custom-s-drive-l.md)

**Title**This is the title of the page block inside the object page. You can set it to "Account Files" (or Case Files, Contact Files, etc) or whatever title you like. This field is optional and if you don't provide a value for this field, it will be set to "S-Drive Files".

**Use Custom Logo on Header**Checking this box will enable inserting a custom logo, which will show on the top left of the S-Drive component in place of the S-Drive logo.

**Logo Url** Add the url for your logo. Note that if it is an external site, you will need to add that site to CSP Trusted Sites. (Go to Setup-\>CSP Trusted Site.)

**Use Compact View**Checking this box will enable a compact view of S-Drive which will help users to fit S-Drive into narrow spaces. In compact view, toolbar operations will be limited to the following: navigate to Home, upload files, download files and folders, create folders, navigate to recycle bin.

**Parent object name**This is the name of the object that the files will be attached to.

**Parent object prefix** This is the object's namespace prefix, if it has one.

**File object name** This is the name of the S-Drive file object that we created in previous sections. This object holds the information regarding the attached files. For our example, it is "My_Example_Object_File__c".

**File object prefix** This is the file object's namespace prefix. Since you created the file object and it's not part of a managed package, this should be left blank.

**Relationship field name** Master-detail or lookup relation used for selected standard/custom object. This should be set to '**Parent__r** '. The name of your lookup field on your file object should be **Parent**.

**Component Id**If multiple S-Drive components are used in a page, this attribute should be set to a unique key for each component. For example: '1', 'a', etc.

**Enable copy URL** This option is used to enable/disable "Copy URL" link in the page. If the checkbox is checked, you will be able to see the "Copy URL" link for each asset. The default value for this checkbox is checked.

**Enable delete** This option is used to enable/disable "Delete" option for all attachments in the page. If the checkbox is checked, you will be able to see the "Delete" link for each asset. The default value for this checkbox is checked.

**Enable download**This option is used to enable/disable "Download" option for all attachments in the page. If the checkbox is checked, you will be able to see the "Download" link for each asset. The default value for this checkbox is checked.

**Enable edit** This option is used to enable/disable "Edit" option for all attachments in the page. If the checkbox is checked, you will be able to see the "Edit" link for each asset. The default value for this checkbox is checked.

**Enable e-mail** This option is used to enable/disable "E-Mail" option for all attachments in the page. If the checkbox is checked, you will be able to see the "E-Mail" link for each asset. The default value for this checkbox is checked.

**Default email address** You can use this option, if you want to set a default "Additional To" email address for sending emails from your S-Drive Attachments. For example, if you select an Account S-Drive Attachment for an account and click "Email" button, "Email Files" screen will be opened and "Additional To" field will be filled with the email address you have provided here.

**Enable upload** This option is used to enable/disable "Upload" option for all attachments in the page. If the checkbox is checked, you will be able to see the "Upload File(s)" link for each asset. The default value for this checkbox is checked.

**Use Legacy Upload** If this is checked, a visualforce upload page is used instead of the Lightning upload page

**Enable Drop Zone**This option is used to configure drop zone in S-Drive components. Select/deselect the checkbox to enable or disable the drop zone.

**Enable Bulk Field Update on Upload** This option enables the Bulk Field Update pullout menu on the Lightning Upload page. It is ignored for Legacy upload.

**Preserve Folder Structure on Upload** If this is checked, then when dropping a folder on the Lightning upload page, the files will remain in the folders and subfolders, not "flattened" into the same level. Available only on Lightning upload, not Legacy upload.

**Allowed file extensions** You can use this option if you want to limit the file types to be uploaded into selected object's S-Drive attachments. Semicolon separated list of file extensions that are allowed to be uploaded can be written here. This attribute is optional and leaving this empty will allow all kind of files to be uploaded. For example, "\*.jpg, \*.txt" will limit the files to be uploaded to jpg and txt files.

**Enable folders** This option is used to enable/disable folder support for S-Drive attachments in the page. If the checkbox is checked, you will be able to see the "New Folder" button. The default value for this checkbox is checked. If the box is not checked, the "New Folder" button will be removed from the toolbar section.

**Enable private files** This option is used for enabling public/private file access to the S-Drive attachments and commonly used to limit the customer portal users' access to individual files. The ability for users to configure this is determined by the main configuration settings in S-Drive Configuration Tab. If the checkbox is checked, you will see the public/private flag. Set this attribute to true by checking the checkbox, if you want to enable private/public flag. Setting the private flag on a file hides the file from customer portal users. The default value for this checkbox is unchecked.

**Enable Public Share**This option is used to configure public share in S-Drive components. Select the checkbox to see Public Share option in Actions Menu. Deselect the checkbox to disable Public Share in Actions Menu.

**Enable Chatter**This option is used for enabling/disabling Chatter for Account files. If you enable this option, you will be able to use functions such as 'Post to Chatter' and will be able to view the Chatter feed of each Account file.

**Disable Cut Copy Paste**This option is used for enabling/disabling cut/copy-paste options. Set this attribute to true by checking the checkbox if you want to disable cut/copy-paste operations.

**Enable Shortcut Creation**This option is used to configure Shortcut Creation in S-Drive components. Select the checkbox to see Create Shortcut button on toolbar. Deselect the checkbox to disable Create Shortcut button on toolbar.

**Enable List View**This is checked by default and enables the option to show files in list view (rather than Thumbnail or Grid view) if Preview and Thumbnail is enabled.

**Enable Thumbnail View** This enables the toolbar button to show files in Thumbnail view (rather than List View or Grid view) if Preview and Thumbnail is enabled.

**Enable Grid View** This enables the toolbar button to show files in Grid view (rather than List or Thumbnail view) if Preview and Thumbnail is enabled.

**Enable Settings** This enables the Settings (gear wheel) toolbar button, which allows users to set the view type, sort field and whether the bread crumbs and folder tree show. The settings only save for the session unless the user has Admin privileges.

**Enable Search** Shows the search box if checked

**Enable Open Original File** Setting this to true adds the "open original file" action to shortcut files

**Default sort field name** This option is used to order/sort S-Drive documents based on a field. You need to set the name of the field that should be used to order the list of files. For this example, it we used "*File_Name__c".*

**Default sort order** This option is used to set the sort order direction of the S-Drive documents. There are two possible values for this attribute: "asc" or "desc". The default value is "asc" which stands for ascending. You can change this option from the settings button located at the toolbar of S-Drive attachments anytime. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Files Count for A Page** This option is to set the number of files to be shown in an attachment page. The default value for this section is set to 100. If this value is set to '30' and object has 91 total items, the files will be displayed in 4 pages. You can change this option from the pagination setting located under the toolbar of S-Drive attachments. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Default view type** This option is to set the default view type of the file list table. There are 3 options you can choose: List, Thumbnail and Grid. You can change this option from the toolbar of S-Drive attachments and set it as default by using the settings button. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Show Folder Tree** This option sets the default behavior of the folder tree component located on the left-hand side of the S-Drive attachments page. You can choose to hide or show the Folder Tree component by using the settings button on the toolbar of S-Drive attachments. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Show Recycle Bin Button** The option determines whether the green Recycle Bin button that can be shown below the folder tree is displayed. When active, this button shows all files in the recycle bin.

**Show Checked Out Files Button** The option determines whether the blue Checked Out Files button that can be shown below the folder tree is displayed. When active, this button shows all files that are checked out.

**Show Legal Hold Files Button** The option determines whether the blue Legal Hold Files button that can be shown below the folder tree is displayed. When active, this button shows all files that have a legal hold on them.

**Show Breadcrumb** This option sets the default behavior of the breadcrumbs located on the left-hand side of the S-Drive attachments page, above the folder tree component. You can choose to hide or show the breadcrumbs by using the settings button on the toolbar of S-Drive attachments. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Open File After Clicking on It**This option is used to configure the behavior when a file is clicked on. Select the checkbox to open the file when it is clicked on. Deselect the checkbox to go to the Details view of the file.

**Enable Field Selection**This option is used to configure Fields button on toolbar which is used to select and display fields. Select the checkbox to enable the button on toolbar and deselect the checkbox to hide.

**Enable Manual Sharing** This option determines whether manual sharing is allowed on files. It is only used on customer file objects that have a lookup relationship to the parent.

**Enable Inherit Sharing Checkbox** This option controls whether the Inherit Sharing checkbox is shown or hidden when creating subfolders and uploading files. If checked, it is shown.

**Enable Inherit Sharing by Default** This option controls whether the Inherit Sharing checkbox is checked or unchecked by default. If you hide the Inherit Sharing checkbox, you still need to use this setting to determine whether Inherit Sharing is true or false when subfolders are created and files are uploaded.

**Show Audit Tab** This option determines whether or not the Audit Tab is shown when clicking on file details.

---
language: "en"
---
# Configuring S-Drive on Custom Objects

S-Drive comes out-of-the-box ready to configure for Accounts, Contacts, Cases, Opportunities, and Leads. If you want to use S-Drive on other objects, you'll need to:

1. [**Create an S-Drive file object**](https://docs.sdriveapp.com/knowledge/how-to-create-an-s-drive-custom-file-object-using-).

2. We then recommend [**creating a "before delete" trigger**](https://docs.sdriveapp.com/2.22/optional-create-a-before-delete-trigger-for-custom.md) on parent object to prevent deleting objects that have S-Drive file on them.

3. [Add your Custom File Object to the S-Drive File Object List](https://docs.sdriveapp.com/2.22/add-your-custom-file-object-to-the-s-drive-file-ob.md)

4. Once your file object is created, you can [**configure an S-Drive Lightning component**](https://docs.sdriveapp.com/2.22/configuring-custom-s-drive-file-object-on-lightnin.md)to display your files or[**create an override page in Classic**](https://docs.sdriveapp.com/2.22/classic-override-page-for-s-drive.md)**.**

---
language: "en"
---
# Configuring S-Drive on Standard Objects

S-Drive comes out-of-the-box ready to configure for Accounts, Contacts, Cases, Opportunities, and Leads

In order to use S-Drive on these objects, we need to set up S-Drive on the record page. For [**Lightning**](https://docs.sdriveapp.com/2.22/configuring-s-drive-on-standard-objects.md#Lightning), this means adding an S-Drive component to the Lightning Record Page. For [**Classic**](https://docs.sdriveapp.com/2.22/configuring-s-drive-on-standard-objects.md#Classic), it means setting up an override page.

*** ** * ** ***

## S-Drive File Component for **Lightning** (Accounts, Cases, Contacts, Opportunities, Leads)

To display the S-Drive file component on Lightning pages for Account, Case, Contact, Opportunity and Lead standard objects, you need to edit each of these objects' pages, add the S-Drive Lightning Component to the page and configure it. We'll use the Account object as an example, but the process is the same for Case, Contact, Opportunity, and Lead.

1. Edit the Lightning page for an Account: Go to an Account, click on the **"Setup"** icon (gear wheel) on the top right corner and choose **"Edit Page"** option.

2. You will see **"Lightning Components"** section on the left-hand side. Scroll down to see the **"SDrive"** component, under **"Custom** ".

3. Grab the **SDrive** component and drag it onto the page. Drop wherever you want the S-Drive component to be placed.

   ![worddavb1576770f2da35a9cd4e131e330c3463.png?version=1&modificationDate=1614710463172&cacheVersion=1&api=v2&width=571&height=274](https://docs.sdriveapp.com/__attachments/a_8726d1fd1129c98753f4c4496a99d21c35a5aad2361221b2a10370492dfc9652/worddavb1576770f2da35a9cd4e131e330c3463.png%3Fversion=1&modificationDate=1614710463172&cacheVersion=1&api=v2&width=571&height=274?cb=b1576770f2da35a9cd4e131e330c3463)

4. Edit the required fields correctly to configure the S-Drive component for Account Files (or Contacts, Cases, Opportunities, Leads) You can also change the settings for a selection of checkboxes , which are explained below in the [Component Attributes](https://docs.sdriveapp.com/2.22/configuring-s-drive-on-standard-objects.md#ComponentAttributes) section.

5. After clicking on **"Save"** button, you need to activate the page in order to use the S-Drive component. You can click on **"Activation"** and choose **"Assign as Org Default"** or **"Assign as App Default"** from the pop-up screen, in order to view the S-Drive component. Now, you should see "Account Files" page block at the end of the account object record page.

![image-20220830-144819.png](https://docs.sdriveapp.com/__attachments/a_c97e8954b7dda49e9c82cfd2247d64750a2744f87011b7b6966d9a60fe619f31/image-20220830-144819.png?cb=5fa5a8fb0f1466e751ec7f4a3b42cc3e)  
![image-20220524-210951.png](https://docs.sdriveapp.com/__attachments/a_798a47f94346429da0158d8204507460eb6c8d521f11addcec29c2258bd5d259/image-20220524-210951.png?cb=2aee474cba0ea616968ff421469db7a0)  
![image-20220524-211009.png](https://docs.sdriveapp.com/__attachments/a_5a5acb3a6696a9a830a7d8ef73db4863c2a01512a218ec2b0971730cfb6c08b1/image-20220524-211009.png?cb=1ad54bbffe80841ad9e9a133e97af8db)

### Component Attributes

The component attributes shown above are discussed in this section in detail. For the API names of these attributes, see [Attribute Names for use in coding custom S-Drive Lightning Components](https://docs.sdriveapp.com/s-drive-knowledge-articles/attribute-names-for-use-in-coding-custom-s-drive-l.md)

**Title**This is the title of the page block inside the object page. You can set it to "Account Files" (or Case Files, Contact Files, etc) or whatever title you like. This field is optional and if you don't provide a value for this field, it will be set to "S-Drive Files".

**Use Custom Logo on Header**Checking this box will enable inserting a custom logo, which will show on the top left of the S-Drive component in place of the S-Drive logo.

**Logo Url** Add the url for your logo. Note that if it is an external site, you will need to add that site to CSP Trusted Sites. (Go to Setup-\>CSP Trusted Site.)

**Use Compact View** Checking this box will enable a compact view of S-Drive which will help users to fit S-Drive into narrow spaces. In compact view, toolbar operations will be limited to the following: navigate to Home, upload files, download files and folders, create folders, navigate to recycle bin. See more at [S-Drive Compact View Configuration](https://docs.sdriveapp.com/2.22/configuring-s-drive-on-standard-objects.md#CompactView) below.

**Parent object name**This is the name of the object that the files will be attached to. For Account object, it will be "Account". For the other standard objects use Case, Contact, Opportunity or Lead.

**Parent object prefix** This is the object's namespace prefix that your [Salesforce.com](http://salesforce.com/) organization uses. For Account and other standard objects, you do not need to add an object namespace prefix so leave this field blank.

**File object name** This is the name of the custom object S-Drive uses to hold the information regarding the attached files. S-Drive comes with the custom File object associated with Account, Case, Contact, Opportunity, and Lead. The object name is "AccountFile_*c" (CaseFilec, ContactFilec, OpportunityFilec, or Lead_File*_c)

**File object prefix** This is the file object's namespace prefix that your [Salesforce.com](http://salesforce.com/) organization uses. If your organization has a namespace prefix and you created this custom object file inside this organization, your file namespace prefix is the same as your organization namespace prefix. If this file object belongs to a managed package, you need to use that managed package's namespace prefix. For Account, Case, Contact, Opportunity, or Lead set it to "cg__".

**Relationship field name** Master-detail relation used for selected standard object. You need to fill it in as "Account_*r" (Caser, Contactr, Opportunityr, Lead*_r)

**Component Id**If multiple S-Drive components are used in a page, this attribute should be set to a unique key for each component. For example: '1', 'a', etc.

**Enable Copy URL** This option is used to enable/disable "Copy URL" action on the action menu. If the checkbox is checked, you will be able to see the "Copy URL" link for each asset. The default value for this checkbox is checked.

**Enable delete** This option is used to enable/disable "Delete" toolbar button and action for all files on the page. The default value for this checkbox is checked.

**Enable download**This option is used to enable/disable "Download" option for all attachments in the page. If the checkbox is checked, you will be able to see the "Download" link for each asset. The default value for this checkbox is checked.

**Enable edit** This option is used to enable/disable "Edit" option for all attachments in the page. If the checkbox is checked, you will be able to see the "Edit" link for each asset. The default value for this checkbox is checked.

**Enable e-mail** This option is used to enable/disable "E-Mail" option for all attachments in the page. If the checkbox is checked, you will be able to see the "E-Mail" link for each asset. The default value for this checkbox is checked.

**Default email address** You can use this option, if you want to set a default "Additional To" email address for sending emails from your S-Drive Attachments. For example, if you select an Account S-Drive Attachment for an account and click "Email" button, "Email Files" screen will be opened and "Additional To" field will be filled with the email address you have provided here.

**Enable upload** This option is used to enable/disable "Upload" option for all attachments in the page. If the checkbox is checked, you will be able to see the "Upload File(s)" link for each asset. The default value for this checkbox is checked.

**Use Legacy Upload** If this is checked, a visualforce upload page is used instead of the Lightning upload page

**Enable Drop Zone**This option is used to configure drop zone in S-Drive components. Select/deselect the checkbox to enable or disable the drop zone.

**Enable Bulk Field Update on Upload** This option enables the Bulk Field Update pullout menu on the Lightning Upload page. It is ignored for Legacy upload.

**Preserve Folder Structure on Upload** If this is checked, then when dropping a folder on the Lightning upload page, the files will remain in the folders and subfolders, not "flattened" into the same level. Available only on Lightning upload, not Legacy upload.

**Allowed file extensions** You can use this option if you want to limit the file types to be uploaded into selected object's S-Drive attachments. Semicolon separated list of file extensions that are allowed to be uploaded can be written here. This attribute is optional and leaving this empty will allow all kind of files to be uploaded. For example, "\*.jpg, \*.txt" will limit the files to be uploaded to jpg and txt files.

**Enable folders** This option is used to enable/disable folder support for S-Drive attachments in the page. If the checkbox is checked, you will be able to see the "New Folder" button. The default value for this checkbox is checked. If the box is not checked, the "New Folder" button will be removed from the toolbar section.

**Enable private files** This option is used for enabling public/private file access to the S-Drive attachments and commonly used to limit the customer portal users' access to individual files. The ability for users to configure this is determined by the main configuration settings in S-Drive Configuration Tab. If the checkbox is checked, you will see the public/private flag. Set this attribute to true by checking the checkbox, if you want to enable private/public flag. Setting the private flag on a file hides the file from customer portal users. The default value for this checkbox is unchecked.

**Enable Public Share**This option is used to configure public share in S-Drive components. Select the checkbox to see Public Share option in Actions Menu. Deselect the checkbox to disable Public Share in Actions Menu.

**Enable Chatter**This option is used for enabling/disabling Chatter for Account files. If you enable this option, you will be able to use functions such as 'Post to Chatter' and will be able to view the Chatter feed of each Account file.

**Disable Cut Copy Paste**This option is used for enabling/disabling cut/copy-paste options. Set this attribute to true by checking the checkbox if you want to disable cut/copy-paste operations.

**Enable Shortcut Creation**This option is used to configure Shortcut Creation in S-Drive components. Select the checkbox to see Create Shortcut button on toolbar. Deselect the checkbox to disable Create Shortcut button on toolbar.

**Enable List View**This is checked by default and enables the option to show files in list view (rather than Thumbnail or Grid view) if Preview and Thumbnail is enabled.

**Enable Thumbnail View** This enables the toolbar button to show files in Thumbnail view (rather than List View or Grid view) if Preview and Thumbnail is enabled.

**Enable Grid View** This enables the toolbar button to show files in Grid view (rather than List or Thumbnail view) if Preview and Thumbnail is enabled.

**Enable Settings** This enables the Settings (gear wheel) toolbar button, which allows users to set the view type, sort field and whether the bread crumbs and folder tree show. The settings only save for the session unless the user has Admin privileges.

**Enable Search** Shows the search box if checked

**Enable Open Original File** Setting this to true adds the "open original file" action to shortcut files

**Default sort field name** This option is used to order/sort S-Drive documents based on a field. You need to set the name of the field that should be used to order the list of files. For this example, it should be filled in as "cg_*File_Namec". You can change this option from the settings button located at the toolbar of S-Drive attachments anytime. _See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Default sort order** This option is used to set the sort order direction of the S-Drive documents. There are two possible values for this attribute: "asc" or "desc". The default value is "asc" which stands for ascending. You can change this option from the settings button located at the toolbar of S-Drive attachments anytime. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Files Count for A Page** This option is to set the number of files to be shown in an attachment page. The default value for this section is set to 100. If this value is set to '30' and object has 91 total items, the files will be displayed in 4 pages. You can change this option from the pagination setting located under the toolbar of S-Drive attachments. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Default view type** This option is to set the default view type of the file list table. There are 3 options you can choose: List, Thumbnail and Grid. You can change this option from the toolbar of S-Drive attachments and set it as default by using the settings button. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Show Folder Tree** This option sets the default behavior of the folder tree component located on the left-hand side of the S-Drive attachments page. You can choose to hide or show the Folder Tree component by using the settings button on the toolbar of S-Drive attachments. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Show Recycle Bin Button** The option determines whether the green Recycle Bin button that can be shown below the folder tree is displayed. When active, this button shows all files in the recycle bin.

**Show Checked Out Files Button** The option determines whether the blue Checked Out Files button that can be shown below the folder tree is displayed. When active, this button shows all files that are checked out.

**Show Legal Hold Files Button** The option determines whether the blue Legal Hold Files button that can be shown below the folder tree is displayed. When active, this button shows all files that have a legal hold on them.

**Show Breadcrumb** This option sets the default behavior of the breadcrumbs located on the left-hand side of the S-Drive attachments page, above the folder tree component. You can choose to hide or show the breadcrumbs by using the settings button on the toolbar of S-Drive attachments. *See "S-Drive Lightning User Guide" for more information about using the S-Drive attachments.*

**Open File After Clicking on It**This option is used to configure the behavior when a file is clicked on. Select the checkbox to open the file when it is clicked on. Deselect the checkbox to go to the Details view of the file.

**Enable Field Selection**This option is used to configure Fields button on toolbar which is used to select and display fields. Select the checkbox to enable the button on toolbar and deselect the checkbox to hide.

**Enable Online Editing** This option adds the "Open in Microsoft" action (allowing files to be edited in Microsoft without downloading them) to the action menu for Word, Powerpoint and Excel files if Content Authoring is configured.

**Enable Manual Sharing** This option determines whether manual sharing is allowed on files. It is only used on customer file objects that have a lookup relationship to the parent.

**Enable Inherit Sharing Checkbox** This option controls whether the Inherit Sharing checkbox is shown or hidden when creating subfolders and uploading files. If checked, it is shown.

**Enable Inherit Sharing by Default** This option controls whether the Inherit Sharing checkbox is checked or unchecked by default. If you hide the Inherit Sharing checkbox, you still need to use this setting to determine whether Inherit Sharing is true or false when subfolders are created and files are uploaded.

**Show Audit Tab** This option determines whether or not the Audit Tab is shown when clicking on file details.

### S-Drive Compact View Configuration

In order to use S-Drive in narrow spaces in Lightning Experience, you can use the configuration option, "Use Compact View" checkbox.

![worddavb96a54d9f66fe124d5a5ef3764b7bb20.png?version=1&modificationDate=1614710465640&cacheVersion=1&api=v2&width=284&height=256](https://docs.sdriveapp.com/__attachments/a_708f0bfe4504655cc4f1cb0dfac5c5c61d3b058ed9e1c6855d3467b17b676a2a/worddavb96a54d9f66fe124d5a5ef3764b7bb20.png%3Fversion=1&modificationDate=1614710465640&cacheVersion=1&api=v2&width=284&height=256?cb=b96a54d9f66fe124d5a5ef3764b7bb20)

The compact view enabled S-Drive component will look like the following:

![worddav7b5ad4415f72997e6ef9f7c686247b09.png?version=1&modificationDate=1614710466251&cacheVersion=1&api=v2&width=385&height=238](https://docs.sdriveapp.com/__attachments/a_6f1f0e25e61e6f997bbd625fb6a2a1965422584cbd519dee14d395275a10558c/worddav7b5ad4415f72997e6ef9f7c686247b09.png%3Fversion=1&modificationDate=1614710466251&cacheVersion=1&api=v2&width=385&height=238?cb=7b5ad4415f72997e6ef9f7c686247b09)

Note that the search bar is not available in compact view.

In compact view, the number of fields that are shown in the file list is limited. As you configure your fields in the S-Drive Configuration tab, the first four fields will be shown in the compact view, including the File Name field.

![worddav376eb682e43ae516d31bb7bc2d0751c3.png?version=1&modificationDate=1614710466883&cacheVersion=1&api=v2&width=439&height=177](https://docs.sdriveapp.com/__attachments/a_ce0c3e1102131ddf8a42b85c09dc44b0434e65032341dc3f018181e54b24b8de/worddav376eb682e43ae516d31bb7bc2d0751c3.png%3Fversion=1&modificationDate=1614710466883&cacheVersion=1&api=v2&width=439&height=177?cb=376eb682e43ae516d31bb7bc2d0751c3)

In a configuration like the figure above for Account Files, the following fields will be shown in the component: File Name, Description, File Size and Created By ID.

### S-Drive Email Lightning Component

The Email Lightning component allows users to write emails with attachments of files from S-Drive. You can place the email component on any lightning page with the Lightning App builder and attach files of any file object type from any record. If you have **Enhanced Emails** enabled in your org, emails sent from S-Drive email component will show up in your email Activity History.

**Enabling S-Drive Email**

Open the Lightning App Builder by clicking on the cog wheel at the top right corner of your Object record page and click on "Edit Page".  
![worddav0349ccf4d98e822f5aa91a09697f4877.png?version=1&modificationDate=1614710467546&cacheVersion=1&api=v2&width=500&height=203](https://docs.sdriveapp.com/__attachments/a_1bc1ab09308fbb24717cd7bf99f96883a2c6f3086036d22d2e5968f705ecaf41/worddav0349ccf4d98e822f5aa91a09697f4877.png%3Fversion=1&modificationDate=1614710467546&cacheVersion=1&api=v2&width=500&height=203?cb=0349ccf4d98e822f5aa91a09697f4877)

Drag and drop the S-Drive E-Mail component from the lightning components panel to your desired location in the Lightning page editor.  
![worddav5afc3b44a3717c88911b5e3eb80b1963.png?version=1&modificationDate=1614710468352&cacheVersion=1&api=v2&width=199&height=225](https://docs.sdriveapp.com/__attachments/a_3cfd3fe19f00c7556ccda20bad614263c93d7563a2ca1626024670c7a8c4993c/worddav5afc3b44a3717c88911b5e3eb80b1963.png%3Fversion=1&modificationDate=1614710468352&cacheVersion=1&api=v2&width=199&height=225?cb=5afc3b44a3717c88911b5e3eb80b1963)

*** ** * ** ***

## S-Drive File Area for**Classic** (Accounts, Cases, Contacts, Opportunities, Leads)

**For Account** , **Case** , **Contact** , **Opportunity** and **Lead** standard objects, the associated S-Drive file objects and override pages for Salesforce Classic are bundled with the S-Drive installation. If you'll use S-Drive attachments for these standard objects as *override,* you can use bundled objects and/or pages where appropriate. If you are planning to use S-Drive Attachments for other standard/custom objects or as *override/inline,* please refer to the "*S-Drive Advanced Configuration Guide* " document.

"Overriding the view of the object" means that the page will be used as an override to the standard object page. In this case, 'S-Drive Attachments' will be a section at the end of the standard page layout.

1. In Salesforce Classic view, click Setup button on right top and go to **Build-\> Customize--\>Accounts** (or **Cases** or **Contacts** or **Opportunities** or **Leads** the label of the object that you want to enable S-Drive Attachments for) **-\> Buttons, Links, and Actions** .

   ![worddav55284b9cf7128f49a94ed89e103b66b3.png?version=1&modificationDate=1614710457807&cacheVersion=1&api=v2&width=624&height=266](https://docs.sdriveapp.com/__attachments/a_f73e9f05a3c84fc03d5bd5cc3f73c7b088f5a5e3244270a6112f4be9eb7e382f/worddav55284b9cf7128f49a94ed89e103b66b3.png%3Fversion=1&modificationDate=1614710457807&cacheVersion=1&api=v2&width=624&height=266?cb=55284b9cf7128f49a94ed89e103b66b3)

   Click**Edit** next to the View Label.

   ![worddav83c31534d13f491dc79300e73c92e7af.png?version=1&modificationDate=1614710458417&cacheVersion=1&api=v2&width=500&height=146](https://docs.sdriveapp.com/__attachments/a_e936daa997aebea232d8fb5f61806dded8ef4ca8ffd7a7202e5962c25a17f28b/worddav83c31534d13f491dc79300e73c92e7af.png%3Fversion=1&modificationDate=1614710458417&cacheVersion=1&api=v2&width=500&height=146?cb=83c31534d13f491dc79300e73c92e7af)

2. Select **Visualforce Page** for *Override With* section and pick related Visualforce page (**AccountFilePage** for Accounts, **CaseFilePage** for Cases, **ContactFilePage** for Contacts, **OpportunityFilePage** for Opportunities, **LeadFilePage** for Leads) from the drop-down box. Click **Save** button to complete the override.

   ![worddavededff26f5482579b08b5c579d60afa1.png?version=1&modificationDate=1614710459032&cacheVersion=1&api=v2&width=492&height=124](https://docs.sdriveapp.com/__attachments/a_5a8364cb72350b2bbc079086e2f47ce03dfd70eb818d65f71a2b690a772f8dcc/worddavededff26f5482579b08b5c579d60afa1.png%3Fversion=1&modificationDate=1614710459032&cacheVersion=1&api=v2&width=492&height=124?cb=ededff26f5482579b08b5c579d60afa1)

3. Now it will display **View** as **Overridden** in the *Buttons, Links, and Actions* section (Figure 5 4).

   ![worddav01b20a3b9c638dcddf33a693e45d7a7f.png?version=1&modificationDate=1614710459687&cacheVersion=1&api=v2&width=503&height=79](https://docs.sdriveapp.com/__attachments/a_5c50a38d1f7b0655674cfa7123f027fc50a7492a59e59103b887def7adb663ed/worddav01b20a3b9c638dcddf33a693e45d7a7f.png%3Fversion=1&modificationDate=1614710459687&cacheVersion=1&api=v2&width=503&height=79?cb=01b20a3b9c638dcddf33a693e45d7a7f)
4. After creating an account object, you should see "Account Files" (similar screens for Cases, Contacts and Opportunities and Leads once you configure) page block at the end of the object detail page.

![worddavc1536f9e9d73aeb93bd9c243b25d2bf7.png?version=1&modificationDate=1614710460298&cacheVersion=1&api=v2&width=511&height=70](https://docs.sdriveapp.com/__attachments/a_324708e35c2bbc6acf4ff045be3976361bec1d727e413def511c832cff7948dc/worddavc1536f9e9d73aeb93bd9c243b25d2bf7.png%3Fversion=1&modificationDate=1614710460298&cacheVersion=1&api=v2&width=511&height=70?cb=c1536f9e9d73aeb93bd9c243b25d2bf7)

---
language: "en"
---
# Content Authoring - Microsoft Office Integration(Paid feature)

## Overview

S-Drive's document editing online feature is available for Lightning on desktop, and allows users to edit Microsoft Word, Excel, or PowerPoint files while in S-Drive, without having to download, edit, and re-upload them.

[**Watch the Demo Video**](https://www.youtube.com/watch?v=EpkfxBvxzSg&list=PLOYOFI039X6Ww_QlHOtjTT7fdz_iLZCqz&index=28&t=2s)

In order to use online document editing, you must have a Microsoft Azure account, and your S3 bucket must be versioned. When files are edited using online document editing, they will be saved automatically as you edit, and when you're done, the document will be saved as a new version in S-Drive.

Please see our [Pricing page](https://www.sdriveapp.com/pricing/) for rates.

### What about security?

Microsoft Office Integration uses Web Application Open Platform Interface (WOPI) to manage request between S-Drive and Office Online.

* Files are always kept in Amazon S3.

* Only the file content is shared with Office Online via the WOPI.

* Office Online has no information about where the file is stored

* Office Online does not have any permission to change the files in S3.

* Files are never saved to Office Online servers. Just a temporary copy of the file is kept throughout the editing session

* Once the editing session is complete, WOPI uploads the updated file to S3 and the file is saved to S-Drive as a new version.

### Prerequisites and Limitations

* Versioning must be enabled in your bucket (and configured in your org). See [https://cyangate.atlassian.net/wiki/spaces/SD220/pages/1781760923/General+Settings#Upload-Settings](https://docs.sdriveapp.com/2.22/general-settings.md#Upload-Settings) for how to enable versioning.

* Users must have a Microsoft Office365 Account and an "Office for the web" license. This can be a shared account or their own individual account

* Lightning experience only

* Not available in mobile app

* Files up to 100 MB can be edited

### What kinds of files can use this feature?

|                        **Document**                         | **file type** | **Can be edited?** |
|-------------------------------------------------------------|---------------|--------------------|
| Word Documents up to 100 MB                                 | .doc, .docx   | ✅                  |
| Power Point slides up to 100 MB                             | .ppt, .pptx   | ✅                  |
| Excel sheets up to 100 MB                                   | .xls, .xlsx   | ✅                  |
| Files in S-Drive recycle Bin                                |               | ❌                  |
| Locked files (checked out or currently being edited online) |               | ❌                  |
| Files accessed via a public share link                      |               | ❌                  |
| Shortcut files                                              |               | ❌                  |

## Setting up Microsoft Office Integration

### Configure Usage Plan and Enable Users

1. Navigate to S-Drive Configuration page

2. Click on Micro Services tab

3. Scroll to the Content Authoring section

4. Enable on Trial basis or choose "Enabled" and choose the number of users you want to enable by using the slider. If you would like more than 100 users, please contact S-Drive Sales.

   ![image-20220525-163347.png](https://docs.sdriveapp.com/__attachments/a_d6bbc84caec65b8b7d69aeb23187e62f109e432388f8183b6db46395c86034bc/image-20220525-163347.png?cb=7820ac74acf99dab45e81353d7058d52)

5. Select users from the Available list and move them Selected list for enabling content authoring for those users

6. Add [https://wopi.sdriveapp.com](https://wopi.sdriveapp.com/) to your Remote Site Settings

   1. Go to Setup-\>Remote Site Settings

   2. Click New Remote Site

   3. Give the setting a name

   4. Enter [https://wopi.sdriveapp.com](https://wopi.sdriveapp.com/) for the url

   5. Click Save

### Enable Online Editing in S-Drive Lightning Component

To enable editing documents online in any S-Drive Component, edit the Lightning page, and on the S-Drive Component, check the box for Online Editing.  
![image-20211105-192613.png](https://docs.sdriveapp.com/__attachments/a_606f14f9e262554e3fbdbdd1da2fbb08007a91bd8cd3064883eab3106c850cad/image-20211105-192613.png?cb=727462d3092ef8d92f4b64b10100b648)

Now when you click the down-arrow on the Action menu next to a Microsoft file, you will see an option to open that file in Microsoft Word/Excel/Powerpoint. While a file is undergoing editing, the Status column will show a lock icon and a pencil icon to indicate the file is locked due to editing. Hovering over the pencil icon will show who is editing the document.

**Note:** As editing documents online is only available in Lightning Experience, if you have users in your organization who uses S-Drive in both Lightning and Classic, a file in Classic may not show the lock state properly.  
![image-20211020-200824.png](https://docs.sdriveapp.com/__attachments/a_8dc50420e3ed886617352ad57f24ad71589b46e708e5ab97368f2fbb26d42f3e/image-20211020-200824.png?cb=10fe44eaf4cfe3c12a68dd6a0c365b4b)

**File size:** Office online optimizes images, so file sizes may be smaller than the original after editing.

---
language: "en"
---
# Content Authoring (PAID)

Content Authoring document editing online allows users to edit Microsoft Word, Excel, and PowerPoint documents without downloading them to S-Drive. For more information on this feature, see [Content Authoring - Microsoft Office Integration(Paid feature)](https://cyangate.atlassian.net/wiki/pages/resumedraft.action?draftId=1781762073)

This feature is available in Lightning Experience only. If you have users in your organization who uses S-Drive in both Lightning and Classic, a file locked for editing in Lightning may not show as locked in Classic.

To configure Content Authoring:

1. Navigate to S-Drive Configuration page

2. Click on Micro Services tab

3. Scroll to the Content Authoring section

4. Enable on Trial basis or choose "Enabled" and choose the number of users you want to enable by using the slider. If you would like more than 100 users, please contact S-Drive Sales.

   ![image-20220525-163347.png](https://docs.sdriveapp.com/__attachments/a_d6bbc84caec65b8b7d69aeb23187e62f109e432388f8183b6db46395c86034bc/image-20220525-163347.png?cb=7820ac74acf99dab45e81353d7058d52)

5. Select users from the Available list and move them Selected list for enabling content authoring for those users

6. Add [https://wopi.sdriveapp.com](https://wopi.sdriveapp.com/) to your Remote Site Settings

   1. Go to Setup-\>Remote Site Settings

   2. Click New Remote Site

   3. Give the setting a name

   4. Enter [https://wopi.sdriveapp.com](https://wopi.sdriveapp.com/) for the url

   5. Click Save

---
language: "en"
---
# copyPartMultiPartUpload

This method is used to upload a part by copying data from existing object as data source to get Etag value. This Etag will be used complete multi part request.

String copyPartMultiPartUpload(String awsLocation, String uploadId, Long partNumber)

***Parameters:***

**awsLocation:** The name of key to be uploaded as file location. You can get this value from the fileLocation of UploadRequestInfo object.

**uploadId:** The upload Id that you get this Id from the initializeMultipartUpload request as a return value.

**partNumber:** The order of uploaded part.

***Return Value:*** The method will return the Etag as a String.

*Example code:*

    List<String> eTagList = new List <String>();
    for(Integer i = 1; i<= multiPartsSize; i++)
    {
    String eTag = cg.SDriveTools.copyPartMultiPartUpload
    (uploadRequestInfos.fileLocation, uploadId, i);
    eTagList.add(eTag);
    }

While uploading multi parts, you must give the key parameters with the format shown below. It must

be start with zero.

"key" : fileLocation + '.' +0 (partNumber = 1)

to

"key" : fileLocation + '.' + multiPartsSize-1 (partNumber = multiPartsSize

---
language: "en"
---
# Create S-Drive File Objects

Every object you want to use S-Drive with must have an associated S-Drive File object with either a master-detail relationship or lookup relationship where the file object is the child.

You can**create your file object** using a spreadsheet and [following these instructions](https://docs.sdriveapp.com/knowledge/how-to-create-an-s-drive-custom-file-object-using-).

Once your file object has been created, see <https://cyangate.atlassian.net/l/c/UU64jdPZ> or [Classic Override Page for S-Drive](https://docs.sdriveapp.com/2.22/classic-override-page-for-s-drive.md).

If you want to create a trigger to prevent a record from being deleted if there are files attached to it, see [(Optional) Create a Before Delete Trigger for Custom Object](https://docs.sdriveapp.com/2.22/optional-create-a-before-delete-trigger-for-custom.md)

---
language: "en"
---
# createFileActivity

You can use SDriveTools API class to create file activities, after configuring the file activities from S-Drive configuration tab.

In order to create file activities using API class call the following methods depending on single file or multiple files:

`cg.SDriveTools.createFileActivity(fileId, activityType,prefix,objectName,additionalDetails);`

The method signature is explained as follows:

Create file activity record for the given file.

@param String fileId Id of the file to record its activity

@param String activityType type of activity

@param String prefix prefix of the file object e.g. 'cg__'

@param String objectName Name of file object which fileId belongs to e.g. AccountFile__c

@param String additionalDetails Additional details for file activity

throws SDriveException throws exception if fileId is empty or File Activity record insertion fails

global static void createFileActivity(String fileId, String activityType,String prefix, String objectName, String additionalDetails)

`cg.SDriveTools.createFileActivity(fileId, activityType,prefix,objectName,additionalDetails);`

The method signature is explained as follows:

Create file activity record for multiple files.

@param List\<String\> fileIds the file Ids to record their activity

*The rest of the parameters are the same for two methods.*

`global static void createFileActivity(List<String> fileIds, String activityType, String prefix, String objectName, String additionalDetails)`

**Note** : For Custom Objects, you must create a lookup relationship in **File Activity** object with that the desired S-Drive file object. You can create the relationship from Setup \> Objects \> File Activity \> Scrolling to "Custom Fields \& Relationships" section \> Clicking on "New" button \> Select "Lookup Relationship" and select your desired file object as "Related To" from the picklist provided.

---
language: "en"
---
# createPublicAccessLink

We recommend using [createPublicLink](https://docs.sdriveapp.com/2.22/createpubliclink.md) instead.

You can use SDriveTools API class to create a public access link, after configuring S-URL from S-Drive Configuration tab. To create a public access link using API class call the following method:

`cg.SDriveTools.createPublicAccessLink(fileIds, objectFileName, objectId, objectName, objectRelationshipName, isUpdatable, isDeletable, isCreatable, expirationDate, password, IpRange);`

**The method signature is explained as follows:**

@param List\<String\> fileIds: List of ids of files \& folders

@param String objectFileName: Full object name of the file, e.g. 'cg_*AccountFile* _c'

@param String objectId: Id of parent object, i.e. for account files it is id of Account record

@param String objectName: Name of the parent object, i.e. for account files it is "Account"

@param String objectRelationshipName: The name of the relationship field that between parent and file objects. e.g. relationship field name of between account \& account files is "Account__r"

@param Boolean isUpdatable: It enables/disables file edit feature for public user

@param Boolean isDeletable: It enables/disables file delete feature for public user

@param Boolean isCreatable: It enables/disables file upload \& create new folder feature for public user

@param Datetime expirationDate: Expire date for the link

@param String password: The minimum password length should be 4 characters

@param String IpRange: Two IP addresses as string separated by a "-" dash

---
language: "en"
---
# createPublicDownloadLink

We recommend using [createPublicLink](https://docs.sdriveapp.com/2.22/createpubliclink.md) instead.

You can use SDriveTools API class to create a public download link, after configuring S-URL from S-Drive Configuration tab. To create a public download link using API class call the following method:

`cg.SDriveTools.createPublicDownloadLink(fileIds, objectFileName, expirationDate, password, IpRange);`

The method signature is explained as follows:

@param List\<String\> fileIds: List of ids of files \& folders

@param String objectFileName: Full object name of the file, e.g. 'cg_*AccountFile* _c'

@param Datetime expirationDate: Expire date for the link

@param String password: The minimum password length should be 4 characters

@param String IpRange: Two IP addresses as string separated by a "-" dash

---
language: "en"
---
# createPublicLink

You can use SDriveTools API class to create a public access link, after configuring S-URL from S-Drive Configuration tab. To create a public access link using API class call the following method:

    createPublicLink(List<String> fileIds, String objectFileName, String
    objectId, String objectName, String objectRelationshipName, Boolean
    isAccessible, Boolean isUpdatable, Boolean isDeletable, Boolean
    isCreatable, Datetime expirationDate, String password, String IpRange,
    Boolean isDownloadLink, Boolean isOpen)

**The method signature is explained as follows:**

@param List\<String\> fileIds: List of ids of files \& folders

@param String objectFileName: Full object name of the file, e.g. 'cg_*AccountFile* _c'

@param String objectId: Id of parent object, i.e. for account files it is id of Account record

@param String objectName: Name of the parent object, i.e. for account files it is "Account"

@param String objectRelationshipName: The name of the relationship field that between parent and file objects. e.g. relationship field name of between account \& account files is "Account__r"

@param Boolean isAccessible: It enables/disables file read feature for public user

@param Boolean isUpdatable: It enables/disables file edit feature for public user

@param Boolean isDeletable: It enables/disables file delete feature for public user

@param Boolean isCreatable: It enables/disables file upload \& create new folder feature for public user

@param Datetime expirationDate: Expire date for the link

@param String password: The minimum password length should be 4 characters

@param String IpRange: Two IP addresses as string separated by a "-" dash

@param Boolean isDownloadLink: If true, file is downloaded

@param Boolean isOpen: If true, file is opened in component

---
language: "en"
---
# createShortcuts

This method is used to create shortcuts of files.

    void createShortcuts(String destinationObjectFilePrefix, String
    destinationObjectFileName, String destinationRelationshipName, String
    destinationObjectId, String sourceObjectFilePrefix, String
    sourceObjectFileName, String selectedFolder, List<String> fileIds)

**Parameters:**

**destinationObjectFilePrefix:** This is the object's prefix where you want to create the shortcuts. For S-Drive file objects included with the managed package, provide "cg__" for this parameter.

**destinationObjectFileName:** This is the object's name where you want to create the shortcuts.

**destinationRelationshipName:** This is the relationship field's name between the file object and its parent. For your custom objects provide "Parent__r", for objects included with S-Drive managed package, provide the Master-Detail relationship or Lookup relationship name.

**destinationObjectId:** The parent record's ID where you want shortcuts to be created.

**sourceObjectFilePrefix:** The prefix of the object of the source/original files that shortcuts will be created from.

**sourceObjectFileName:** The name of the object of the source/original files that shortcuts will be created from.

**selectedFolder:** If you want to put the shortcuts into a specific folder in the destination, provide the ID of the folder that you created in the target record's S-Drive.

**fileIds:** The source/original files' IDs in a List\<String\> format.

**Return Value:** The method does not return anything.

**Example code:**

The example code will create shortcuts as Account File records and put them under the specified Account which has the accountID. The shortcuts will be created from Case Files which have caseFileIds.

    String accountID;

    List<String> caseFileIds;

    cg.SDriveTools.createShortcuts('cg__', 'AccountFile__c', 'Account__r',
    accountID, 'cg__', 'CaseFile__c', '', caseFileIds);

---
language: "en"
---
# Creating Custom HTML Upload Page

You can create an S-Drive HTML Upload Widget Page for S-Drive object files (cg_S3Objectc, cgCaseFilec, MyExampleObject_c, etc.). This page can be used to add the S-Drive HTML upload widget to the page wherever you want. So, you can upload your files easily without opening object's page and clicking "Upload file(s)" button. To create a custom HTML upload page, follow these steps:

1. Go to **Setup \> App Setup -\> Develop\> Pages** and click the **New** button at the top of the page

   ![image-20210517-163106.png](https://docs.sdriveapp.com/__attachments/a_1ebd9e488217fb2ee4e6ea1fce58b87cf3f9d4768fc56aea210d0324e25bc41a/image-20210517-163106.png?cb=0b033f736f6661621f4f1d778a7bbef7)
2. In the "**Page Edit** " screen you'll create your new page. Give an appropriate name to your page. For our example, we will use "MyCaseHtmlUploadPage" name. Type "MyCaseHtmlUploadPage" inside Label field (a). Type "MyCaseHtmlUploadPage" inside Name field(b).

   ![image-20210517-163124.png](https://docs.sdriveapp.com/__attachments/a_f2d527da2732c5296076e97ba176015e6fd9f16c50383285e10e2575ed9ab02d/image-20210517-163124.png?cb=0652b82baed3d541bcacbf15be8128b6)

   You need to set the "[Salesforce.com](http://salesforce.com/) API" version to 22.0 or above to use S-Drive 2.0 features. To set the version number click the "Version Settings" tab next to the "Visualforce Markup" tab and change the version number from drop-down

   Now we need to create our page content. We will be using custom components in our page. Basically, our page skeleton will be as follows:

       <apex:page standardController="Case" tabStyle="Case">
       <cg:HtmlUploadComponent
       objectId="{!Case.Id}"
       customObjectFileName="CaseFile__c"
       fileNamespacePrefix="cg__"
       relationshipName="Case__r"
       privateEnabled="true"
       allowedFileExtensions="="*.avi;*.txt""
       isUsePopup="true/false"
       returnUrl="https://na6.salesforce.com/home/home.jsp"
       debug="true/false"
       currentFolderId = " a068000000xgAAEAA2"
       />
       </apex:page>

   As an example, the following will be a typical ***Visualforce page*** :

       <apex:page standardController="Case" tabStyle="Case" showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="true" applyBodyTag="true" docType="html">
       <html>
       <head>
       <meta charset="utf-8" />
       <title>
       Case Files Html Upload Page
       </title>
       </head>
       <body>
       <cg:HtmlUploadComponent
       objectId="{!Case.Id}"
       customObjectFileName="CaseFile__c"
       fileNamespacePrefix="cg__"
       relationshipName="Case__r"
       privateEnabled="true"
       isUsePopup="true"
       debug="true"
       />
       </body>
       </html>
       </apex:page>

**currentFolderId** (optional) is the Id of the parent folder for the files to be uploaded. It is not provided by default.

See the [Classic Override](https://docs.sdriveapp.com/2.22/classic-override-page-for-s-drive.md)page for an explanation of the rest of the attributes.

Click Save.

Set the security for your page on other profiles. Go to Setup -\> App Setup -\> Develop -\>

Pages and click Security link next to your page name  
![image-20210517-164017.png](https://docs.sdriveapp.com/__attachments/a_0c10cd164226404cdee79fda1e4c38b89147ffc06c4c7a39f3a7b664e94c1c71/image-20210517-164017.png?cb=292b0cc3d32c66bd9cc716ac6f8a575e)

Move all profiles (or select based on your needs) from "Available Profiles" to "Enabled Profiles" as shown. If you skip this step, your users that belong to the disabled profiles will see an error page.

![worddav9d2adda2469af00bcd2ebabd83369d8f.png?version=1&modificationDate=1614710495591&cacheVersion=1&api=v2&width=332&height=232](https://docs.sdriveapp.com/__attachments/a_805c58fb202aee88b4def8d869b47c3d12625dcebde4a1fabab92a76dbc7a187/worddav9d2adda2469af00bcd2ebabd83369d8f.png%3Fversion=1&modificationDate=1614710495591&cacheVersion=1&api=v2&width=332&height=232?cb=9d2adda2469af00bcd2ebabd83369d8f)

Now we have a custom HTML upload page. At this point, you can use this HTML upload page wherever you want like below figure ( Figure 7 35) if you give appropriate parameters.

![worddavc026bb9c7ead285f96ef9e08eab7251f.png?version=1&modificationDate=1614710496296&cacheVersion=1&api=v2&width=628&height=213](https://docs.sdriveapp.com/__attachments/a_123cd2b1c33bb85834d04230b6c453434759f49f27d4fda622f037e23b34e0f3/worddavc026bb9c7ead285f96ef9e08eab7251f.png%3Fversion=1&modificationDate=1614710496296&cacheVersion=1&api=v2&width=628&height=213?cb=c026bb9c7ead285f96ef9e08eab7251f)

---
language: "en"
---
# Custom Settings--S-Drive Config

This section explains the hidden custom settings that are not exposed to the end users via "S-Drive Configuration" page. You can manage these configuration objects via **Setup -\> App Setup -\> Develop -\> Custom Settings** menu. Then you can click **"Manage"** next to the **"SDriveConfig"** label and add these custom settings with appropriate values.

**MultipartUploadThresholdSize:** This configuration is used for HTML Upload and Java Upload Widget to decide normal upload or multipart upload based on the file size. Default is 5 MB. So, files above 5 MB (or configured value) will be uploaded via multipart upload mechanism, below 5 MB (or configured value) will be uploaded via normal upload mechanism that is used same way in Flash Upload Widget.

**MultipartUploadPartSize:** This configuration is used for HTML Upload and Java Upload Widget to split the file to be uploaded into parts for multipart upload. Default is 5 MB. This value can be between 5 MB and 5120 MB. So, if you'll upload a 50 MB file while this configuration is set to 5 MB, it'll split the uploaded file into 10 parts while uploading.

**CustomPopupMessage:** This configuration is used for HTML Upload to customize the default message in it. If you do not add this configuration, "*Drag files here or click Add button to select files for upload.* " message is displayed by default.

**ViewSettings**Custom Settings can be used to show different views of the S-Drive component to different users. By default, the columns shown in S-Drive for both Classic and Lightning come from the S-Drive Configuration page/Customization Settings tab as shown here.  
![image-20210517-143820.png](https://docs.sdriveapp.com/__attachments/a_bef6e96b4eb62a8b74b7750814c6c70e5c054618da3d3782b5d6f82bb1fc6436/image-20210517-143820.png?cb=9b64a5f8a89413bdf9efd20599f9d74e)

If the system admin changes these fields from the original default, S-Drive stores those in Custom Settings-\>**SDriveConfig** , click manage and look for FS_cg_*ContactFile*_c or whichever object you want to check.

If a **user** changes the fields shown using the **Fields button** on the S-Drive Lightning Component, and clicks "save" (rather than "apply") then a new **ViewSettings** (Custom SettingsViewSettings \|Manage) will be created for that User. (Note: users must have Customize Application permission save the settings. Most users do not have this permission.) To go back to the defaults, delete the custom setting for the user.  
![image-20210517-143847.png](https://docs.sdriveapp.com/__attachments/a_e1d34281556e454b323d08106df789b727454274bcc4f75a6e6f0f8402e960f0/image-20210517-143847.png?cb=5a099dd1baff0e158da0099e18f706d1)

Different views for different users or profiles can also manually be created here by the system admin by clicking New.  
![image-20210517-143911.png](https://docs.sdriveapp.com/__attachments/a_1174fe080c453b8899a9c49cf02336f50f43ad308e2e1ff8a2834c11fe6d1a9e/image-20210517-143911.png?cb=5d7956841a058933b3702ae136ff49ab)

The format for these fields is Object1:field1;field2;field3,Object2:field1;field2,Object3:etc

Note:

* there is a colon ( : ) after an object

* semi-colons ( ; ) separate fields

* a comma ( , ) separates the first object field group from the next object.

* If you run out of room to type in the first box, continue in the second box and so on

* Object Selected Fields is for setting which fields/columns are displayed in the component

  * cg_S3Object_c:cg_File_Name_c;CreatedDate;CreatedById;cg_Description_c;cg_Tags_c,cg_AccountFile_c:cg_File_Name_c;cg_Tags_c;cg_Content_Type_c

* Object Sort Field is for setting which field to sort on. The format is as follows:

  * cg_*S3Objectc:CreatedDate:asc,cgAccountFile*_c:CreatedDate:desc

* Object View Type is for setting the view---list, thumbnail or grid. The format is as follows:

  * cg_*AccountFilec:grid,cgS3Objectc:thumbnail,cgCaseFile*_c:thumbnail

---
language: "en"
---
# Customization Settings

This section allows a system administrator to change field display settings of S-Drive Files and S-Drive Tab objects.  
![image-20210602-154903.png](https://docs.sdriveapp.com/__attachments/a_efc1bcbee4f6e8a0bc276deb0c2bde1faf5b00ee916323de36ea4d323868815e/image-20210602-154903.png?cb=9bbe59ebf93f0f52a91461e773adcb0b)

By default, the S-Drive file areas of all objects have these columns: "File Name", "Created Date", "Created By ID", File Size", "Description" .  
![image-20210602-154327.png](https://docs.sdriveapp.com/__attachments/a_20862ce426d227b219387ae8e3bdc40813b456cd85073291132502851d5ef636/image-20210602-154327.png?cb=b682c999ef72c2456a90682ca40b14fa)

To set the field display settings for an object, select the object from drop-down. Select the fields from "Available Fields" and click right arrow button to move these fields to the "Displayed Fields" section. You can also change the order of the fields by using Up-Down arrows. Click "Save" button to save changes. Note that you cannot change the first column of the file list, it is fixed as the "File Name" field.

++Note:++ If you allow users to set files to Private, you must display the Private field here.

The chosen fields will be the default fields for all users.  
Admins can choose to display different fields for different users or profiles using [Custom Settings](https://cyangate.atlassian.net/wiki/spaces/PS2D/pages/1344045865/Custom+Settings--S-Drive+Config).

The fields configured will also be the fields that are available on the upload page and on the edit page.  
![image-20210602-160035.png](https://docs.sdriveapp.com/__attachments/a_0de04f05f338c938fe36b58bb89488721ab0fcac472bdbbc7f46c2eba1a117c7/image-20210602-160035.png?cb=fad3113ce7a2855f969cb70f7565fb24)

## **Configuration**

![image-20210602-160104.png](https://docs.sdriveapp.com/__attachments/a_8901764f48034294c894b60246fb104c7ce833c5b1caf10a193734ee20ef0bfa/image-20210602-160104.png?cb=8ee9b9e3069f5faa733c865822aabc30)

### **S-Drive Component**

![image-20210602-155928.png](https://docs.sdriveapp.com/__attachments/a_505dca15e53d67ce4e966990a265f295cc5e4488ffe36bdf40f83c727054e1a9/image-20210602-155928.png?cb=3e9a8593c1f2dec98d07544904b5d5d8)

#### **Upload page**

![image-20210602-160010.png](https://docs.sdriveapp.com/__attachments/a_9f98c02d5241356611b85bbc27fe6bf735363a35e7a0eca0b30a3ca29b5c50e0/image-20210602-160010.png?cb=110e7cf93b7553c511443f1187d67fcb)

##### **Edit Page**

---
language: "en"
---
# deleteFiles

This method is used to delete files stored as attachments or under S-Drive folders.

List\<ResultObject\> deleteFiles(List\<ID\> wipIds, String objectId)

***Parameters:***

**wipIds:** List of Salesforce.com IDs of "file" records (either attachments or S-Drive Folder files).

**objectId:** Id of the parent object. You can use 15-character or 18-character Salesforce.com ID.

***Return Value:*** The method will return a list of ResultObject (Figure 8) which holds delete status information for each file record.

*Example code:*

    List<Id> wipIds = new List<Id>();
    wipIds.add(ID.valueOf(uploadRequestInfos .fileWipId));
    List<cg.ResultObject> resultObject = cg.SDriveTools.deleteFiles(wipIds, objectId);

If you enable versioning and add a latest version file id into wipIds list, all versions of that file will also be deleted. You can also delete a single old version file by adding its id into wipId list.

---
language: "en"
---
# deleteMultiParts

This method is used to delete multi parts.

void deleteMultiParts(String awsMultiPartsLocationList)

**Parameters:**

**awsMultiPartsLocationList:** List of parts keys as the names of file locatons. It must contain up to 1000 keys because of limit.

**Example code:**

    List<String> awsMultiPartsLocationList = new List <String>();
    for(Integer i = 0; i<= multiPartsSize-1; i++)
    {
    awsMultiPartsLocationList.add( fileLocation + '.' +i );
    }
    cg.SDriveTools.deleteMultiParts(awsMultiPartsLocationList);

---
language: "en"
---
# deleteS3Files

This method is used to delete files from the S3 bucket. It does not delete the S-Drive file records, so that needs to be done separately.

cg.SdriveTools.deleteS3Files(List awsLocationList, List versionIdList)

**Parameters:**

**awsLocationList** is the Key__c field

**versionIdList** is the version_id__c fields.

This returns void if the delete is successful and an exception if unsuccessful.

**Example code:**

    List<cg__CaseFile__c> caseFiles = Database.query('Select id, cg__Key__c, cg__Version_Id__c from cg__CaseFile__c');
    List<String> awsLocationList = new List<String>();
    List<String> versionIdList = new List<String>();
    for(cg__CaseFile__c caseFile : caseFiles)
    {
      awsLocationList.add(caseFile.cg__Key__c);
      versionIdList.add(caseFile.cg__version_id__c);
    }

    cg.SdriveTools.deleteS3Files( awsLocationList, versionIdList);

    //After delete from s3 is successful you should delete the records Salsforce as well like below.

    delete caseFiles.

---
language: "en"
---
# E-Signature

S-Drive's E-Signature feature allows you to send a document directly to DocuSign\* and have the signed document returned directly to S-Drive. See [E-Signature Integration](https://docs.sdriveapp.com/2.22/e-signature-integration.md) to configure E-Signature integration.  
![image-20220930-133452.png](https://docs.sdriveapp.com/__attachments/a_831328c764121236e4df0a81c91263fc7e14d22f422ab87fb0bd9fd067b7b28b/image-20220930-133452.png?cb=9c4aee336ec42f2e5915a7fe740932e7)

Clicking**Send for E-Signature** takes you to the DocuSign App to complete the process.  
![image-20220930-133357.png](https://docs.sdriveapp.com/__attachments/a_24b1fe6d6f6ff02e07a7fbb140147dc7b19ba85a76233a50e5f19dd6c5ed7ae8/image-20220930-133357.png?cb=472870e2d8210fea1374fe1239de3841)

When configuring E-Signature, for each S-Drive object. you can choose to have the signed file returned to the root directory of S-Drive, to the same directory as the original file, or as a new version of the original file.  
![image-20220923-183846.png](https://docs.sdriveapp.com/__attachments/a_1d6dacfbe530d9c0351791e4d27ef0a1036a2181515681ecf4a49090c9ead3a8/image-20220923-183846.png?cb=4c27f076c6e21da5e4f58ef7d215c0e1)

\*More E-Signature integrations coming in future

---
language: "en"
---
# E-Signature Integration

S-Drive's E-Signature feature allows you to send a document directly to DocuSign\* and have the signed document returned directly to S-Drive.

To Configure E-Signature Integration, go to S-Drive Configuration Micro Services tab. Scroll down to E-Signature Integration and click Configure.  
![image-20220923-184905.png](https://docs.sdriveapp.com/__attachments/a_17cdf757679a49fb84076bce9404ea75b0d9ffe7ef305ddce3e8702deb07ec37/image-20220923-184905.png?cb=cc1517760dce23b181b9cf301a812d5b)

![image-20220923-184842.png](https://docs.sdriveapp.com/__attachments/a_732e38ff576eccde82011b8c8be68c5bd8fe18ab3073893023ca2991f3ef196d/image-20220923-184842.png?cb=7dba82110beec17f8cfd5765055a9976)

On the following page

* Click the DocuSign radio button.

* Check the boxes next to the objects you wish to enable for E-Signature.

* In the "Signed Document Location" column, choose where you want the returned signed document to appear.

  * Upload as New Version - uploads the signed document as a new version of the original file

  * Upload to Same Directory - uploads the signed document to the same folder as the original file

  * Upload to Root Directory - uploads the singed document to the root/home directory

* Click Save

![image-20220923-185147.png](https://docs.sdriveapp.com/__attachments/a_3c667cc4e8aa599ecf7052bfe8a4c206c3fbaa0bd33fdf458fe684218b0ae56c/image-20220923-185147.png?cb=45f95f5a790ef662435f437d75c4f7e7)  
If you choose **Upload as New Version** , your bucket must be versioned. See [Managing Your Buckets](https://docs.sdriveapp.com/2.22/managing-your-buckets.md) for instructions to enable versioning.

Once configured, files on the chosen objects will have a new action: **Send for E-Signature.**  
![image-20220930-133452.png](https://docs.sdriveapp.com/__attachments/a_913204b321a1832dfc184d0198b2472b63633d55b91cffe3db276d2577537aa4/image-20220930-133452.png?cb=9c4aee336ec42f2e5915a7fe740932e7)

Clicking on Send for E-Signature will take you to DocuSign to complete any additional steps that may be needed based on your DocuSign setup.  
![image-20220930-133357.png](https://docs.sdriveapp.com/__attachments/a_b7cb68f5030f47e208ca9505b3b358bbdfafdd9f50f016c9c25dd86aaa889cc5/image-20220930-133357.png?cb=472870e2d8210fea1374fe1239de3841)

---
language: "en"
---
# Email "S-Drive Tab" Files from an Object using a Custom Button (Classic)

In Lightning, you can use the S-Drive Email component to email S-Drive files from any other object.

*Note: This feature can be enabled by using "Attach from S-Drive Folders" button on any S-Drive object. Refer to "Emailing Files" section of S-Drive User Guide.*

Creating this button allows you to email files stored on S-Drive tab from other objects. Instructions for Case Files are provided below, but you can follow the same instructions for Accounts, Contacts, Opportunities or other standard/custom objects:

1. Navigate to **Setup -\> Customize -\> Cases -\> Buttons, Links and Actions** . Click **New Button or Link** button.

2. Fill in **Label** and **Name** fields, select **Display Type** , **Behavior** and **Content Source** areas as in the figure below then type **window.open('apex/cg_** ***Sdrive?objectId={!*** [***Case.Id***](http://case.id/)***}')*** *into the formula area. If you would like to open S-Drive page as inline and without header, type* ***window.open('apex/cg*** **_Sdrive?objectId={!** [**Case.Id**](http://case.id/)**}\&inline=1')** instead (Figure 9 28).

   ![worddavbf10e093ccfd98ed24367d6a629ab87f.png?version=1&modificationDate=1614710553671&cacheVersion=1&api=v2&width=401&height=287](https://docs.sdriveapp.com/__attachments/a_a779470bde30ea79f04ca002fb78100b9b82e277be5a580b15212bc697c1b2ce/worddavbf10e093ccfd98ed24367d6a629ab87f.png%3Fversion=1&modificationDate=1614710553671&cacheVersion=1&api=v2&width=401&height=287?cb=bf10e093ccfd98ed24367d6a629ab87f)

   Click **Save**
3. Make sure that you have added the custom button into Case page layout. You can't see the "Email S-Drive File" custom button on Case page, if you do not add to the Case object's page layout.

4. Open a case record and click on the custom button

   ![image-20210517-154757.png](https://docs.sdriveapp.com/__attachments/a_d0539be426e98de07746bea16268a75e9e181abef0e85d778462641044180d5c/image-20210517-154757.png?cb=6f991eb0ca86c7d75c2a0824e0c7613e)

5. Select files to send as an email and click Email button

   ![image-20210517-154814.png](https://docs.sdriveapp.com/__attachments/a_7c0ca6c8f73576ae6cd5929bf5d3bca25acce90d888622ec629cf77e6a8ca288/image-20210517-154814.png?cb=1f3cf515500113d95c2c7be6d02cc841)
6. You can see that "Related to" field is populated with related Case (Figure 9-31). Fill in the

   other fields and click Send button.

   ![image-20210517-154835.png](https://docs.sdriveapp.com/__attachments/a_f887865f794710efc9f1dfbe70cd6b4647a91c54eb5616c72bf9829ba4e5004f/image-20210517-154835.png?cb=5a86ad54cbe58146c9ecb1cf2841876f)
7. You can follow the same instructions for other objects. If you would like to create a custom

   button on Account, apply all the instructions for Account object and type

   "objectId={![Account.Id](http://account.id/)}" into formula area, instead of "objectId={![Case.Id](http://case.id/)}" while creating a

   custom button on Account. For any object, type "objectId={![ApiNameOfAnyObject.Id](http://apinameofanyobject.id/)}" into

   formula area.

---
language: "en"
---
# File Activities and S-Drive Reports

## File Activities

**Permissions** If you enable File Activities, users need CRUD permission on the File Activities object in order to see or create file activities.

File Activities track user activities on all file records in S-Drive. Actions such as Download, Open, Copy URL are stored in the File Activities objects and can be easily tracked inside S-Drive or with Salesforce Reports. They can be configured for different types of activities separately for your S-Drive file objects. The user and activity time are also recorded as well as the activity type and additional details if there are any.

See the Files Setting section on the [General Settings](#) page for more information on how to enable and configure this feature.

Once configured, File Activities show on the Audit tab on the file detail in the S-Drive Component.  
![image-20211208-151933.png](https://docs.sdriveapp.com/__attachments/a_8874cdb5fda08f3c5573c052ee5a4e6169dde4003fb3992b803d7752832f28d9/image-20211208-151933.png?cb=90f09747132b2e3637a51378ae89ad58)

## S-Drive Reports

S-Drive reports can be created that show files on objects. The following reports come out of the box. If you go to Reports from the App Launcher and click New Report and type file in the search box, you'll see the following:  
![image-20210517-151803.png](https://docs.sdriveapp.com/__attachments/a_f6f2fce2e4bd6e884e759f540a4c3eb8661c5c18beaec8902272d5cdd96ac784/image-20210517-151803.png?cb=ecd5d030f4b8f8ff96bee227bb53df38)

File Activities must be enabled in order to user the File Activities reports.

---
language: "en"
---
# File/Attachment Sync (Free)

File/Attachment Sync takes files that are uploaded to Salesforce Files or Salesforce Attachments and syncs them with S-Drive for the selected object. Sync is processed based on a queue, so new items will appear in S-Drive in a few seconds/minutes.

After configuring File/Attachment Sync, new file/attachment will be uploaded to S-Drive automatically. You can also configure deleting the Salesforce files/attachments after successful configuration.

To sync file/attachments to S-Drive, click the "configure sync" button. You will see a message that it is processing objects. This is processing that is done in order to display next configuration screen shown below.  
![image-20210514-174110.png](https://docs.sdriveapp.com/__attachments/a_778a0e37751e64010090eb5a3f822d80977c5524472f6331741511310d518481/image-20210514-174110.png?cb=bccf9936389f987c3f9a16a76532e552)

For each Object **(1)** for which you want to sync files or attachments, select the S-Drive file object you want to use for syncing from the dropdown list **(2)** . There will usually only be one choice.

In the Object File Relationship field **(3)** , enter the API name of the field that relates to the parent object. For the S-Drive File Objects that come bundled with S-Drive, these will be cg_*Account__c, cg__Case__c, cg__Contact__c, cg__Lead__c, cg__Opportunity__c.* For S-Drive file objects created by you (those that didn't come standard with S-Drive), it will be Parent_c.

Check the checkboxes **(4)** and/or **(5)** to indicate whether you want to sync files, attachments, or both.

Click Save.

In "General Settings" section you can enable handling files/attachments in email messages by checking "Enable to Handle Email Files/Attachments" **(6)** . You can check "Enable to Delete Files/Attachments After Upload" configuration, if you want to delete the Salesforce Files/Attachments after successfully syncing to S-Drive**(7)**. If you uncheck this option, both Salesforce Files/Attachments and S-Drive will be available after syncing.  
**Behavior of "Enable to Delete Files/Attachments after Upload"**

The Salesforce file will be deleted from the record it's synced to.

It will also be deleted completely from Salesforce, saving storage, except in the following circumstances:

* If the file is shared to records on other objects, but not configured to sync, the file will remain on those records and not be deleted from Salesforce.

* If the file is shared to Chatter groups, it will not be deleted from Salesforce.

If the file is shared with other users or came from an email, but is not shared to other records or groups, it will be completely deleted from Salesforce.

File Sync and Attachment Sync use the AttachmentSync object. AttachmentSync records are created and then deleted once the sync is complete.

**If you have failed or hung AttachmentSync records and you delete them manually while "Enable to Delete Files/Attachments After Upload" is checked, you may lose files**that were not yet synced to S-Drive. If you wish to delete old AttachmentSync records, first uncheck "Enable to Delete Files/Attachments After Upload."

Click Save **(8).**

In "Sync Status" section**,** you can see failed sync job **(10)** and progressing sync job **(12)** counts and can click to retry failed jobs **(11)** . After clicking this button, you can see updated sync status You can refresh the failed and progressing file/attachment sync count status by clicking "Refresh Sync Status" **(13)** button.

In "Configure File Sync of Pre-existing Files" section, you can sync older Salesforce Files with SDrive. If you want to enable pre-existing Salesforce file sync for an object, you just need to select the "Object File", fill the "Object File Relationship" field and check the related "File" checkbox. You can go to the configuration page by clicking "Go" button **(14).** This takes you to the screen below.  
![image-20210514-174135.png](https://docs.sdriveapp.com/__attachments/a_9bfdb856eb4ffac7dda8cfbf5ae5ad5d2ae39d4c45af4e7649608e630d0ab3d1/image-20210514-174135.png?cb=05f274ebe09a4551143179d041215ba6)

If you want to sync pre-existing Salesforce Files for an object, Look for the desired object in the Object section **(1)** and select the "Object File"**(2)** to be used for syncing. Check "Create" **(3)** checkbox. Click "Generate File Sync" button **(4).**

You can inspect individual "AttachmentSync" objects to see more details and see "File/Attachment Sync" section of this document for more details about the sync process.

**A note about Permissions**

File Sync and Attachment Sync use a **callout** to sync the file or attachment to S-Drive. So you must configure the **outbound message user** correctly:

**Check Setup\>outbound Messages** for the following 3 items

* AttachmentSync

* FileSync Callout

* Preview Callout

**Check the "user to send as" profile.** It must have

* **Customize Application** permission

* **Send Outbound Messages** permission

* **Query All Files** permission ([which can only be applied using a permission set.](https://help.salesforce.com/articleView?id=000353032&language=en_US&mode=1&type=1))

**Users who upload files that will be synced** must also have

* **Attachment Sync** object profile permission (read/create/edit + field accessibility)

* **Send Outbound Messages** permission.

---
language: "en"
---
# File Objects Resource

**Endpoint**

https://\\{*instance* }. [salesforce.com/services/apexrest/cg/SDrive/fileObjects](http://salesforce.com/services/apexrest/cg/SDrive/fileObjects)

**Methods**

GET

**Method Details**

**GET**

**Request Body Parameters**

none

**Response Body Parameters**

*fileObjects* : List of Apex API names of SDrive file objects in the org.

Type: string\[\]

**Status Codes** 200 -- Success

---
language: "en"
---
# File Sync/Attachment Sync

File/Attachment Sync takes files that are uploaded to Salesforce Files or Salesforce Attachments and syncs them with S-Drive for the selected object. Sync is processed based on a queue, so new items will appear in S-Drive in a few seconds/minutes.

Once you configure File/Attachment Sync with S-Drive, you can start using File/Attachment Sync features. See [File/Attachment Sync](https://docs.sdriveapp.com/2.22/file-attachment-sync-free.md) to configure this feature.

Below is an example screenshot in Classic after user uploads a File to the Files section of the Accounts. It creates into the S-Drive. This feature works in Classic and Lightning.  
![image-20210517-145512.png](https://docs.sdriveapp.com/__attachments/a_f87af5e355056232f1e687b5087220722e0bfcaed1cf6a92988513ec2100e14d/image-20210517-145512.png?cb=972eeae89dc769a3923c327b1c20804d)

You should also note that sync operation only happens once the file is uploaded to the Salesforce Files/Attachments section. Deletion or updates to the Salesforce File/Attachment do not delete or update the synced item in S-Drive section. Sync is triggered only with addition of a new Salesforce File/Attachment. Sync is only one way, so any changes to the S-Drive are not reflected to Salesforce File/Attachment. After sync'ing, those files/attachments are two distinct objects.

This process also does not sync the previously created Salesforce Files/Attachments before the sync configuration. You can sync those files with S-Drive navigating to "**S-Drive Configuration - \> Micro** **Services -\> Sync Salesforce Files/Attachments with S-Drive** -\> **Configure File Sync of Pre-existing Files"** section.

**Permissions**

**Users who upload files that will be synced** must have

* **Attachment Sync** object profile permission (read/create/edit + field accessibility)

* **Send Outbound Messages** permission.

Additionally, File Sync and Attachment Sync use a **callout** to sync the file or attachment to S-Drive. So you must configure the **outbound message user** correctly:

**Check Setup\>outbound Messages** for the following items (Only FileSync and/or AttachmentSync apply to File/AttachmentSync, but it's good to check the others as well.)

* AttachmentSync

* FileSync Callout

* Preview Callout

* FileSizeRequest Callout

**Check the "user to send as" profile.** It must have

* **Customize Application** permission

* **Send Outbound Messages** permission

* **Query All Files** permission ([which can only be applied using a permission set.](https://help.salesforce.com/articleView?id=000353032&language=en_US&mode=1&type=1))

* **Session Security Level Required at Login** must be**None.** It cannot be set to High Assurance

  ![image-20220128-163008.png](https://docs.sdriveapp.com/__attachments/a_8ed1da3c9fd177d1ca5a07611e6d066473a5be336319bee449b7eb9a590fa974/image-20220128-163008.png?cb=187bf46741968760f96888c4a79dcbde)

## File sync with Chatter

Files attached to Chatter posts are "Files" in Salesforce and are synced to S-Drive if file sync is configured. If you check the "**Enable To Delete Files/Attachments After Upload**" box, then the Chatter file is deleted from the Chatter post. A message will be displayed saying that the file was synced to S-Drive.

In this "before" image, a file is attached to a Chatter post.  
![image-20210908-173723.png](https://docs.sdriveapp.com/__attachments/a_ddf99c0214893ef0ef50237c73c7762ad54d88e7e0d3e749701b011d9c747444/image-20210908-173723.png?cb=db1a35bf1cb98531ef15dac85e571c9d)

After refreshing the page, it is synced to S-Drive and a message appears in the Chatter post telling the user the file was synced.  
![image-20210908-180435.png](https://docs.sdriveapp.com/__attachments/a_c8fc7bd88796cba6c76f6468dfcea721398fd60b9802297d6b61402ba14a831c/image-20210908-180435.png?cb=4d67e21a771cc6cf1eecb4bc2db7ea72)

---
language: "en"
---
# Files Resource

**Endpoint**

https://{*instance*}.salesforce.com/services/apexrest/cg/SDrive/files

**Methods**

* GET

* POST

* PUT

* DELETE

**Method Details**

* **GET**

**Request Query Parameters**

*fileObjectId* : ids of the file you want to query

*parentId* : ids of the parent object of the requested file. If file object type is an S3 object members of this array can be null or invalid input but array lengths must still match.

*timeValue* : Expiration time of the links in seconds

*requestParameters* (Optional) : Any remaining parameters will be included as additional query parameters for the Amazon file link(e.g. ('response-content-disposition', 'inline; filename=myfile.png')).

For more information, visit the Amazon documentation:

<http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html>

**Response Body Parameters**

*fileUrls* : JSON array of requested file URLS.

Type: string\[\]

**Status Codes**

200 - Object received

403 - Wrong input formatting

404 - False ids

422 - Wrong input semantics

* **POST**

  **Request Body Parameters**

  *objectId* : Id of the parent object this file will be uploaded to

  Type: string

  *multipartUpload* : Do multipart Upload, used for big files(currently unavailable)

  Type : Boolean

  *fileType* : File Object the new files will be uploaded as.

  Type: string

  *fileProperties* : JSON array of file metadata of the uploaded files.

  Type: fileProperty\[\]

  *policyMap* : Key value pairs that represent the additional policy parameters used during upload

  Type: string\[\]

  **Response Body Parameters**

  *uploadRequestInfo* : JSON object that details how to upload a file to Amazon S3

  Type: uploadRequestInfo\[\]

  **policyMap** : Map of policy conditions and theirs values that represent the additional policy parameters used during upload (e.g. (*'$Content-Disposition'* , '*attachment; filename* )). For more information, visit the Amazon documentation:

  <http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html>

  **FileProperty** :

  fileName : string

  fileLocation : string

  description : string

  relationshipFieldName : string

  fileType : string

  fileSizeInBytes : string

  **UploadRequestInfo** :

  fileName : string

  fileLocation : string

  fileSize : string

  fileType : string

  wipFileId : string

  signature : string

  policy : string

  timeStamp : string

  awsRegion : string

  awsCredential : string

  metadataHeaders: object

  s3EncryptionType: string

  **Status Codes**

  201 - Object properly created

  403 - Wrong input formatting

  404 - False objectId

  406 - Invalid input

  412 - Missing input fields

  422 - Wrong input semantics

  **Usage**

  Use POST to initiate an upload. Creates File Object records on S-Drive. Follow it by uploading the files using the data in uplodRequestInfo to Amazon S3 then finish with the PUT method. Corresponding field names to AWS form fields are as follows.

  fileName : used in Content-Disposition

  fileLocation : key

  fileType : Content-Type

  signature : x-amz-signature

  policy : policy

  timeStamp : x-amz-date

  awsCredential : x-amz-credential

  s3EncryptionType: x-amz-server-side-encryption

* **PUT**

  **Request Body Parameters**

  *wipIds* : JSON array of Salesforce ids that have completed their uploads to Amazon S3.

  Type: string\[\]

* *versionIds(Optional)* : JSON array of AWS S3 version ids ids that have completed their uploads to Amazon S3.

  Type: string\[\]

  **Response Body Parameters**

  *resultObjects* : JSON object that details the status of each file's upload request.

  Type: resultObject\[\]

  **ResultObject**

  status : string ( success or fail)

  error message : string ( empty if status is success)

  wipField : string ( to see which file failed)

  **Status Codes**

  200 - Upload complete

  403 - Wrong input formatting

  404 - False wipIds

  422 - Wrong input semantics

  **Usage**

  Done after the POST method and uploading files to the correct location in Amazon S3.

* **DELETE**

  **Request Query Parameters**

  *objectId* : Id of the parent object.

  *wipId* : Salesforce id of the object that will be deleted from S-Drive and Amazon S3.

  **Response Body Parameters**

  *resultObjects* : JSON object that details the status of each file's delete request.

  Type: ResultObject\[\]

  **ResultObject**

  status : string ( success or fail)

  error message : string ( empty if status is success)

  wipField : string ( to see which file failed)

  **Status Codes**

  200 - Object deleted

  403 - Wrong input formatting

  404 - False objectIds

  422 - Wrong input semantics

  **Usage**

  Deletes the File from Amazon S3 then removes the file record from Salesforce

---
language: "en"
---
# General Settings

This section allows a system administrator to change several system wide configuration options. Each section is described below.  
![image-20221019-163404.png](https://docs.sdriveapp.com/__attachments/a_4cefdac36e88d17783c2b374291441b8f4091f8ae7052185813efb86bfd9eeb3/image-20221019-163404.png?cb=992297aac897362ce80d68bd54725ddd)  
![image-20221019-163241.png](https://docs.sdriveapp.com/__attachments/a_2aca8ceaef354340fedb6e0d7732d36739cdfecb901c7cbb04be260213d989c9/image-20221019-163241.png?cb=17fa6406759963d77e69c3b167be7344)

## Mail Settings

![image-20210514-154723.png](https://docs.sdriveapp.com/__attachments/a_4782110dbd6b5c37afd88b22eaf983102c60f072fbbc6fef0a6adec3cdec77e9/image-20210514-154723.png?cb=cdc935435d6a06b4273a859a7873a4ee)

**Custom Email Footer** This configuration will allow a system administrator to change the system wide S-Drive Email footer. The default email footer that is added to your email messages is **"** *Attachment is stored online at S-Drive. To open this file, just click the link above."*

**Default Email Expiration Time**This configuration will allow a system administrator to change the system wide S-Drive Default Email Expiration Time when sending email from the S-Drive component. If you do not set this value "Never Expires" is selected by default in the email screen. If you set a value, it will be displayed to all users that are using email screen. Users can always modify the email expiration time while sending the emails.

**Embed Thread Id in Case Emails**By setting this configuration, it adds thread id into the email of the case file. So, replies to that e-mail message are recorded in the Activity History of the same case and attachments in the replies are saved in the same case. This configuration is useful for the organizations that are using S-Drive Email Agent.

**Case Email Reply-To Address**Reply-to address for case related emails sent out via S-Drive. Usually this email address is the general support email address. This configuration is useful for the organizations that are using S-Drive Email Agent.

## File settings

![image-20220127-222351.png](https://docs.sdriveapp.com/__attachments/a_7aba31c3cd36e83309b7a376a9901d66dee07397873914280d08f302255e6400/image-20220127-222351.png?cb=4c00ac67a1998ea368cf7e83a2065ca9)

**S-Drive File Objects List** This is a list of S-Drive File Objects. All S-Drive File objects, including custom file objects that you create, must be listed here. Click "Manage" to access the list. See <https://cyangate.atlassian.net/l/c/R2jUSL1v> for details.

**Max File Size in MBs** This configuration will allow a system administrator to change the system wide behavior of max file size limit for uploads. File size limit is actually 5TB per file; however, due to Flash plug-in and browser limitations, the practical limit for file upload size via the browser is 2GBs. With this option, the user will be limited to a file size for each file. So, if you set maximum file size to "10". Users won't be able to upload files greater than 10 MBs.

If users try to upload a file greater than the limit, they will see an error message saying "Files greater than XYZ cannot be uploaded!"

**Enable File Activities**File Activities feature is a way to track the user activities on all file records in S-Drive. Actions such as Download, Open, Copy URL are stored in File Activities objects and can be easily tracked inside S-Drive or with Salesforce Reports. They can be configured for different types of activities separately for your S-Drive file objects. The user and activity time are also recorded as well as the activity type and additional details if there are any.  
Enabling File Activities will consume data storage on your Salesforce organization.

The dropdown list shows all object files for objects using S-Drive. (See Note below if your file object is not on the list.) Choose the object file to configure from the dropdown list. Then select the activities you want recorded by moving them from Available Activities to Selected Activities. Click Save at the top or bottom of the page, then repeat for other object files you wish to use File Activities on.

The list of available file activities are as follows:

* Download

* Download SUrl

* Generate SUrl

* Open

* Copy URL

* Zip and Download

* Preview-Expand

* Preview-Detail

* Upload

* New Version

* Email Sent

* File Lock Service

* Share

**Note** that for Custom Objects, if the file object is not present in the above picklist, please create a lookup relationship in **File Activity** object with that the desired S-Drive file object. You can create the relationship from Setup \> Objects \> File Activity \> Scrolling to "Custom Fields \& Relationships" section \> Clicking on "New" button \> Select "Lookup Relationship" and select your desired file object as "Related To" from the picklist provided.

## User Settings

![image-20210514-155946.png](https://docs.sdriveapp.com/__attachments/a_3e5d9fe6ed67512985a02c16afb36556cbba99402d57714a139ef5315e24d679/image-20210514-155946.png?cb=1028a346d9791c04fce7307f63943dd5)  
![image-20210908-155553.png](https://docs.sdriveapp.com/__attachments/a_f612574a74914bd952bd3f80e8a6fc9563459c77a59b7e08f07da2a20b984f34/image-20210908-155553.png?cb=ff7f2b7ff885615a33d77e69ff12088d)

**Change File Click Behavior**This configuration is used what happens when a file name is clicked on. Check the checkbox to open a file after it is clicked on, uncheck it to preview a file after it is clicked on.

**Restricted Portal User Profiles** These are [Salesforce.com](http://salesforce.com/) user profiles that are specifically for portal users. User profiles can be "Standard", "Partner", "High Volume Portal", "Customer Portal User", "Customer Portal Manager" and must be separated by comma. By specifying a profile in this configuration, you can prevent access to "private" content for these profiles.

**Only Allow Users with Modify All Permissions to Create Items at the Top Level**This configuration is used to only allow users with "Modify All" permissions (mostly system administrators) to create items at the top level (Home). If this is unchecked all users can create files/folder at the top-level if they have enough permissions. If this is checked standard users won't be able to see "Create Folder" and "Upload File(s)" buttons in the "Home" page of S-Drive Tab.

**Restrict Sharing Categories for Community users**You can choose the sharing rule categories that are displayed in the Share Page, for Community Users. Categories can be "Customer Portal Users", "Portal Roles", "Portal Roles and Subordinates", "Public Groups", "Roles", "Roles and Internal Subordinates", "Roles, Internal and Portal Subordinates", "Users" and must be separated by semicolon. An example input is: Customer Portal Users;Portal Roles. If left blank, all categories are listed.

**Restrict Sharing Categories for Internal users**You can choose the sharing rule categories that are displayed in the Share Page, for Internal users. Categories can be "Customer Portal Users", "Portal Roles", "Portal Roles and Subordinates", "Public Groups", "Roles", "Roles and Internal Subordinates", "Roles, Internal and Portal Subordinates", "Users" and must be separated by semicolon. An example input is: Customer Portal Users;Portal Roles. If left blank, all categories are listed.

## URL Settings

![image-20210514-161229.png](https://docs.sdriveapp.com/__attachments/a_3e0dadf3559daa097121ce0f0d7fc524602bc63aa7aa080831e6b3f6434b4bd7/image-20210514-161229.png?cb=78608acb8c5d3ffa73a06fb95c65b601)

**Copy Url Expiration Date**This configuration is for setting the expiration date of created URL of file.

**Open/Download Url expiration time**This setting determines how long a link will last when a file is opened or downloaded. This is for added security, so that if users copy the url from their browser and share it, you can limit how long that link will work. The default is 600 seconds (5 minutes.)

## Upload Settings

![image-20210908-161353.png](https://docs.sdriveapp.com/__attachments/a_6b44f3b4fc4e75fcbf31d2fdd85d63039bd2bf44e6ebf757f41cb157264ce16a/image-20210908-161353.png?cb=7f4c5f7d4e534af9713d10f552856bf4)  
![image-20220405-191223.png](https://docs.sdriveapp.com/__attachments/a_8931024739372ef960898348316aa68a2614b4a1405cfa2995deca02dc4f166e/image-20220405-191223.png?cb=e6532993380ce022844e6eb7aa394c9a)

**Enable Auto Upload**This configuration is used to enable Auto Upload files without clicking Upload button in file upload window. With this feature, files will upload just from adding them to the upload window or dragging and dropping them.  
NOTE: If there is a required field in one of your objects, auto upload will be disabled. For this setting to work properly, you must refresh all displayed fields and add the required fields to Displayed Fields from Customization Settings.

**Enable Dropzone** This setting enables the drag and drop feature for uploading files

**Default Upload Manager** This configuration is used to set the default upload manager for the whole organization. Possible values are "**Html"** , **"Html with Popup"** Default value is "Html".

**Manage Duplicate Filename Preferences** Clicking the "Configure" button will take you to a page where you can enable or disable duplicate file upload for each file object (such as Account File, Case File, etc).

* If duplicate filenames are allowed, a user can upload a file with the same name as a file that already exists.

* If duplicate filenames are not allowed, the user will get one of two messages depending on their access to the file with the same name.

  * If they have delete access to the existing file of the same name, they will be given the option overwrite the file. If they choose not to, the upload will be canceled.

  * If they do not have delete access to the existing file, they will be told they cannot upload a file of the same name, and be asked to rename their file and try again.

Files with the same name are always allowed in different folders.

## Tag Settings

![image-20210514-163003.png](https://docs.sdriveapp.com/__attachments/a_a2b5ee0ce67d26644669f2e18bf1badc82e703ee0c72540a68dfed90da3eca0e/image-20210514-163003.png?cb=119cbb2da04aeebe65e9538655d1de45)

**Banned Tags** Enter tags here to ban them from being used to tag files and folders on S-Drive. Banned tags should be comma separated.

## Scheduler Settings

![image-20220405-192801.png](https://docs.sdriveapp.com/__attachments/a_a6da2fa89930f98a2e590b704bee24a351e8f6b228e5ac57f362f8964d8434ae/image-20220405-192801.png?cb=f1fe214c7ba07dfc68cc42b2cb83aae5)

**Daily batch jobs execution time**SQueue is a an S-Drive service that executes batch jobs at 00:00 automatically if there are any. You can change execution time of batch jobs in this section. Check your Salesforce system time to set this value. You can check your default system time from Setup \> Company Settings \> Company Information \> Default Time Zone. Daily batch jobs execute the deletion of previews of the files having multiple pages, the copying of files during the lead conversion process, retention policy jobs, and deleting shortcuts when the underlying file has been deleted.

**Daily retention policy batch job execution time** Set the time you want the retention policy batch job to run. See [Records Management (PAID)](https://docs.sdriveapp.com/2.22/records-management-paid.md) for more information.

**Scheduled Payment Job** When connecting S-Drive in the portal, the portal user needs two permissions: Modify All Data, and Customize Application. Once the org is connected, you can remove those permissions from the portal user profile. If you choose to do that, you must have an Admin user (who has Modify All Data, and Customize Application permissions) click the Reschedule button to reschedule the payment calculation job before removing permissions from the Portal user. See <https://cyangate.atlassian.net/l/c/H0h5ryQu> for more information on the steps needed to do this.

## Other Settings

![image-20220405-193628.png](https://docs.sdriveapp.com/__attachments/a_58d52355e21e99171cea44aed0d47163e73475e1adaa0c85a1517027f10dba91/image-20220405-193628.png?cb=1360607ecec2f973dd27eabfaacb6b0e)

**Enable Copying S-Drive Files and Folders When Converting Leads To** This configuration is used to enable users to choose where to copy S-Drive files in Leads when a lead is converted. Available options are Accounts, Contacts and Opportunities. See [Lead Conversion with S-Drive Files](https://docs.sdriveapp.com/2.22/lead-conversion-with-s-drive-files.md) for details.

---
language: "en"
---
# getAccessKey

This method is used to get the AccessKey for setting the *AWSAccessKeyId* parameter during uploads.

String getAccessKey()

---
language: "en"
---
# getAmazonHeaders

This method is intended to be used to get response headers and its values from Amazon after an upload in order to verify the successful upload of the files.

Map\<String,String\> getAmazonHeaders(String item)

***Parameters:***

**item:** File location/key of uploaded file.

***Return Value:*** The method will return the map of response headers and its values (e.g. ETag)

*Example code:*

Map\<String,String\> headResponse = cg.SDriveTools.getAmazonHeaders(**uploadRequestInfos** .fileLocation);

---
language: "en"
---
# getAttachmentURL

This method is used to get the URL of an S-Drive Attachment.

String getAttachmentURL(String parentId, String fileObjectId,

Long timeValue)

***Parameters:***

**parentId:** Id of the parent object. You can use 15-character id or 18-character id.

**fileObjectId:** Id of the attachment (file) object. This can be retrieved using an SOQL query. An example can be found in following sections.

**timeValue:** Expiration time of the link in seconds.

***Return Value:*** The method will return the URL of the S-Drive attachment.

Our example is about retrieving an image file from S-Drive Account Attachments and displaying it inside Account Page Layout. You can customize SOQL call and other options similar to the example.

1. Override Accounts View button with Account Files Page to upload a JPG image file to S-Drive Account Attachments.

   ![image-20210518-135302.png](https://docs.sdriveapp.com/__attachments/a_18a351f6b32b705f9efdea014dee7ef4d8914430d88494cc2157b51e17f3e022/image-20210518-135302.png?cb=18591b924777860a78f0ee210338f0a4)
2. Create an apex class named ExamplePageController. In below code 1\*60 is equivalent to one minute. You can set expiring time like this. Also, you can configure your SOQL query based on your needs.

   ![image-20210518-135319.png](https://docs.sdriveapp.com/__attachments/a_951a686d88ff1d620b9476e8fe250f1dc2300ceca4961023942e952baa3a9e58/image-20210518-135319.png?cb=e8cb3e4bda597ab260d95afbd43ebd14)
3. Create an apex class named ExamplePageController. In below code 1\*60 is equivalent to

   one minute. You can set expiring time like this. Also, you can configure your SOQL query

   based on your needs.

   ![image-20210518-135341.png](https://docs.sdriveapp.com/__attachments/a_a12b5355bed6397f8021b9a8504c487f6a4361889cfcbe8446593b146a210ffe/image-20210518-135341.png?cb=4e4c84d858e8011b13bab3fa9775f1ba)

       public with sharing class ExamplePageController
       {
       private Account acct;
       private String fileURL = '';
       public ExamplePageController(ApexPages.StandardController
       controller)
       {
       this.acct = (Account)controller.getRecord();
       List<cg__AccountFile__c> accountFiles = [Select id from
       cg__AccountFile__c where cg__AccountFile__c.cg__WIP__c = false and
       cg__AccountFile__c.cg__Content_Type__c = 'image/jpg' and
       cg__AccountFile__c.cg__Account__c = :acct.id];
       if(accountFiles.size() > 0)
       {
       fileURL = cg.SDriveTools.getAttachmentURL(acct.id,
       accountFiles[0].id, (1 * 60));
       }
       else
       {
       fileURL = 'http://www.cyangate.com/noimage.jpg';
       }
       }
       public String getFileURL()
       {
       return fileURL;
       }
       }

4. Create an ExamplePage apex page with below content

   ![image-20210518-135550.png](https://docs.sdriveapp.com/__attachments/a_4c7a205e267035271b8e9f1a7d49149dbbdd19d26ce33fa41d19522dd882e842/image-20210518-135550.png?cb=d0100efc4b86fc6c2c8cf29785ce5bfd)

       <apex:page standardController="Account"
       extensions="ExamplePageController">
       <apex:image url="{!fileURL}" />
       </apex:page>

5. Customize your account page layout and include ExamplePage inside the layout.

   ![image-20210518-135621.png](https://docs.sdriveapp.com/__attachments/a_560fd6163144b9c8c306a30d79db750d2806ff6ea771ccaa4305667665895496/image-20210518-135621.png?cb=91fa314096ea7bcf77a7bb06a06b7466)
6. Now if you reload your account (which contains an image file) you'll see a screen like below.

   You can customize the apex class and page based on your needs.

   ![image-20210518-135650.png](https://docs.sdriveapp.com/__attachments/a_44302d0c75d155df293afed9e65226aef9db2c403e671560085bd59dda17fc1e/image-20210518-135650.png?cb=0f89498fbe1a04f4d2045671f34833a5)

   If you would like to get an old version of a file, you should add id of an old version file into

   fileoObjectIds list.

---
language: "en"
---
# getAttachmentURLs

This method is used to get multiple URLs for multiple objects of an S-Drive Attachment at a time.

List\<String\> getAttachmentURLs(List\<ID\> parentIds, List\<ID\> fileObjectIds, Long timeValue)

List\<String\> getAttachmentURLs(List\<ID\> parentIds, List\<ID\> fileObjectIds, Long timeValue, Map\<String,String\> requestParameters)

List\<String\> getAttachmentURLs(List\<ID\> parentIds, List\<ID\> fileObjectIds, Long timeValue, List\<Map\<String,String\>\>

requestParametersList)

***Parameters:***

**parentIds:** List of Salesforce ids of the parent objects. You can use 15-character id or 18- character id.

**fileObjectIds:** List of Salesforce ids of the attachment (files) objects.

**timeValue:** Expiration time of the links in seconds.

**requestParameters:** Map of request parameters and theirs values to set the parameters in the response (e.g. (*'response-content-disposition'* , '*inline; filename=myfile.png'* )). For more information, visit the Amazon documentation:

<http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html>

**requestParametersList:** List of request parameters map for each files.

***Return Value:*** The method will return the list of URLs of the S-Drive attachment.

If you would like to get an old version of a file, you should add id of an old version file into fileoObjectIds list.

[Next Page](https://docs.sdriveapp.com/llms-full.txt/1)
