o365-moodle
o365-moodle copied to clipboard
Microsoft o365 Repository: file picker improvement - configuration of copy/alias
Hello
I have just an idea of an improvement, maybe it can be implemented. If you select a file in Onedrive a user will get two possibilities: a.) Make a copy of the file b.) Create an alias/shortcut to the file
There should be an improvement of the plugin: a Moodle admin can disable the selection option and force the user only to create an alias/shortcut. Reason: a.) we would like to avoid lokal based files in Moodle; b.) if there are any changes in the files in Onedrive, the files should also be updated in Moodle.
thanks, br Anton
Hi @AntonT76,
I understand the starting point of the requirement.
This should be feasible by large, however, I do remember there are some odd cases when creating alias of images hosted in OneDrive, something like CORS blocking access to the linked image files. You are welcome to test it out and let me know if it works, otherwise I'll put it in our (long) queue of feature requests, and process accordingly.
Regards, Lai
@chrisoconnor,
Is this the same as what you tried to do but can't achieve?
Regards, Lai
Hi, I am trying to use Microsoft 365 repository but the file picker doesn't give me the option of 'Create an alias/shortcut to the file'. It only has one option of 'Make a copy of the file'
My Moodle version: Moodle 3.10.6 (Build: 20210729)
This feature would be useful for me as well, in my case the whole point of using the Office 365 repo is so that all files can be kept within Office 365, minimising the used of the more expensive storage space on the Moodle VM.
For the time being, you can edit the repository/office365/lib.php to remove the ability to "make a copy" by finding this method:
public function supported_returntypes() { return FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE; }
and editing it to remove FILE_INTERNAL thus:
public function supported_returntypes() { return FILE_EXTERNAL | FILE_REFERENCE; }
It should be fairly trivial to read an option in this method that returns the types chosen by the Moodle admin. You will need to re-apply this fix after every plugin upgrade.
Hi, I believe the OneDrive repository plugin (not the Microsoft 365 repository) proposed (proposes?) this as a parameter :

Cheers,
Hi Tim, thank you for sharing your workaround, but are you referring to OneDrive Repository? or Microsoft 365 repository. I have configured the Microsoft 365 Repository but its file picker doesn't have an option 'Create an alias/shortcut to the file'.
Sorry guys, I forget to tell you, Using Microsoft 365 Repository, on Moodle assignment submission page the file picker doesn't have an option 'Create an alias/shortcut to the file' I mean, when students want to link the assignment from OneDrive, it allows to select a file from my OneDrive but without the an an option 'Create an alias/shortcut to the file'
@ijazhussain2015 Microsoft 365 repo. I can't explain why your not seeing the alias/shortcut option, it shows up for me (if I disable my patch that takes away the copy option!). It's possible there are other config options elsewhere that have an impact on this, eg perhaps the Sharepoint/Onedrive you are linking to doesn't allow aliases to be created?

I've not checked this with a student assignment submissions, my client is mostly going to be using this to link large course content files that are kept on OneDrive, so having this work for assignments isn't a priority at the moment. (though it may be in the future).
@tim1mw @ijazhussain2015 I may have found the answer to your question while working on aliased SCORM files. The Moodle doc states that the alias option is disabled for all file repositories in certain modules : https://docs.moodle.org/311/en/Working_with_files#SCORM_files_cannot_be_updated_where_alias.2Fshortcut_are_used
Areas in which aliases cannot be made An alias cannot be made in the following areas of Moodle:
an assignment submission a forum post attachment a workshop submission a quiz essay a database activity file field This is to prevent cases such as a student uploading an item for assessment and then subsequently changing the original in their private files. When a student uses a file from their private files in one of these instances, they do not see the options to "copy" or "create an alias". Below is an example of a file added to an assignment:
Which is pretty sensible for student submissions, it seems to me ;)
Justin
Hi Justin My understanding, OneDrive Repository plugin does allow to 'Create an alias/shortcut to the file' for assignments. I haven't tested myself but require OAuth2 configuration. Currently, I am using OpenID connect plugin for SSO.and don't know Oauth2 service configuration addition to OpenID connect will have an impact on user SSO.