There are two ways to add a SharePoint document with the help of this macro. You can either add it using the macro browser to select the macro and search for a document or you can just copy the URL of a document and paste it to a Confluence page in edit mode.
Via macro browser
To embed a document form SharePoint into a Confluence page open the macro browser and select the "SharePoint Online Document" macro. You can use the search field to reduce the shown macros by typing its name.
Image 1: Open macro browser (click to enlarge)
Image 2: Search for 'SharePoint Online Document' (click to enlarge)
Via URL pasting
There also exists a faster way to embed a document into a Confluence page. If the page is opened in edit mode, it is possible to just copy a link from a SharePoint document and paste it at the desired position of the page. The macro will be created automatically. If you publish the page, the document will be shown. You can edit this macro normally later, if you want to change something. If you want to change the display option, you can do that before publishing the page, too. As default the document will be embedded showing the document with "responsive" display option preselected.
The following links are currently supported by this feature (for OneDrive and SharePoint):
Open the document in the web app and copy the link from the address bar of the browser:
Image 3: Copying a document URL from the browser address bar (click to enlarge)
Open the context menu of the document and choose 'Copy link':
Image 4: Copying a document URL via the context menu and 'Copy link' (click to enlarge)
Open the context menu of the document and choose 'Share' and then 'Copy Link' in the following dialog. Adding special permissions via the sharing link is not supported:
Image 5: Copying a document URL via the context menu and 'Share' (part one) (click to enlarge)
Image 6: Copying a document URL via the context menu and 'Share' (part two) (click to enlarge)
Configure Document macro
The macro contains options to search for a document within SharePoint or OneDrive for Business and to select the layout in which the document should be displayed (embedded or as link).
Image 7: Overview macro preview (click to enlarge)
In order to see a document in the list, the logged in user should have at least read access to the document and the site collection of the SharePoint Online.
1) Select the source for your search
First you have decide where you want to search for the document. By default the 'Recent' tab is selected. This tab shows the documents you accessed last (viewed, downloaded or edited). You can also switch to the 'SharePoint Sites' tab. Here you have first to decide on which site the document is located. Then you can search over all documents in that site. Or you can switch to the 'OneDrive' tab. There a search over all your documents in your OneDrive for Business is possible.
If you access a tenant as a SharePoint guest user, the tabs 'Recent' and 'My OneDrive' will not be available
In each tab you can filter documents by their name. Just start typing in the text box. The filtering will automatically be done (no need for typing enter).
In the tab 'SharePoint Sites' you first select the SharePoint site where the document is stored. For that a site filter appears in the filter section when switching the tab.
Image 8: SharePoint site filter (click to enlarge)
On clicking the filter a drop down opens and shows all sites, where the current user has access to. You can start typing the name of your site to get the results in the drop down filtered.
By default the root site collection of the SharePoint Online tenant is selected. That means that initially only documents belonging to the root site collection will be displayed.
If you can't find your document already within the result list, please try to sharpen your search by typing in a more specific search text.
3) Select the document
If the document you searched for is contained in the result list, just click on it to select it.
4) Display as with preview
On the right side you can see a preview of the document you selected in the list in the way it will be shown on the page later. By default it will be shown as embed, but you can also decide to just show the document as a link on the Confluence page.
"Link" provides a persistent link - even if the document has been renamed or moved. By clicking this link, the document will be opened in Office Web App in a new browser tab. Documents that are not supported by Office Web App, will trigger the default browser behavior if clicked.
Image 9: Document link preview (click to enlarge)
Alternatively, the "Embed" display option will render the document to appear as a preview on the page, so you can see the content of the document inside of confluence. This view works on most of the common file types. To get more details on which types are supported have a look in the official Microsoft documentation. The document will fill the available space based on the layout of the Confluence page. Below the preview when selected 'embed' you can find the title of the document. It also a link, that will open the document in a new tab.
Image 10: Document preview (click to enlarge)
Password protected documents
Previews for documents protected with a password are currently not supported.
In order to embed your selected document on the Confulence page, click 'Insert' in the end.
If you edit an already inserted document macro, you will see the currently configured document in the preview section on the right side of the editor. It will be shown in the currently saved display option (link or embed). You can change the display option for the configured document and click on 'Save'.
If you need to change the currently configured document then just search on the left site for a new document (if needed select first a new site), select it and click on 'Save'. For more help see the part Configure Document macro.