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

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

A static class that is used to get information about MLC documents or members
Inheritance Hierarchy

SystemObject
  ContentStudio.Document.MLCMLCInformation

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

public static class MLCInformation

The MLCInformation type exposes the following members.

Methods

  NameDescription
Public methodStatic memberCode exampleGetDocumentInformation
Returns an MLCDocumentStatusInformation that contains MLC information for a document.
Public methodStatic memberGetMLCMemberInformation(ConnectionId, SessionId, CategoryId, Int32)
Returns information about an MLC member given its language code.
Public methodStatic memberCode exampleGetMLCMemberInformation(ConnectionId, SessionId, CategoryId, String)
Returns information about an MLC member given its language code.
Public methodStatic memberCode exampleGetMLCMemberInformationCollection
Returns a list of all member categories in an MLC.
Public methodStatic memberGetMLCSiblingInformation(ConnectionId, SessionId, DocumentId, Int32)
Returns information about localized version of an MLC document given the language of the localized version.
Public methodStatic memberCode exampleGetMLCSiblingInformation(ConnectionId, SessionId, DocumentId, String)
Returns information about localized version of an MLC document given the language of the localized version.
Public methodStatic memberGetMLCSiblingInformation(ConnectionId, SessionId, DocumentId, String, Int32)
Returns information about localized version of an MLC document given the language of the localized version.
Public methodStatic memberGetMLCSiblings
Gets information about the siblings (and possible) siblings of an MLC document. Entries for each one of the languages in the current MLC are returned even if there are no actual document in the member language.
Top
Examples

The first code snippet shows how to get MLC information about the current category. The sample writes an Html table on a Content Studio document that contains
  • the category name combined with its id and whether the category is the master category
  • the language of the category including the language code
try
{
    System.Collections.Generic.List<ContentStudio.Document.MLC.MLCMemberInformation> li =
           ContentStudio.Document.MLC.MLCInformation.GetMLCMemberInformationCollection(CS_ConnectionId,
                                                            CS_UserSessionId,
                                                            CS_InsertedCategoryId);
    System.Text.StringBuilder bu = new System.Text.StringBuilder();
    bu.AppendLine("<table>");
    bu.AppendLine(" <tr><th>Category info</th><th>Language info</th></tr>");
    foreach (ContentStudio.Document.MLC.MLCMemberInformation mifo in li)
    {
        bu.Append(" <tr>");
        bu.Append("  <td>");
        bu.Append(String.Format("Category: {0} ({1}) IsMaster: {2}",
                               mifo.CategoryName,
                               mifo.CategoryID,
                               mifo.IsMasterCategory ? "Yes" : "No"));
        bu.AppendLine("  </td>");
        bu.Append("  <td>");
        bu.Append(String.Format("Language: {0} ({1})",
                               mifo.LanguageName,
                               mifo.LanguageCode));
        bu.AppendLine("  </td>");
        bu.AppendLine(" </tr>");
    }
    bu.AppendLine("</table>");
    Response.Write(sbu.ToString());
}
catch (Exception ex)
{
    Response.Write(String.Format("<h3>Error: {0}</h3>", ex.message));
}

The second code snippet shows how to get MLC information about a MLC member category with a specific language (Italian). The sample writes an Html table on a Content Studio document that contains

  • the category name combined with its id and whether the category is the master category
System.Text.StringBuilder sbu = new System.Text.StringBuilder();
sbu.AppendLine("<ul>");
try
{
   ContentStudio.Document.MLC.MLCMemberInformation memi =
        ContentStudio.Document.MLC.MLCInformation.GetMLCMemberInformation(CS_ConnectionId, 
                                                                          CS_UserSessionId, 
                                                                          CS_InsertedCategoryId, 
                                                                          "it");
   sbu.AppendLine(String.Format("<li>Category: {0} ({1}) IsMaster: {2}</li>", 
                                memi.CategoryName, 
                                memi.CategoryID, 
                                memi.IsMasterCategory ? "Yes" : "No"));
   sbu.AppendLine("</ul>");
}
catch (Exception ex)
{
    sbu.AppendLine(String.Format("<li>Error: {0}</li>", ex.Message));
}
sbu.AppendLine("</ul>");
Response.Write(sbu.ToString());

The following sample shows how to obtain MLC information for a specific document. The data is written as an Html list that contain

  • the language of the document including the language code
  • whether the document is a master or an ordinary member document
try
{
  ContentStudio.Document.MLC.MLCDocumentStatusInformation msta = 
      ContentStudio.Document.MLC.MLCInformation.GetDocumentInformation(CS_ConnectionId, 
                                            CS_UserSessionId, 
                                            CS_InsertedDocumentId);
  System.Text.StringBuilder sbu = new System.Text.StringBuilder();
  sbu.AppendLine("<ul>");
  if(msta.IsMlcDocument)
  {
    sbu.AppendLine(String.Format(" <li>Language: {0} ({1})</li>)", 
                                 msta.LanguageName, msta.LanguageCode));
    sbu.AppendLine(String.Format(" <li>Master document: {0} ({1})</li>)",
                                 msta.MasterDocumentName,
                                 msta.MasterDocumentID));
    sbu.AppendLine(String.Format(" <li>Document is: {0}</li>",
                                 (msta.Role == 1 ? "Member" : "Master")));
  }
  else
    sbu.AppendLine(" <li>The document is not an MLC document</li>");
  sbu.AppendLine("</ul>");
  Response.Write(sbu.ToString());
}
catch(Exception ex)
{
   sbu.AppendLine(String.Format("<h3>Error: {0}</h3>", ex.Message));
}

This code shows how can get information about a sibling document written in the Italian language and how to display it as an Html list in a Content Studio document. The code also checks whether there actually exists a version in Italian before reading any detailed information about the found sibling.

System.Text.StringBuilder sbu = new System.Text.StringBuilder();
sbu.AppendLine("<ul>");
try
{
   ContentStudio.Document.MLC.MLCSiblingInformation sibi = 
      ContentStudio.Document.MLC.MLCInformation.GetMLCSiblingInformation(
                                                CS_ConnectionId,
                                                CS_UserSessionId,
                                                CS_InsertedDocumentId,
                                                "it");
   if(sibi.DocumentId > 0)
   {
     ContentStudio.Document.CSDocumentInformation docu = 
        new ContentStudio.Document.CSDocumentInformation(CS_ConnectionId, 
                                                         CS_UserSessionId, 
                                                         sibi.DocumentID, 
                                                         CSDocumentInformation.ContentToLoad.None);
     sbu.AppendLine(String.Format(" <li>Document: {0} ({1})</li>", 
                                   docu.DocumentName, 
                                   sibi.DocumentID));
   }
   else
     sbu.Append(" <li>There is no Italian version of this document</li>");
}
catch(CSException cex)
{
    switch(cex.Number)
    {
       case 1558:
          sbu.AppendLine(" <li>Error: The document is not an MLC document!</li>");
          break;
       case 1561:
          sbu.AppendLine(" <li>Error: No support for Italian!</li>");
          break;
       default:
          sbu.AppendLine(" <li>Error: {0}!</li>", cex.Message);
          break;
    }
}
catch(Exception ex)
{
    sbu.AppendLine(String.Format(" <li>Error: {0}</li>", ex.Message));
}
sbu.AppendLine("</ul>");
Response.Write(sbu.ToString());
See Also

Reference