Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have some data for my SP feature that is using the hierarchical object store to persist the data. I would like to read this data using the Client Object Model in an application that will be running on the users desktop machine. I can't seem to find a class that would allow me to do that. Is this possible? If so, how would I access it? Below is sample code of my persisted object class. I create this object using the static method on the class in an Administrative Console page. I want to be able to read (in this example) the value of the _myFavoriteMeat property from a client application (my application is straight C# 3.5 Winforms application).

[System.Runtime.InteropServices.GuidAttribute("AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA")]
public class MyCustomSettings : SPPersistedObject
{
    [Persisted]
    string _myFavoriteMeat;

    public MyCustomSettings() : base() {}

    public MyCustomerSettings(SPPersistedObject parent)
        : base("MySettingsName", parent)
    {
    }

    public static MyCustomSettings GetSettings()
    {
         MyCustomSettings settings = SPFarm.Local.GetChild<MyCustomSettings>("MySettingsName");
         if (settings == null)
         {
              settings = new MyCustomSettings(SPFarm.Local);
         }

         return settings;
    }

    public string MyFavoriteMeat
    {
         get
         {
             return _myFavoriteMeat;
         }
         set
         {
             _myFavoriteMeat = value;
         }
    }
}
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I could be wrong, but I think you can only access objects at Site Collection level and lower (so not SPFarm level), and as SPPersistedObjects are written to the config database (not the content database) this rules out objects above Site Collection level being accessable.

This is documented in Stefan Stanev's blog post about getting SharePoint Manager 2010 to work with the Client Object Model: http://stefan-stanev-sharepoint-blog.blogspot.com/2010/05/sharepoint-2010-explorer-using-client.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.