Integrating SharePoint and Moodle: Storing Moodle Docs in SharePoint: Part 2


This blog post is part 1 of a series of 3 on how to integrate SharePoint and Moodle better.

Part 1: How to part 1
Part 2: How to part 2 (this post)
Part 3: Recommended Changes

Enable Feature

For the Moodle OS to open a WebDAV enabled folder, the Desktop Experience Feature must be enabled.  Do this by adding this feature.


Changes required to Moodle PHP files

I have copied the next step from the Integrating Moodle and SharePoint Better document produced by Microsoft which talks about how to integrate the product better should you be running it on a Windows Server using Apache.

Changes to Moodle PHP Files
There are two changes to make to Moodle PHP files. First, it’s important to prevent Moodle from
creating an administrative file called .htaccess that is not a valid SharePoint file. This file prevents
unauthorized access to the Moodle dataroot folder. Because we will use SharePoint Server to store
files, we will also use SharePoint’s authentication system, and thus can safely prevent the .htaccess
file from being created.
Second, we need to add our own file upload function. This function supports versioning by
preventing Moodle from simply overwriting old files when it uploads files to SharePoint.
Important If a PHP accelerator is present, it may be necessary to either temporarily turn off
the PHP accelerator, or force a purge of the accelerator’s cache, for the changes you make
to take effect. Procedures for temporarily disabling a PHP accelerator and for cache purging
vary by accelerator.
Prevent Moodle from creating an .htaccess file
1. Open the Moodle file setuplib.php from within server/moodle/lib.
2. Search for .htaccess, then comment out the following code:

   1: if (!file_exists($currdir.'/.htaccess')) {

   2: if ($handle = fopen($currdir.'/.htaccess', 'w')) { // For

   3: safety

   4: @fwrite($handle, "deny from allrnAllowOverride);

   5: Nonern"

   6: @fclose($handle);

   7: }

   8: }

Note An alternative to editing the setuplib.php file is to create a SharePoint event handler

that intercepts the file create event and handles it appropriately.

Changes to config.php

Navigate to the root of your Moodle website through Windows Explorer.  Normally this would be c:inetpubwwwroot

Open config.php with notepad and search for docroot and change this location to the same URL we saved during the creation of the document library in SharePoint.  At the moment there are only 2 backlashes for the location.  You need to make this 3.

Navigate to c:inetpubwwwroot and open the file config.php in notepad.

Within the file search for $CFG->dataroot. Change this to sp2010sitesmoodlemoodledocs. Note that this is three backslashes.


Click to go to part 3 and recommendation of integrating Moodle and SharePoint

5 thoughts on “Integrating SharePoint and Moodle: Storing Moodle Docs in SharePoint: Part 2

  1. xHainex

    Hi Alex, under “Change required to Moodle PHP files” its suitable for Apache but I’m using IIS7 so wanna check with you what need to be change.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.