I'm trying to build an assignment from scratch.
I'm building code, so that it can upload the package and create the assignment, all through the API.
I'm able to upload the package to a document library. But when it comes to build the assignment, it gets tricky.
I believe i have to register the package. However, i can't seem to understand the SlkStore.RegisterPackage() method. What is the location in this method?
This is how i was trying to do it:
string docPath = "c:\\saf\\"; //physical location of the file
fileStream = File.OpenRead(docPath + fileName);
fileContent = new byte[Convert.ToInt32(fileStream.Length)];
fileStream.Read(fileContent, 0, Convert.ToInt32(fileStream.Length));
SPFile spfile = spList.RootFolder.Files.Add(spList.RootFolder.Url + "/" + fileName,
string packageUrl = "http://mySite/Shared%20Documents/" + fileName;
SlkStore slkStore = SlkStore.GetStore(myWeb);
string location = new SharePointFileLocation(myWeb, spfile.UniqueId, spfile.UIVersion).ToString();
However, i get the following error:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.LearningComponents.SharePoint.SharePointFileLocation.GetTimeStamp(Guid siteId, Guid webId, Guid fileId, Int32 versionId)
at Microsoft.LearningComponents.SharePoint.SharePointFileLocation..ctor(SPWeb web, Guid fileId, Int32 versionId)
Can someone help me on this?
Thanks in advance,