Using API from Event Handler

Mar 23, 2009 at 10:47 AM
Hello, I trying to use API to programmatically add assignment from the event handler (sharepoint event handler - not http).

Using CreateAssignment demo project I receive the following error:

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
   at Microsoft.LearningComponents.SharePoint.SharePointFileLocation.GetTimeStam
p(Guid siteId, Guid webId, Guid fileId, Int32 versionId)
   at Microsoft.LearningComponents.SharePoint.SharePointFileLocation..ctor(SPWeb
 web, Guid fileId, Int32 versionId)
   at Program.CreateAssignment(String packageUrl, Nullable`1 organizationIndex,
String assignmentWebUrl, String title, String instructorLoginName, String[] lear
   at Program.Main(String[] args)

Same I receive in my handler.

It seems that problem appear inside the library, when SPContext.Current accessed (seems that in both console app and in handler it's null).

Please, suggest what I'm doing wrong.

Thanks in advance.