LtiLibrary - posting grade for all students

LtiLibrary - posting grade for all students

nva nva -
Number of replies: 2

I am trying to use LtiLibrary and post grades to all students under LTI item in the gradebook in Moodle.


For now, I can post only grade for a student that click on the LTI like so,

var result=LtiLibrary.Core.Outcomes.v1.OutcomesClient.PostScore(Request.Form["lis_outcome_service_url"].ToString(), Request.Form["oauth_consumer_key"].ToString(), 
ConfigurationManager.AppSettings["SharedSecret"].ToString(), Request.Form["lis_result_sourcedid"].ToString(), 0.40);

The question is how can I post grade for a student with id 22 (for example), my id is 35 and I am trying to replace it, like so...but it does not allow me to post grade . Any ideas?


var result=LtiLibrary.Core.Outcomes.v1.OutcomesClient.PostScore(Request.Form["lis_outcome_service_url"].ToString(), Request.Form["oauth_consumer_key"].ToString(), 
ConfigurationManager.AppSettings["SharedSecret"].ToString(), Request.Form["lis_result_sourcedid"].ToString().Replace("\"userid\":\"35\"""\"userid\":\"22\""), 0.40);


Average of ratings: -
In reply to nva nva

Re: LtiLibrary - posting grade for all students

Jesus Federico -
Picture of Plugin developers

You can only send grades to the links that were used. When a LTI link is used and grades are allowed, a gradable object is created and the reference is supposed to be what you get as lis_result_sourcedid. You can not arbitrarily send a grade to an object that doesn't exist. So the users (all) need to make use of the link. This is the case not only for Moodle but for all the LMS I have worked with.


This means that in your tool provider you also need to keep track of the launches storing the  lis_result_sourcedid parameter received. I would also recommend you to store the lis_outcome_service_url parameter if you are planning to support different LMS. It is not the case for Moodle but for others the endpoint is what really changes.


Good luck