SharePointLMS Data Extract from SCORM quizzes

Problem:

We are using a quiz inside a SCORM package on Sharepoint LMS and using cmi.interactions to store the questions, the users answers and if they got it right or wrong. Everything works fine and you can see the date by going into Learning Path > SCORM Package > All Attempts >Attempt #1 > Interactions.

We really need to get the information out of the interactions but we cant find a way of doing that.

Solution [Code was originally written for SPLMS ver 2.1]:

// add to project Elearningforce.SharePoint.LMS.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Elearningforce.SharePoint.LMS.Scorm;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //for Example: Url to SP Web
            using (SPSite site = new SPSite("http://localhost"))
            {
                //For Example: open root web
                using (SPWeb web = site.OpenWeb())
                {
                    //get all scorms
                    IEnumerable<SPList> Scroms = web.Lists.Cast<SPList>().Where(item => item.TemplateFeatureId == Elearningforce.SharePoint.LMS.Features.Identifiers.Scorm);
                    //for Example: get first scorom
                    SPList firstScorm = Scroms.FirstOrDefault();
                    if (firstScorm != null)
                    {
                        //for Example: get first list item
                        SPListItem spListItem = firstScorm.Items[0];
                        //get field with scorm data
                        ScormItemValue val =    (ScormItemValue)spListItem[Elearningforce.SharePoint.LMS.Fields.Identifiers.ScormConfiguration];
                        if (val != null && val.Result != null)
                        {
                            //get scorm tree
                            ActivityTreeClass tree = ActivityTreeClass.getActivityTree(val.Result);
                            //tree.RootActivity - root Node
                            //tree.RootActivity.AvailableChildren - child nodes first level
                            //tree.RootActivity.AvailableChildren[0].AvailableChildren - child nodes second level
                            //......
                            //if node is leaf
                            //tree.RootActivity.AvailableChildren[0].scoData this is StringDictionary with sco data
                        }
                    }
                }
            }
        }
    }
}

 

Solution [Code was originally written for LMS Suite 4.4.0.0]:

In order to run below example the following assemblies should be referenced:
Elearningforce.SharePoint.LMS.dll
Elearningforce.Scorm.dll
Elearningforce.SharePoint.Scorm.dll

using System;
using System.Collections;
using System.Linq;
using Elearningforce.Scorm;
using Elearningforce.SharePoint.Scorm;
using Microsoft.SharePoint;

namespace ConsoleApplication1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var site = new SPSite("http://localhost"))
            {
                using (var web = site.OpenWeb())
                {
                    var scroms =
                        web.Lists.Cast<SPList>()
                            .Where(
                                item =>
                                    item.TemplateFeatureId == Elearningforce.SharePoint.LMS.Features.Identifiers.Scorm);
                    var firstScorm = scroms.FirstOrDefault();

                    if (firstScorm != null)
                    {
                        var item = firstScorm.Items[0];
                        var value =
                            (ScormItemValue)
                                item[Elearningforce.SharePoint.LMS.Fields.Identifiers.ScormConfiguration];

                        if (value != null && value.Result != null)
                        {
                            var tree = ActivityTreeClass.GetActivityTree(value.Result, true);

                            if (tree.RootActivity != null && tree.RootActivity.AvailableChildren.Count > 0)
                            {
                                foreach (DictionaryEntry entry in tree.RootActivity.AvailableChildren[0].scoData)
                                {
                                    Console.WriteLine("{0}: {1}", entry.Key, entry.Value);
                                }
                            }
                        }

                    }

                }

            }

        }
    }
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Article is closed for comments.

Powered by Zendesk