API Problems

Topics: Developer Forum, Project Management Forum, User Forum
Mar 19, 2009 at 4:26 PM
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);
                    slkStore.AddToUserWebList(spWeb);
                }
            }
        }

You will notice I am using the site "http://rddev22:10000". I tried the same code with another site "http://rddev22" (port 80) and it worked. Why won't this work when I try port 10000? Is this a bug? The site works just fine but the API doesn't realize it has been setup and configured as a SLK site.

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

Jay
Jul 21, 2009 at 11:55 AM

Hi there.

I'm having the same problem. Did you got it to work?

Best regards,

Rafael

Coordinator
Jul 21, 2009 at 2:45 PM

Try running

slkadm.exe -o enummappings

to see if the site is configured correctly.

More info on slkadm on my blog at http://blog.salamandersoft.co.uk/index.php/2009/02/slkadm-for-sharepoint-learning-kit/

Richard

SLK Coordinator

http://blog.salamandersoft.co.uk