CSApplicationSiteListStream Method (Boolean) Content Studio 5.7 SDK
Content Studio Web Content Management System

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

Gets a list of all sites registered in certain installation of Content Studio. The returned stream can be used as input to an XmlTextReader or an XMLDocument.

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

public Stream SiteListStream(
	bool newSyntax
)

Parameters

newSyntax
Type: SystemBoolean
If true the returned XML follows the new style syntax with values in attributes rather than elements

Return Value

Type: Stream
An XML stream positioned at the beginning of the stream

<root>
  <list>
    <cs_site connectionid="1" 
     sitename="TheSite" 
     version="5.0.1 release" 
     webservername="MyServer" 
     adminurl="http://mysite.se/cs" />
     <!-- More cs_site elements can follow -->
  </list>
</root>
With the old syntax style each attribute is replaced with an element with the same name.

Remarks

The calling process must close the returned stream after it has been read in order to release resources.
Examples

This small sample shows how you can use the SiteListStream(Boolean) method class to obtain a list of sites registered in Content Studio.
The sample uses remoting configuration technique to enable the application to call CS API remotely.
This is technique has been documented in the article Calling Content Studio API externally in the Content Studio SDK.

using System;
using System.Runtime.Remoting;
using ContentStudio;
namespace RemConfig
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                //Configure the Remoting client channels by using the configuration file
                RemotingConfiguration.Configure("RemConfig.exe.config", true);
                //Get a list of all registered sites in content studio
                CSApplication csApp = new CSApplication();
                using (System.Xml.XmlReader xrd = System.Xml.XmlReader.Create(csApp.SiteListStream(true)))
                {
                    Console.WriteLine("Id\tName\t");
                    while (xrd.Read())
                    {
                        if (xrd.NodeType != System.Xml.XmlNodeType.Element)
                            continue;
                        if (xrd.Name == "cs_site")
                        {
                            Console.Write(xrd.GetAttribute("connectionid"));
                            Console.Write("\t");
                            Console.Write(xrd.GetAttribute("sitename"));
                            Console.WriteLine();
                        }
                    }
                    xrd.Close();
                }
            }
            catch (RemotingException rex)
            {
                Console.WriteLine("ERROR: There is a problem with your remoting configuration!");
                Console.WriteLine(rex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: There was problem with the call!");
                Console.WriteLine(ex.Message);
            }
            Console.Read();
        }
    }
}
See Also

Reference