Sharepoint SPPersistedObject Class

http://www.codegain.com/articles/sharepoint/developmentprogramming/introduction-of-sppersistedobject-class-in-sharepoint.aspx

1. This class is inside namespace Microsoft.SharePoint.Administration

2. This is base class for all administration objects.
3. It serializes
all fields marked with Persisted attribute to XML.

4. It writes XML BLOB to configuration database.
5. Configuration data that is stored in persisted object is automatically made available to every process on every server in the farm
—————————————————————————-
How to use SpersistedObject —

  1. Create your application that does something. You need a place to store the user id and password. So you decide to use SPPersistedObject
  2. Create a class (say, Counter.cs) that inherits from SPPersistedObject. Define your name and password name in the class.

  3. Then in your app code (created in Step 1), when you need to store/restrieve name/password, you can create a Counter class and use it to save data:

    counter.id is a GUID

  4. To retrieve the name/password, do this:

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: