- Home
- Connectors
- SharePoint
SharePoint
About the ONLYOFFICE and SharePoint integration
To edit your documents within the SharePoint collaborative platform, you can integrate ONLYOFFICE Docs with your document library using either the official ONLYOFFICE connector or WOPI.
Main features
- Edit text documents, spreadsheets, and presentations by selecting Edit in ONLYOFFICE from the file’s context menu or the ribbon (when using the official connector), or simply by clicking the file (when using WOPI).
- Collaborate on documents in real time with two co-editing modes: Fast and Strict (available with the official connector; Fast only with WOPI). Leverage features like tracking changes, comments, and built-in chat for seamless teamwork.
access_token_ttl
property to 10 hours for the Fast co-editing mode. The Strict co-editing
mode might negatively affect the access token parameter.
Supported formats
For the official connector:
- For viewing and editing: DOCX, XLSX, PPTX, PPSX.
- For working with forms: DOCXF (Saved as PDF).
- For viewing only: PDF, DJVU, TXT, CSV, ODT, ODS, ODP, DOC, XLS, PPT, PPS, EPUB, RTF, HTML, HTM, MHT, XPS.
For WOPI:
- For viewing and editing: DOCX, XLSX, PPTX, DOCM, XLSM, PPTM, ODT, ODS, ODP, TXT, CSV.
- For viewing only: PDF, DJVU, XPS.
What's new in version 3.0.0
Added
- JWT support
- Document Server v6.0 and earlier is no longer supported
The full change log is available here.
Connecting ONLYOFFICE Docs to SharePoint
Requirements
-
ONLYOFFICE Document Server v7.1 (server or cloud version) or later
You need to enable WOPI following this instruction.
You need an instance of ONLYOFFICE Docs that is resolvable and connectable from both SharePoint and any end clients. It must also be able to POST directly to SharePoint.
Please refer to the official documentation page to learn more about installing ONLYOFFICE Docs. - SharePoint 2019
- ONLYOFFICE Connector 3.0 for SharePoint
Installing and configuring ONLYOFFICE and SharePoint
The ONLYOFFICE SharePoint integration solution is an official ONLYOFFICE connector available on GitHub page under the GNU AGPL v.3 licence.
- Click Start, point to All Programs, point to Administrative Tools, then click Services, and make sure that SharePoint Administration service is started.
- Click Start, open the SharePoint Management Shell, and navigate to the directory containing the .wsp file.
-
Run the Install.ps1 script:
PS> .\Install.ps1
-
Enter your SharePoint site address:
https://<yoursharepointsite>
Instead of steps 3 and 4 you can type the following command:Add-SPSolution -LiteralPath<solutionpath>/onlyoffice.wsp
On the SharePoint Central Administration home page, click System Settings > Farm Management > Manage farm solutions. On the Solution Management page, click onlyoffice.wsp, then click Deploy Solution.
- On the SharePoint Central Administration home page, under Application Management, click Manage web applications.
- Make sure you select your site and click the Authentication Providers icon.
- In the Authentication Providers pop-up window, click Default zone.
- Under Edit Authentication, check Enable anonymous access and click Save.
- Going back to Web Application Management, click on the Anonymous Policy icon.
- Under Anonymous Access Restrictions, select your Zone and set the Permissions to None – No policy and click Save.
-
In SharePoint, open the /_layouts/15/Onlyoffice/Settings.aspx page with administrative
settings.
Enter the following address:
Where the documentserver is the name of the server with the ONLYOFFICE Docs installed. The address must be accessible for the user browser and from the SharePoint server. The SharePoint server address must also be accessible from ONLYOFFICE Docs for correct work.https://<documentserver>/
Starting from ONLYOFFICE Docs v7.2, JWT is enabled by default and the secret key is generated automatically. You need to enable it on the SharePoint side as well: find your secret key in the ONLYOFFICE Docs configuration file, then specify the same secret key in the SharePoint administrative settings. For more details, see the Enabling JWT for the ONLYOFFICE and SharePoint integration section of this article.
If JWT protection is enabled, it is necessary to specify a custom header name, since the SharePoint security policy blocks external 'Authorization' Headers. This header should be specified in the ONLYOFFICE Docs signature settings as well (further information can be found here).
Compiling ONLYOFFICE SharePoint integration solution
There are two ways to compile ONLYOFFICE SharePoint integration solution:
-
Using MS Visual Studio:
- Enter the SharePoint server and open this project in Visual Studio.
- In Solution Explorer, open the shortcut menu for the project and then choose Publish.
- In the Publish dialog box, choose the Publish to File System option button.
- Click the Publish button. When the publishing process is finished, the solution .wsp file will be created.
- Copy the resulting file to the folder with the Install.ps1 file (BuildAndInstall folder by default).
-
With the help of the build.bat file provided:
- Go to the BuildAndInstall folder.
- Run the build.bat file.
- The resulting solution .wsp file will be created and placed to the BuildAndInstall folder.
How it works
The ONLYOFFICE integration follows the API documented here.
- User navigates to a document within SharePoint and selects the Edit in ONLYOFFICE action on context menu or ribbon.
- SharePoint makes a request to the editor page (URL of the form: /_layouts/15/Onlyoffice/editorPage.aspx?SPListItemId={ItemId}&SPListURLDir={ListUrlDir}&action=track).
- SharePoint prepares a JSON object with the following properties:
- url - the URL that ONLYOFFICE Docs uses to download the document;
- callbackUrl - the URL that ONLYOFFICE Docs informs about status of the document editing;
- DocumentSeverHost - the URL that the client needs to reply to ONLYOFFICE Document Server (can be set at the settings page);
- Key - the file identifier from SharePoint;
- FileName - the document title (name);
- CurrentUserId - the user identifier;
- CurrentUserName - the username.
- SharePoint constructs a page, filling in all of those values so that the client browser can load up the editor.
- The client browser makes a request to the JavaScript library from ONLYOFFICE Docs and sends ONLYOFFICE Docs the DocEditor configuration with the above properties.
- Then ONLYOFFICE Docs downloads the document from SharePoint and the user begins editing.
- When all users and client browsers are done with editing, they close the editing window.
- After 10 seconds of inactivity, ONLYOFFICE Docs sends a POST to callbackUrl letting SharePoint ONLYOFFICE solution know that the clients have finished editing the document and closed it.
- SharePoint downloads a new version of the document, replacing the old one.
Enabling JWT for the ONLYOFFICE and SharePoint integration
To protect documents from unauthorized access, ONLYOFFICE editors use the JSON Web Token (JWT). The token is added in the configuration when the Document Editor is initialized and during the exchange of commands between inner ONLYOFFICE Docs services. The secret key is used to sign the JSON web token and validate the token upon the request to ONLYOFFICE Docs.
Starting from ONLYOFFICE Docs v7.2, JWT is enabled by default and the secret key is generated automatically. You need to find your secret key in the ONLYOFFICE Docs configuration file, then specify the same secret key in the connector settings.
Step 1: Find your secret key in the ONLYOFFICE Docs configuration file
-
Open the local.json file with any available text editor.
- For Linux -
/etc/onlyoffice/documentserver/local.json
- For Windows -
%ProgramFiles%\ONLYOFFICE\DocumentServer\config\local.json
-
For Docker – enter the ONLYOFFICE Docs container using the
docker exec -it <containerID> bash
command and open/etc/onlyoffice/documentserver/local.json
Alternatively, you can use the following command to find the default secret key without opening local.json:
sudo docker exec <containerID> /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
The local.json file should look like this:
{"services": {"CoAuthoring": {"token": {"enable": {"request": {"inbox": true,"outbox": true},"browser": true}},"secret": {"inbox": {"string": "yoursecret"},"outbox": {"string": "yoursecret"},"session": {"string": "yoursecret"}}}}}
- For Linux -
-
The
true
value is specified in three sections. It means that token validation is enabled.services.CoAuthoring.token.enable.browser
services.CoAuthoring.token.enable.request.inbox
services.CoAuthoring.token.enable.request.outbox
-
The automatically generated secret key is specified in three sections. You can replace the default
secret value with your own secret key. The secret key must be the same in three sections.
services.CoAuthoring.secret.inbox.string
services.CoAuthoring.secret.outbox.string
services.CoAuthoring.secret.session.string
-
If you make changes, save them and restart the services for the config changes to take effect.
supervisorctl restart all
Step 2: Specify the same secret key in the connector settings
In the connector settings, specify the same secret in the Secret key field and save the settings.
Connecting ONLYOFFICE Docs using WOPI
You can also connect ONLYOFFICE Docs with SharePoint over WOPI, a REST-based protocol that issues HTTP requests to a set of REST-endpoints when a client establishes a connection to the server with your data.
- The editors do not support the Version History feature.
- No support for the Mail Merge feature.
- The editors do not support inserting an image from your storage.
- No support for comparing documents from your storage.
- No support for the following formats: DOC, XLS, PPT.
To connect ONLYOFFICE to SharePoint over WOPI,
- Make sure you meet the requirements.
-
Open your SharePoint server. Run the SharePoint Management Shell console and set the needed WOPI zone
with the following command:
Set-SPWOPIZone -Zone "external-http"
The documentserver uses theexternal-http
parameter by default. -
Run the following command to check whether there are WOPI bindings to other document types on the current
farm:
Delete these bindings, if any, by running the following command:Get-SPWOPIBinding
Remove-SPWOPIBinding -All:$true
-
Create new bindings for default actions as per file types.
Run the following command to create bindings for all file types at once:
Run the following command to create bindings for particular file types only:New-SPWOPIBinding -ServerName ip_or_domain.com:port
New-SPWOPIBinding -ServerName ip_or_domain.com:port -Extension DOCX
If SSL is not used, add-AllowHTTP
at the end of the command.
Creating new documents
To be able to create new documents, set up the parameters described below. This example is provided for DOCX files only, but you can add XLSX, PPTX and other files in a similar way.
- Enable the Allow management of content types setting: Go to Documents - Library
settings – Advanced settings. In the Allow management of content types section, select
Yes and click OK.
- In the Documents library, go to Site contents – Site Settings - Site content types.
Click Create. Fill in the form: Name (New document), Description. In the Parent Content type,
choose Document content types, Document. In the Existing group, choose Custom
Content Types and click OK.
- In the Documents library, go to Site contents – Site Settings - Site content types.
Select the recently added New document. Go to Advanced settings - Document Template –
Upload a new document template. Click the Choose File button, upload the necessary document
and click OK.
- Go to Documents library – Library settings. In the Content Types section, select Add from
existing site content types. In the Select site content types from list, select Custom
content types. In the Available Site Content Types field, choose New document. Click
Add > button, then click OK.
- In the Documents library, refresh the page and press the “New” button.
- The Document content type will be automatically added, this is the parent type for creating new content
types of documents, it must be hidden in the Documents library - Library settings. In the Content
Types section, select Change new button order and default content type.
In the Visible column, deselect the checkbox for the Document content type and click OK.
- In the Documents library, refresh the page and press the “New” button – only the New document menu item will
be available. Use it to create documents.