This project has moved and is read-only. For the latest updates, please go here.

API In WinForm App

Topics: Developer Forum, Project Management Forum, User Forum
Apr 11, 2009 at 4:37 PM
Has anyone been able to use the API in a winforms app?
I have a SLK site setup and it works just fine.
I am trying to work with the API but I cannot get a SlkStore ... I keep getting the following error:

This site is not configured to use SharePoint Learning Kit. Administrators can use SharePoint Central Administration to configure SharePoint Learning Kit.

Here is the code I am using to build a SlkStore object (straight from the API reference):

            string webUrl = "http://rddev22:10000";
            string loginName = @"rddev22\ellenadams";
            SPUser spUser;
            using (SPSite anonymousSite = new SPSite(webUrl))
                if (loginName.StartsWith(@".\"))
                    loginName = anonymousSite.HostName + loginName.Substring(1);
                using (SPWeb rootWeb = anonymousSite.RootWeb)
                    spUser = rootWeb.AllUsers[loginName];

            using (SPSite spSite = new SPSite(webUrl, spUser.UserToken))
                using (SPWeb spWeb = spSite.OpenWeb())
                    SlkStore slkStore = SlkStore.GetStore(spWeb);

I know I can go directly to the DB but that is not ideal ... the API route is the way to go.