You can create Document Library files that link to files in Google Drive™ and Google Photos™. This lets you access your Google files from the Document Library. Note that this functionality isn’t available by default. To enable it, you must complete these steps:
Install the Liferay Plugin for Google Drive™ from Liferay Marketplace.
Create and/or configure a Google project capable of communicating with your Liferay DXP instance. The Google Picker API must be enabled for this project. This API lets you select Google files to link to. You must also create the credentials the Google project needs to communicate with your Liferay DXP instance.
Configure your portal to communicate with your Google project.
This article shows you how to complete these steps and finishes with an example of linking to a Google file from the Document Library.
First, you must install the the Liferay Plugin for Google Drive™ from Liferay Marketplace. This app is available via the following links for Liferay CE Portal and Liferay DXP:
If you need help installing apps from Marketplace, see the documentation on using Marketplace.
Follow these steps to create and/or configure your Google project so it can communicate with your Liferay DXP instance:
Enable the Google Picker API for your project. For instructions, see the Google API Console documentation on enabling and disabling APIs.
Create an OAuth 2 client ID in your Google project. For instructions, see the Google API Console documentation on setting up OAuth 2.0. Enter these values when creating your client ID:
- Application type: Web application
- Name: Google Docs Hook
http://localhost:8080is the default for local development machines)
- Authorized redirect URIs:
Create a new API key in your Google project. For instructions, see the Google API Console documentation on creating API keys. Be sure to restrict the key to HTTP referrers (web sites), and set it to accept requests from your Liferay DXP instance’s URL.
Your new OAuth client ID and public API access key now appear on your Google project’s Credentials screen. Keep this screen open to reference these values as you specify them in Liferay DXP.
Now that you have a Google project set up for use with Liferay DXP, you must connect your installation to that project. You can do this at two scopes:
- Globally, for all instances in your Liferay DXP installation.
- At the instance scope, for one or more instances in your Liferay DXP installation.
You can override the global configuration for one or more instances by configuring those instances separately. Similarly, you can configure only the instances you want to connect to your Google project and leave the global configuration empty.
Follow these steps to configure your Liferay DXP installation to connect to your Google project:
Note that the configuration options are the same in the global and instance-level configurations.
To access the global configuration, go to Control Panel → Configuration → System Settings → Documents and Media.
To access the instance-level configuration, go to Control Panel → Configuration → Instance Settings → Documents and Media.
Under VIRTUAL INSTANCE SCOPE, select Google Drive.
Enter your Google project’s OAuth 2 client ID and client secret into the Client ID and Client Secret fields.
In the field Picker API Key, enter the API key you created in the previous section.
With the preceding configuration steps complete, you can create files in your Document Library that link to files in Google Drive™ or images in Google Photos™. Follow these steps to do so:
In your Document Library, click the Add button () and select Google Drive Shortcut. The New Google Drive Shortcut screen appears.
Click the Select File button to open Google’s file picker.
Use the file picker to select a file from Google Drive™ or Google Photos™.
A new file entry appears for the Google document you linked to. You can view the file entry as you would any file entry. The Google document’s contents show in the file entry’s preview pane. As with any file entry, the Options button () gives you access to the Download, Edit, Move, Permissions, Move to Recycle Bin, and Checkin/Checkout/Cancel Checkout options.