UserPropertiesSetProperty Method (ConnectionId, SessionId, DictionaryString, String) Content Studio 5.7 SDK
Content Studio Web Content Management System

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

Saves one or more custom Content Studio User properties for the calling user.

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

public void SetProperty(
	ConnectionId connectionId,
	SessionId sessionId,
	Dictionary<string, string> properties
)

Parameters

connectionId
Type: ContentStudioConnectionId
A value that identifies the web site
sessionId
Type: ContentStudio.SecuritySessionId
A value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
properties
Type: System.Collections.GenericDictionaryString, String
A collection of property values to set. The property must have the form Application.Property. For the system application a single dot (.) can be used. The following system property name are defined
  • email
  • title
  • office
  • address
  • zip
  • city
  • country
  • phone
  • cellphone
  • fax
  • company
  • homephone
  • startdoc (the user's start page in Content Studio)
  • infodoc (the user's personal page in Content Studio)
  • webviewbool (indicates whether to display the tree view in Content Studio or not)
  • pflang (indicates the user's preferred language setting)
Exceptions

ExceptionCondition
CSExceptionA business rule was violated in the underlying Content Studio database. The following numbered exceptions are common:
  • 1001 - The session is invalid
  • 1002 - Permission denied
  • 1023 - The property does not exist (only for the system application).
SqlExceptionAn error occurred when executing the command against the Content Studio database
Content Studio permissions

A user can always work with her own data.
Remarks

If the property or its application does not exist it will be created. Properties for the CS_APPLICATION cannot be created here but existing properties including the email property can be updated.
Note:
All property an application names are case sensitive.
Examples

This sample code shows how to set the properties Data1 and Data2 in the application MyApp using SetProperty method.
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, dic);
}
catch (Exception ex)
{
    Response.Write(Server.HtmlEncode(ex.Message));
}
See Also

Reference