[This is preliminary documentation and is subject to change.]
This method was added in Content Studio version 5.3.
Namespace: ContentStudio
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
public static ITreeContainer GetSiteStructure( ConnectionId connectionId, SessionId sessionId )
Parameters
- connectionId
- Type: ContentStudioConnectionId
A value that uniquely identifies the requested web site. - sessionId
- Type: ContentStudio.SecuritySessionId
A value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
Return Value
Type: ITreeContainerAn ITreeContainer implementation that contains a hierarchical structures of folders and files.
Exception | Condition |
---|---|
NotSupportedException | The current server configuration does not allow access to resource data. |
UnauthorizedAccessException | Content Studio server does not have the required permission to access the resource. |
SecurityException | Content Studio server does not have the required permission to access the resource. |
CSInvalidSessionException | The Content Studio session is invalid. |
CSPermissionDeniedException | The caller does not have the required permission. |
By default the ~js, ~images and bin site subdirectories are returned but this can be overridden by adding a new string value named allowedSiteResourceSubdirectories to the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Teknikhuset\Content Studio\5.0\Websites\NNN where NNN is the identifier of the web site. This value must be a comma separated list of folders e.g. ~js, ~images, bin.
Note |
---|
Security information To prevent Content Studio from downloading any server resource a DWORD value named allowResourceRetrieval in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Teknikhuset\Content Studio\5.0\Websites\NNN (where NNN is the numeric connectionid of the site) can be added and given the value 0. |
Developers can use the returned information to obtain a single resource by using the GetNamedSiteResource(ConnectionId, SessionId, String) method and passing the value of the PathAndName property of a leaf (file) object returned. Since the information is nested in a tree structure it is probably a good idea to consume the returned objects using series of recursive call as the example below shows.
The following code reads the "hidden" structure of a Content Studio web site and writes it out to the console window by using recursive calls to a small helper method.
public static void PrintCsStructure(ConnectionId connectionId, SessionId sessionId) { var site = SiteStructureReader.GetSiteStructure(ConnectionId, sessionId); WriteStructure(site, 0); } private static void WriteStructure(ITreeContainer parent, int level) { //calculate the indent text var indent = (level == 0 ? String.Empty : new String('\t', level)); //write the current node Console.WriteLine(String.Concat(indent, "-" , parent.Name)); foreach (var container in parent.Containers) //write each child container by calling this method recursively WriteStructure(container, level + 1); foreach (var leaf in parent.Leafs) //write each file Console.WriteLine(String.Concat(indent, "\t" , leaf.Name)); }
The result will be something like the following sample
-CS52 -~js -Icons 11_html.gif 11_normal.gif 16_aligncenter.gif 16_alignleft.gif 16_alignright.gif 16_ascx.gif 16_Attachment.gif 16_bold.gif 16_copy.gif 16_cut.gif 16_decindent.gif 16_hyperlink.gif 16_incindent.gif 16_italic.gif 16_justify.gif 16_LiveObject.gif 16_orderedlist.gif 16_paste.gif 16_picture.gif 16_redo.gif 16_showall.gif 16_strikethrough.gif 16_table.gif 16_ToolBox.gif 16_underline.gif 16_undo.gif 16_unorderedlist.gif 16_xp_folder_formatmall.gif 24_xhtml.GIF 7_SeverControl.gif ActionListIconClose.gif ActionListIconOpen.gif ActionListIconOpenClose.gif asp_browsebutton.gif asp_checkbox.gif asp_checkboxlist.gif asp_dropdownlist.gif asp_noimage.gif asp_radiobutton.gif asp_radiobuttonlist.gif glyph_abbr.gif glyph_acronym.gif glyph_cite.gif glyph_div.gif glyph_form.gif glyph_h1.gif glyph_h2.gif glyph_h3.gif glyph_h4.gif glyph_h5.gif glyph_h6.gif glyph_p.gif glyph_papper.gif glyph_penna.gif glyph_pil.gif glyph_q.gif glyph_span.gif glyph_ul.gif teknikhuset.png -xhtml1 -DTD xhtml-lat1.ent xhtml-special.ent xhtml-symbol.ent xhtml1-frameset.dtd xhtml1-frameset_mod.dtd xhtml1-strict.dtd xhtml1-strict_mod.dtd xhtml1-transitional.dtd xhtml1-transitional_mod.dtd -xhtml11 -DTD xhtml-special.ent xhtml11-model-1.mod xhtml11.dtd xhtml11_mod.dtd -~css admin.css ActionList.htm ActionList.xslt admin.js admin.vbs blank.htm calendar.htc Calendar.htm ContextMenu.js CS_API.js CS_Babytor.htc CS_Babytor.htm CS_BabytorBackComp.htc CS_BabytorToolbar.htm cs_tooltip.js DelegateHttpRequest.ashx DHTMLMenu.js DHTMLMenu.xslt DisableStyle.css DocumentList.htc dom.js dom2.js dummy.htc DynamicControl.aspx EditArea.htc EditSelect.htc GetHTMLData.ashx GetXMLData.ashx global.js Glyphs.css ie4.js ie42.js IFrame.htm IFrame2.htm ns4.js ns42.js ParseControl.aspx PropertyBrowser.aspx ServerControls.css SimpleComponent.htc TemplateList.xslt TreeMenu.js Web.config WebbitorObject.js WebControlUITypeEditorHost.aspx WebControlUITypeEditorHost.aspx.cs WebitorShared.js WebitorTemplates.htc WebitorToolbar.htc WebUIServiceHost.aspx WindowsWebForm.aspx -~images -Menu -mall1 -mall2 -mall3 -normal -TreeMenu 11_html.gif 11_normal.gif 16_adocument.gif 16_edittext.gif 16_hyperlink.gif 16_udocument.gif 18_alignright.gif 18_attachment.gif 18_bold.gif 18_center.gif 18_copy.gif 18_cut.gif 18_decreaseintendent.gif 18_glyph.gif 18_hyperlink.gif 18_increaseintendent.gif 18_italic.gif 18_justify.gif 18_justifyleft.gif 18_orderedlist.gif 18_paste.gif 18_picture.gif 18_print.gif 18_redo.gif 18_StrikeThrough.gif 18_table.gif 18_underline.gif 18_undo.gif 18_unorderedlist.gif 1x1.gif sok_doc.gif sok_left.gif sok_rank1.gif sok_rank2.gif sok_rank3.gif sok_rank4.gif sok_rank5.gif sok_right.gif sok_sort.gif CSServer5.config default.aspx EditDocument.aspx Global.asax PreViewHandler.aspx Web.Config