Document converters: Microsoft OneDrive document converter

fileconverter_onedrive
Maintained by Neill Magill, The University of Nottingham
Converts files to pdf using Microsoft OneDrive.
27 sites
1 fans

Converts files to pdf using Microsoft OneDrive.

You will need a Microsoft account to use this plugin.

Installation

The Microsoft OneDrive document converter follows the standard installation procedure.

1.  Create folder <path to your moodle dir>/files/converter/onedrive.
2. Extract files from folder inside archive to created folder.
3. Visit page Site administration ► Notifications to complete installation.

Enabling the converter

Visit Site administration ► Plugins ► Document converters ► Manage document converters to enable the plugin

You will need to ensure that it is:

1. Configured to use a Microsoft OAuth 2 service.
2. Working by using the 'Test this converter is working properly' link on the settings page.

Contributors

Neill Magill (Lead maintainer)
The University of Nottingham: Lead maintainer
Please login to view contributors details and/or to contact them

• Fri, 29 Jun 2018, 10:00 PM
Approval issue created: CONTRIB-7366
• Wed, 4 Jul 2018, 5:19 PM
Hi Neill, thanks for this plugin, it looks good but I'm struggling to get it working at the moment.

I've set up the MS OAuth2 service and configured the converter to use it. The test page reports that the document converter is configured properly but when I attempt the test conversion I get the exception "accessDenied: Access Denied" in the JSON response. The new OneDrive repo plugin works fine so I guess that means the MS OAuth2 service is configured correctly (for the repo at least), but does this converter require any special permissions to be granted in the MS OAuth2 config?

Thanks, Tony
• Wed, 4 Jul 2018, 6:37 PM
Hi Tony,

It should require the Files.ReadWrite.All capability, which I believe is the same as the OneDrive repository.

We tested it with an institutional Microsoft account. Are you using a personal one?

You could try to use the 'Connect to a system account' button of the OAuth2 service if it already existed before installing the plugin.
• Thu, 5 Jul 2018, 7:30 PM
Thanks Neill. None of the permissions seem to work so we're going to try a different account.
• Thu, 5 Jul 2018, 8:36 PM
Hi Tony,

In case it helps the plugin makes 3 API calls:

* https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_get_content_format (this one didn't document the capabilities it required, I guess it might require more than just OneDrive access)
* https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_delete
* https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/driveitem_put_content

If you do work out what is missing it will be great to know so we can add it to the documentation or plugin as needed.
• Thu, 12 Jul 2018, 11:38 PM
Hi Neill,

Delighted to see a One Drive addition to the converters. Unfortunately I am having difficulties in getting it to work.

I've set up the Microsoft OAuth2 service and configured the converter to use it. The test page reports that the document converter is configured and all seems fine but when tested it throws up the following debug message:

fileconverter_onedrive/conversionfailed

×Debug info:
Error code: conversionfailed
$a contents: Array ( ) ×Stack trace: line 482 of /lib/setuplib.php: moodle_exception thrown line 186 of /files/converter/onedrive/classes/converter.php: call to print_error() line 52 of /files/converter/onedrive/test.php: call to fileconverter_onedrive\converter->serve_test_document() Cannot find anything obviously wrong with the setup. Using an institutional account on Moodle Ver 3.4. Any insight would be appreciated. Regards Harry • Fri, 13 Jul 2018, 5:17 PM Hi Harry, Based on all the checks passing it should only be possible for it to fail at two points: * The call to the conversion call is not returning a download URL * for some reason your Moodle server could not download the converted file from Microsoft I have a new version of the plugin going through an internal review that should give some extra information that will help debug it. I will release it as soon as I can. • Fri, 13 Jul 2018, 8:39 PM Hi Harry, The new version of the plugin adds a statusmessage entry to the contents array that should help you understand where it is failing. • Sat, 14 Jul 2018, 12:41 AM Thanks Neill for the valuable info. I will put a bit of time into next week to see if I can trace the reason for failing to return the document. I will let you know how it works out. Cheers Harry • Wed, 18 Jul 2018, 9:36 PM Hi Neill, The statusmessage indicates an issue with MS Graph. Everything seems to be okay with respect to permissions etc. so am at a bit of a loss. Cannot see what changes I can make from within the API or Azure to sort this. Below is the new error message. fileconverter_onedrive/conversionfailed More information about this error ×Debug info: Error code: conversionfailed$a contents: Array
(
[statusmessage] => The Microsoft Graph conversion API did not send a URL to the converted document
)
×Stack trace:
line 482 of /lib/setuplib.php: moodle_exception thrown
line 191 of /files/converter/onedrive/classes/converter.php: call to print_error()
line 52 of /files/converter/onedrive/test.php: call to fileconverter_onedrive\converter->serve_test_document()

Regards

Harry
• Wed, 18 Jul 2018, 11:05 PM
Hi Harry,

I have verified the plugin worked with a personal Microsoft account, it might be worth trying with one on your server.

If it works with one it would suggest it could be something to do with your institutional account setup, if it still fails do you have anything between your Moodle server and the internet that could be modifying the response? I think some caches or firewalls sometimes can.
• Mon, 19 Nov 2018, 11:04 PM
Hello,

Has anyone else experienced the issue where multiple files have been uploaded - within these multiple files, one of the files is a file type which one drive convertor doesn't accept - for example, a jpeg. The Jpeg file which doesn't work, affects all the other file types from previewing in on screen marking mode.

Do you know if there is a solution to this problem?

Thanks,

Jon

't (for example, which doesn't work)

• Mon, 19 Nov 2018, 11:18 PM
Hi Jon,

It looks like that is a core issue that will affect all document conversion plugins: https://tracker.moodle.org/browse/MDL-60008

There is a fix in Peer review for it now.