Office365 Application

Last modified by Admin on 2022/02/28 00:06

cogIntegration of Office365 in XWiki
TypeXAR
CategoryApplication
Developed by

Ludovic Dubost

Active Installs22
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

You can also try the Pro version: Office365 Integration (Pro).

Integration of Office365 in XWiki

This macro connects XWiki to Office365, allowing to display office documents from OneDrive inside XWiki. It allows to search for OneDrive documents on the XWiki search page.

Limitations

  • Only Office formats (Word, Excel, Powerpoint) can be embedded. PDF cannot because Office 365 does not provide an embed URL.
  • Sharepoint documents can be embedded by URL but not searched.

Macro embed via URL

First you can embed an Office 365 documents by URL. This way of embedding does not require OAuth credentials to connect XWiki. To embed you just need to get the URL that is displayed when you view or edit an Office document on Office 365. An iframe is used to embed. You can also set width and height parameters of the iframe.

{{office365 url="https://xwikidev-my.sharepoint.com/personal/office365_xwikidev_onmicrosoft_com/_layouts/15/WopiFrame.aspx?sourcedoc=%7BD5A1847B-742D-42EB-980F-4964A21E4F05%7D&file=XWikiKeyMessages2017.pptx&action=default" width="100%" height="800" /}}

office365macroembed1.png

Macro embed via Search

You can embed via search. Just insert the office365 macro without any parameter and a search box will show up. You need to set OAuth credentials in the configuration for this to work (see configuration). You search and then choose the document to embed. To links ("change" and "view" are displayed to allow to change the embed document or view the document on Office365).

{{office365 /}}

office365macroembed2.png

OneDrive search inside XWiki

If you setup OAuth credentials, activate the search UI extension in the Office 365 configuration in the XWiki administration  and add the UI Extension point to the SolrSearchMacros page (see installation instructions) you will see a box showing up on the SOLR search screen of XWiki when searching. This box shows OneDrive results. 

office365search1.png

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

To configure the extension to be able to use the other features, you will need to get OAuth2 credentials:

Create Office 365 OAuth Credentials

You will need to create credentials on Office 365/Azure AD. This can be done either in Azure AD or on this microsoft app registration web site. It might be necessary to be an admin in the organization

It is necessary to get an Application ID (clientid), create a password (secret)
and set the redirect URI ( http://[your domain]]/xwiki/bin/view/Office365/OAuth (or https) )

office365config.png

Permissions need to be set on the Graph API like below:

permissions.png

Here are some screenshots of the checkboxes checked on the Application Registration Portal:

azuredroits1.png
azuredroits2.png
azuredroits3.png

In case you register the key using the Azure Portal here is how the rights should look

azuredroits4.png

Enter the credentials in XWiki Administration

You will need to enter your credentials and your tenant ID (either  yourorg.onmicrosoft.com or the full ID) in the Office365 section of the XWiki Administration.

Add the UI Extension point to the Main.SolrSearchMacro page

A UI Extension point needs to be added until is integrated in XWiki.

To add the extension point locate #\displaySearchForm in the page Main.SolrSearchMacros and add the foreach/end block after it:

    #displaySearchForm()
    #foreach ($extension in $services.uix.getExtensions("org.xwiki.platform.search.widget"))
{{html clean=false}}
$services.rendering.render($extension.execute(), 'xhtml/1.0')
{{/html}}
    #end
    #if ($text != '')

Release Notes

v1.1.1

Minor fix: Missing sites configuration in config page

v1.1

  • Added support for PDF Viewing
  • Added support for searching and embedding documents from sharepoint sites

v1.0

  • Initial Release
  • Allows to search and embed documents from your personal drive on Office365
  • Allows to show search results from your personal drive in the XWiki Search

Dependencies

Dependencies for this extension (org.xwiki.contrib:application-office365 1.1.1):

Tags:
    

Get Connected