External File Access and File Sharing In Salesforce Community

Files provide an excellent way to store, upload, find, follow, share and sync any needed information that enables effective collaboration among the users. Files can be used in Salesforce Communities for enhancing collaboration among customers or partners.

External File Access and File Sharing In Salesforce Community

Files provide an excellent way to store, upload, find, follow, share and sync any needed information that enables effective collaboration among the users. Files can be used in Salesforce Communities for enhancing collaboration among customers or partners.

1) EXTERNAL FILE ACCESS

We can access files from Google Drive, SharePoint, and OneDrive for through Salesforce Communities. External Files can be accessed only in Communities which are created through Salesforce Tabs and Visualforce’ template. We can enable Google Drive File Access from salesforceas below:

  • Enable Files Connect
  • Create an Auth Provider for Google Drive
  • Define An External Date Source
  1. Enable Files Connect

Enable Files Connect as per the below instructions:

  • From ‘Setup’ search and choose “Files Connect Settings” under ‘Salesforce Files’ and click ‘Edit’.
  • Check ‘Enable Files Connect’.
  • Choose the ‘File Sharing’ mode as either ‘Copy’ or ‘Reference’.
  • Click the ‘Save’ button.


(Fig 1.1)

  1. Create an Auth Provider for Google Drive

Before creating an Auth Provider, ensure whether the below permissions are available to the users either through ‘Profile’ or ‘Permission Set’,


In order to connect with the files from Google Drive to Salesforce, we need to create a Project under Google Developer Console as follows,

  • After Logging into your Google account, open a new Tab and go to the URL,https://console.developers.google.com/project
  • Check the ‘I Agree’ checkbox and click ‘Accept’.

(Fig 1.2.1)

  • Click ‘Create project’ to create a new project.

(Fig 1.2.2)

  • Enter the ‘Project name’. Then, a ‘project ID’ will be generated and click ‘Create’.


(Fig 1.2.3)

  • Search ‘Drive API’ in the search box and click ‘Enable API’.

(Fig 1.2.4)

  • Choose ‘Credentials’ from the left sidebar and click the ‘Credentials’ tab. Click the ‘Add Credentials’ button, and choose the ‘Oauth 2.0 client ID’.

(Fig 1.2.5)

  • If you get the message ‘To create an Oauth client ID, you must first set a production name on the consent screen’, then click ‘Configure consent screen’.

(Fig 1.2.6)

  • Enter your ‘Email Address’, ‘Product name’ and click ‘Save’.


(Fig 1.2.7)

  • Go to Credentials, under ‘Create client ID’ , choose the ‘Application type’ as

           ‘Web Application’ and click ‘Create’.

(Fig 1.2.8)

  • Note down the ‘client ID’ and ‘client secret’ click ‘Ok’, as it will be used when creating an Authentication Provider in Salesforce.


(Fig 1.2.9)

Create an Auth Provider for Google Drive

  • From ‘Setup’ Search and choose ‘Auth. Providers’.
  • Click ‘New’ under ‘Auth Providers’ to create a new ‘Auth Provider’.

(Fig 1.2.10)

  • Create a New Auth Provider by giving the required values as follows and click ‘Save’ ,

Provider Type – ‘Open ID Connect’

Name – Name for your Auth Provider

URL Suffix – Preferred URL Suffix

Consumer Key – ‘Client Id’ generated in Google Developer Console.

Consumer Secret – ‘Client Secret’ generated in Google Developer Console.

Authorize Endpoint URL – Enter ‘https://accounts.google.com/o/oauth2/auth?’

Token Endpoint URL – Enter ‘https://accounts.google.com/o/oauth2/token’

Default Scopes –  Enter ‘https://www.googleapis.com/auth/drive’

(Fig 1.2.11)

  • After saving the ‘Auth Provider’, copy the ‘Call back’ URL .

(Fig 1.2.12)

  • In the Google Developers Console, Edit the ‘Web Client’ which we created.
  • Enter the ‘Call back’ URL which we copied from Auth Provider as the ‘Authorized Redirect URI’ and click ‘Save’.

(Fig 1.2.13)

1.3) Define an External Data Source

  • From ‘Setup’, search and choose ‘External Data Sources’.
  • Click ‘New External Data Source’ to create a new one.

(Fig 1.3.1)

  • Enter the values for the fields as mentioned below,

External Data Source                      – Preferred name for the Data Source.

Name                                               – Unique name for the External Data Source.

Type                                                 – Choose ‘Files Connect: Google Drive’

Identity Type                                    – Choose ‘Named Principal’

Authentication Protocol                   – Oauth 2.0

Authentication Provider                  – Choose the Authentication Provider which you created.

Start Authentication Flow on Save – To start the authentication test immediately after saving.


(Fig 1.3.2)

After the Authentication Flow is completed, you will be prompted to log into your Google Account.

Login to the Google Account of which Drive Files should be accessed through Salesforce.


(Fig 1.3.3)

  • Click Allow to allow your Drive Files to be shared in Salesforce.


(Fig 1.3.4)

  • The Drive Files are available in Community under the External Files.


(Fig 1.3.5)


(Fig 1.3.6)

The Drive Files can be opened, downloaded and shared by the community users.

(Fig 1.3.7)

  • If any file is not shared, then you cannot open the file, but you can download all the files in the Drive even if they are not shared with you. You will be prompted to Request Access to the file, if you are trying to open an unshared file.


(Fig 1.3.8)

Reference Link: Salesforce Files Connect

2) FILE SHARING IN COMMUNITY

All the community users of a community are notified of the files shared with them through a private Chatter message, if Chatter Messages are enabled for that Community. The Users will also be notified through an email, if they have their email notifications to be turned on for messages.

  • Community Users can share Files with either other users of the Community or to a Chatter Group in which they are member of.
  • Click the down-arrow next to the file that needs to be shared.
  • Click either ‘Share with people‘ or ‘Share with groups‘.


(Fig 2.1)

  • To Share with particular Users click on ‘Share with people’.
  • Type the Search choose the Name of the User and to whom the File needs to be shared.
  • Specify the user is either a ‘Viewer’ or ‘Collaborator’ to the File being shared.
  • Enter a Message, if needed, in the ‘Send a Message’ area and click ‘Share’.
  • The file is shared and is available with the shared user.


(Fig 2.2)

  • After the file is shared, the user with whom the file was shared receives a Chatter Message.


(Fig 2.3)

  • Click the Message to see the shared File along with the Message that is sent by the User who shared the File.
  • The user can also Report the File as Inappropriate by clicking on the ‘Flag as Inappropriate’ link.


(Fig 2.4)

  • The shared file is also available to the user under the ‘Shared with Me‘ option in Files.


(Fig 2.5)

Reference Link: Salesforce File Sharing

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.