Document converters: Microsoft OneDrive document converter

fileconverter_onedrive
Maintained by Picture of Neill Magill Neill Magill, University of Nottingham The University of Nottingham
Converts files to pdf using Microsoft OneDrive.
318 sites
302 downloads
30 fans
63 sites
105 downloads
3 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.

Screenshots

Screenshot #0
Screenshot #1

Contributors

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

Comments RSS

Show comments
  • Wazza
    Thu, Mar 14, 2019, 7:57 PM
    I have set OneDrive up as follows:
    Supported files: internal and external
    Default return type: External

    Still doesn't work though
  • Picture of Neill Magill
    Thu, Mar 14, 2019, 9:44 PM
    Did adding a file to a Moodle using the OneDrive repository work? If so are you using the same OAuth 2 service for it and the OneDrive document converter?
  • Wazza
    Thu, Mar 14, 2019, 11:22 PM
    I'm getting this error: Exception - notAllowed: The feature has been disabled. Please contact your admin to get it enabled.

    I'm logged in as admin in Moodle. So there's something wrong
  • Wazza
    Thu, Mar 14, 2019, 11:24 PM
    Full error (with debugging on):

    Exception - notAllowed: The feature has been disabled. Please contact your admin to get it enabled.

    More information about this error

    ×Debug info:
    Error code: generalexceptionmessage
    ×Stack trace:
    line 123 of /lib/classes/oauth2/rest.php: core\oauth2\rest_exception thrown
    line 748 of /repository/onedrive/lib.php: call to core\oauth2\rest->call()
    line 960 of /repository/onedrive/lib.php: call to repository_onedrive->set_file_sharing_anyone_with_link_can_read()
    line 1204 of /lib/filelib.php: call to repository_onedrive->reference_file_selected()
    line 534 of /mod/resource/locallib.php: call to file_save_draft_area_files()
    line 107 of /mod/resource/lib.php: call to resource_set_mainfile()
    line 122 of /course/modlib.php: call to resource_add_instance()
    line 154 of /course/modedit.php: call to add_moduleinfo()
  • Wazza
    Thu, Mar 14, 2019, 11:26 PM
    I'm also getting these Emails (and systemaccount IS connected!)

    The refresh token for one of the OAuth services Microsoft on your site https://learn.hz.nl has expired. This will limit the functionality of any plugins that use this service. To fix this issue, visit the OAuth 2 Services configuration page and click on the "Connect system account" icon in the table row for this service. Be sure to login using the same service account for the OAuth system each time.
  • Picture of Neill Magill
    Fri, Mar 15, 2019, 4:43 PM
    Hi Richard,

    I believe the last message is showing the root cause. If you go to the OAuth 2 services page in Site administration > Server and click on the Connect to a system account button and re-authenticate the system account I suspect everything using it should start working again.
  • Wazza
    Fri, Mar 15, 2019, 6:04 PM
    Unfortunately it does not. System account is connected, I even reconnected it several times. Everything is on green concerning connection. Only the actual PDF conversion seems to fail.
  • Picture of Neill Magill
    Fri, Mar 15, 2019, 10:09 PM
    Hi Richard,

    I have tested the plugin against the following versions of Moodle and it appears to be working as expected:

    * 3.6.1
    * 3.6.2 (20190222)
    * 3.6.3 (20190315)

    The other thing I can think of doing is to create a new OAuth2 provider (using the same system account as the existing one) and trying to use that. If there is a problem (or bug) with Moodle refresh tokens the new provider may help to clear it.

    It could also be something that has changed on the Microsoft side of things (or the method we changed to enable upload of larger files in the latest version of the plugin may never have been enabled for some reason). The 'The feature has been disabled. Please contact your admin to get it enabled.' message you got from the OneDrive repository will have come from the Microsoft rather than Moodle.
  • Wazza
    Sat, Mar 16, 2019, 1:35 AM
    Yes, T hink you are right and I will try out your suggestion. Today I received 48 of these Emails:

    The refresh token for one of the OAuth services Microsoft on your site https://learn.hz.nl has expired. This will limit the functionality of any plugins that use this service. To fix this issue, visit the OAuth 2 Services configuration page and click on the "Connect system account" icon in the table row for this service. Be sure to login using the same service account for the OAuth system each time.

    So there's definitely something broken after my upgrade from Moodle 3.5 to 3.6. I will keep you posted. The weird thing is that both Google Drive AND One Drive seem to be broken...
  • Wazza
    Sat, Mar 16, 2019, 1:37 AM
    So just to be clear, if the system account is connected (and Moodle tells me that it is) but yet every hour I get an Email telling the token is expired, than it looks like something that needs to come back from Microsoft to my Moodle site is blocked? Just thinking out loudly here.
  • Wazza
    Sat, Mar 16, 2019, 1:40 AM
    Moodle cron says:
    Scheduled task complete: Remove expired cache entries (core\task\cache_cleanup_task) Execute scheduled task: Refresh OAuth tokens for service accounts (core\oauth2\refresh_system_tokens_task)
    ... started 17:30:01. Current memory use 5.2MB.
    ... used 4 dbqueries
    ... used 0.076159000396729 seconds
    Scheduled task complete: Refresh OAuth tokens for service accounts (core\oauth2\refresh_system_tokens_task)
  • Wazza
    Sat, Mar 16, 2019, 1:43 AM
    Sorry for spamming, but I did find some useful information in cron:

    Convert 1 submission attempt(s) for assignment 8083 Convert 1 submission attempt(s) for assignment 7306 Convert 1 submission attempt(s) for assignment 6986 Convert 1 submission attempt(s) for assignment 7982 Convert 1 submission attempt(s) for assignment 7984 Convert 1 submission attempt(s) for assignment 7813 Convert 1 submission attempt(s) for assignment 7982 Convert 1 submission attempt(s) for assignment 8060 Convert 1 submission attempt(s) for assignment 7813 Convert 4 submission attempt(s) for assignment 7812 Convert 1 submission attempt(s) for assignment 7984 Convert 1 submission attempt(s) for assignment 7306 Convert 1 submission attempt(s) for assignment 7982 Convert 1 submission attempt(s) for assignment 8167 Convert 1 submission attempt(s) for assignment 7982 Convert 1 submission attempt(s) for assignment 5866
    **** Ignoring spurious ET operator.

    **** This file had errors that were repaired or ignored.
    **** The file was produced by:
    **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
    **** Please notify the author of the software that produced this
    **** file that it does not conform to Adobe's published PDF
    **** specification.

    **** Ignoring spurious ET operator.

    **** This file had errors that were repaired or ignored.
    **** The file was produced by:
    **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
    **** Please notify the author of the software that produced this
    **** file that it does not conform to Adobe's published PDF
    **** specification.

    Convert 1 submission attempt(s) for assignment 5864
    **** Ignoring spurious ET operator.

    **** This file had errors that were repaired or ignored.
    **** The file was produced by:
    **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
    **** Please notify the author of the software that produced this
    **** file that it does not conform to Adobe's published PDF
    **** specification.

    **** Ignoring spurious ET operator.

    **** This file had errors that were repaired or ignored.
    **** The file was produced by:
    **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
    **** Please notify the author of the software that produced this
    **** file that it does not conform to Adobe's published PDF
    **** specification.

    Convert 1 submission attempt(s) for assignment 7306 Convert 1 submission attempt(s) for assignment 7982 Convert 1 submission attempt(s) for assignment 6652 ... used 2486 dbqueries ... used 69.309015989304 seconds Scheduled task failed: Prepare submissions for annotation (assignfeedback_editpdf\task\convert_submissions),UnknownError:
    Backtrace:
    * line 99 of /files/converter/onedrive/classes/converter.php: call to core\oauth2\rest->call()
    * line 148 of /files/classes/converter.php: call to fileconverter_onedrive\converter->start_document_conversion()
    * line 96 of /files/classes/converter.php: call to core_files\converter->poll_conversion()
    * line 190 of /mod/assign/feedback/editpdf/classes/document_services.php: call to core_files\converter->start_conversion()
    * line 295 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\document_services::list_compatible_submission_files_for_attempt()
    * line 312 of /mod/assign/feedback/editpdf/classes/document_services.php: call to assignfeedback_editpdf\document_services::get_combined_document_for_attempt()
    * line 104 of /mod/assign/feedback/editpdf/classes/task/convert_submissions.php: call to assignfeedback_editpdf\document_services::get_combined_pdf_for_attempt()
    * line 105 of /lib/cronlib.php: call to assignfeedback_editpdf\task\convert_submissions->execute()
    * line 67 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
    * line 61 of /admin/cli/cron.php: call to cron_run()
  • Picture of Neill Magill
    Mon, Mar 18, 2019, 5:38 PM
    The error is happening when the plugin is trying to create a placeholder for the file to be converted on OneDrive so that it can be uploaded.

    I am fairly certain it is the Microsoft Graph API that is giving the UnknownError code (it is possible that it is temporary and will not happen if the file is tried again).
  • Wazza
    Fri, Mar 29, 2019, 6:03 PM
    Two weeks have passed and the same Oauth errors are mailed daily. In the cron however I see something different now:

    Scheduled task complete: Cleanup event monitor events (tool_monitor\task\clean_events) Execute scheduled task: Prepare submissions for annotation (assignfeedback_editpdf\task\convert_submissions)
    ... started 10:30:08. Current memory use 15.3MB.
    Convert 1 submission attempt(s) for assignment 9612
    **** Warning: File has an invalid xref entry: 2. Rebuilding xref table.
    **** Warning: stream operator isn't terminated by valid EOL.
    **** Warning: stream operator isn't terminated by valid EOL.

    **** This file had errors that were repaired or ignored.
    **** The file was produced by:
    **** >>>><<<<
    **** Please notify the author of the software that produced this
    **** file that it does not conform to Adobe's published PDF
    **** specification.


    I don't think pdf conversion works, but I still have hopes that one day it starts working again the same way as one day it just stopped working smile
  • Picture of Alistair Spark
    Sat, May 18, 2019, 3:48 AM
    Just a quick note to mention these errors are not caused by the Onedrive converter but by Ghostscript and tcpdf libraries called by Moodle.
1 2 3
Please login to post comments