Manage Hierarchical Object Store - cant retrieve values

Sep 26, 2009 at 6:25 AM

Hi,

I am testing out the Hierachical Object Store feature as I want to store a couple of values that I can use in various timer jobs and/or event handlers.

I have installed it and everything works fine through the Cental Administration  page.

I have written a little console app which is supposed to display the entries that I created using the Central Adin page. However, when I try and retrieve them, the appData is null.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using ManageHierarchicalStore;

namespace ReadHOS
{
    class Program
    {
        static void Main(string[] args)
        {
                SPWebApplication webApp = SPWebApplication.Lookup(new Uri("http://dhbdev/"));
                AppData appData = webApp.GetChild<AppData>("AppData");

                if (appData != null)
                {
                    Dictionary<string, string> entries = appData.Entries;
                    foreach (string key in entries.Keys)
                    {
                        Console.WriteLine("Key: {0}, Entry: {1}", key, entries[key]);
                    }
                }
                else
                {
                    Console.WriteLine("Couldnt find AppData...");
                }

                Console.Write("Press ENTER to finish...");
                Console.ReadLine();
        }

    }
}

I am wondering if there is a security problem as I am running it as a console app, and therefore out of the SharePoint context. 
The URI specified is exactly the same as selected when creating the keys/values.
If anyone has any ideas...
Regards
Jeff