UserProperties Class Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

This class handles static or dynamic properties for a certain user in Content Studio.
Inheritance Hierarchy

SystemObject
  SystemMarshalByRefObject
    ContentStudioCSBase
      ContentStudio.SecuritySecurityBase
        ContentStudio.SecurityUserProperties

Namespace: ContentStudio.Security
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public class UserProperties : SecurityBase

The UserProperties type exposes the following members.

Constructors

  NameDescription
Public methodUserProperties
Initializes a new instance of the UserProperties class
Top
Properties

  NameDescription
Protected propertyForceLDAPLevel
Retrieves the ForceLDAPLevel debug setting
(Inherited from SecurityBase.)
Protected propertyUseNetBiosDomainBinding
Gets a value that indicates whether the NetBiosDomain name should be included when binding the user SID to Active Directory.
(Inherited from SecurityBase.)
Top
Methods

  NameDescription
Public methodCreateObjRef (Inherited from MarshalByRefObject.)
Public methodDeleteApplication(ConnectionId, SessionId, String, TrusteeUserIdentifiers, String)
Deletes a custom Content Studio User property application and all the properties connected to that application.
Public methodDeleteApplication(ConnectionId, SessionId, String, Int32, String)
Deletes a custom Content Studio User property application and all the properties connected to that application.
Public methodCode exampleDeleteProperty(ConnectionId, SessionId, String, TrusteeUserIdentifiers, String)
Deletes a custom Content Studio User property.
Public methodDeleteProperty(ConnectionId, SessionId, String, Int32, String)
Deletes a custom Content Studio User property.
Public methodEquals (Inherited from Object.)
Public methodCode exampleExistsProperty(ConnectionId, SessionId, String, String)
Test if a named property exists in an application for the calling user.
Public methodCode exampleExistsProperty(ConnectionId, SessionId, String, TrusteeUserIdentifiers, String, String)
Test if a named property exists in an application
Protected methodFinalize (Inherited from Object.)
Public methodCode exampleGetApplicationProperties(ConnectionId, SessionId, String)
Gets a list of all the property names and their values that exists in an application
Public methodCode exampleGetApplicationProperties(ConnectionId, SessionId, String, TrusteeUserIdentifiers, String)
Gets a list of all the property names and their values that exists in an application
Public methodStatic memberGetBuiltInPropertyNames
Returns the names of all built in user properties in Content Studio. These properties exists in the predefined system application which can be reached by its name or a dot.
Public methodGetHashCode (Inherited from Object.)
Public methodGetLifetimeService (Inherited from MarshalByRefObject.)
Public methodGetProperty(ConnectionId, SessionId, String, TrusteeUserIdentifiers, String) Obsolete.
Gets a custom Content Studio User property.
Public methodGetProperty(ConnectionId, SessionId, String, Int32, String)
Gets a custom Content Studio User property.
Public methodGetType (Inherited from Object.)
Public methodInitializeLifetimeService (Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodMemberwiseClone(Boolean) (Inherited from MarshalByRefObject.)
Public methodCode exampleSetProperty(ConnectionId, SessionId, DictionaryString, String)
Saves one or more custom Content Studio User properties for the calling user.
Public methodCode exampleSetProperty(ConnectionId, SessionId, String, TrusteeUserIdentifiers, DictionaryString, String)
Saves one or more custom Content Studio User properties.
Public methodSetProperty(ConnectionId, SessionId, String, Int32, String)
Saves one or more custom Content Studio User properties.
Public methodToString (Inherited from Object.)
Top
Fields

  NameDescription
Public fieldStatic memberCS_APPLICATION
Defines the name of the built in CS application.
Top
Remarks

User properties are system defined or custom properties that are stored on the user's profile in Content Studio. Custom properties are stored in Applications that acts as namespaces for different set of user properties. For example, to store equal settings but for two different categories you could create two applications MyApp_168 for category no 168 and MyApp_169 for category no 169. Both applications could contain the properties DialogWidth and DialogHeight making it possible for the web developer to obtain a polymorphic behavior.
Examples

The first sample shows how to read the start document of the calling user. In order to avoid exceptions when the property is missing the code calls the ExistsProperty(ConnectionId, SessionId, String, String) method first to check whether or not the property actual exists.
VB
Try
   Dim upo As New UserProperties()
   'The user's start document is stored in the built-in system application
   If upo.ExistsProperty(CS_ConnectionId, CS_UserSessionId, UserProperties.CS_APPLICATION, "startdoc") Then
      Response.Write("Your start document is: " & upo.GetApplicationProperties(CS_ConnectionId, _
                                                                                   CS_UserSessionId, _
                                                                                   UserProperties.CS_APPLICATION)("startdoc"))
   Else
      Response.Write("Your start document is not defined")
   End If
Catch ex As Exception
   Response.Write(Server.HtmlEncode(ex.Message))
End Try
try
{
   UserProperties upo = new UserProperties();
   //The user's start document is stored in the built-in system application
   if(upo.ExistsProperty(CS_ConnectionId, CS_UserSessionId, UserProperties.CS_APPLICATION, "startdoc"))
   {
      Response.Write("Your start document is: " + upo.GetApplicationProperties(CS_ConnectionId, 
                                                                               CS_UserSessionId, 
                                                                               UserProperties.CS_APPLICATION)["startdoc"]);
   }
   else
      Response.Write("Your start document is not defined.");
}
catch(Exception ex)
{
    Response.Write(Server.HtmlEncode(ex.Message));
}
The second example shows how to save two custom properties for the calling user, read these values back and write them out on a Content Studio web site.
try
{
    //Add some properties in the a custom application called MyApp
    Dictionary<string, string> dic = new Dictionary<string, string>();
    dic.Add("MyApp.Data1", "Value 1"); 
    dic.Add("MyApp.Data2", "Value 2");
    UserProperties upo = new UserProperties();
    upo.SetProperty(CS_ConnectionId, CS_UserSessionId, dic);
    dic = upo.GetApplicationProperties(CS_ConnectionId, CS_UserSessionId, "MyApp");
    Response.Write("MyApp.Data1 value " + Server.HtmlEncode(dic["Data1"]) + "<br /> + Environment.NewLine);
    Response.Write("MyApp.Data2 value " + Server.HtmlEncode(dic["Data2"]) + "<br /> + Environment.NewLine);
}
catch (Exception ex)
{
    Response.Write(Server.HtmlEncode(ex.Message));
}
It is also possible to read the properties using the GetApplicationProperties(ConnectionId, SessionId, String, TrusteeUserIdentifiers, String) method but this approach is more complicated for the caller and needs more careful exception handling.

try
{
    //Add the properties in the a custom application called MyApp
    Dictionary<string, string> dic = new Dictionary<string, string>();
    dic.Add("MyApp.Data1", "Value 1"); 
    dic.Add("MyApp.Data2", "Value 2");
    UserProperties upo = new UserProperties();
    upo.SetProperty(CS_ConnectionId, CS_UserSessionId, "", Trustee.UserIdentifiers.None, dic);
    string data1 = "";
    using (StringReader sr = new StringReader(upo.GetProperty(CS_ConnectionId, 
                                                              CS_UserSessionId, 
                                                              "", 
                                                              Trustee.UserIdentifiers.None,
                                                              "MyApp.Data1")))
    {
        XmlReader XReader = XmlReader.Create(sr);
        if (XReader.ReadToFollowing("value"))
        {
            data1 = XReader.ReadElementContentAsString();
        }
    }
    string data2 = "";
    using (StringReader sr = new StringReader(upo.GetProperty(CS_ConnectionId, 
                                                              CS_UserSessionId, 
                                                              "", 
                                                              Trustee.UserIdentifiers.None,
                                                              "MyApp.Data2")))
    {
        XmlReader XReader = XmlReader.Create(sr);
        if (XReader.ReadToFollowing("value"))
        {
            data2 = XReader.ReadElementContentAsString();
        }
    }
    Response.Write("MyApp.Data1 value " + Server.HtmlEncode(data1) + "<br /> + Environment.NewLine);
    Response.Write("MyApp.Data2 value " + Server.HtmlEncode(data2) + "<br /> + Environment.NewLine);
}
catch (Exception ex)
{
    Response.Write(Server.HtmlEncode(ex.Message));
}
See Also

Reference