Clarity, Technology, and Solving Problems | PracticeThis.com
WP7 App with Key Windows Azure resources – Slides, Videos, How-To’s, and T-shooting – for quick consumption on the go.
LinkedIn
I followed the instructions provided in Module 1: Getting Started Building Web Parts in SharePoint 2010 webcast. This webcast teaches the following:
Quick Resource Box
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14..." % <%@ Register Tagprefix="SharePoint..." %>
...
<%@ Control Language="C#" AutoEventWireup="true..." %> <asp:TreeView ID="siteStructure" runat="server"> </asp:TreeView>
using Microsoft.SharePoint;
SPWeb thisWeb = null; try { TreeNode node; thisWeb = SPContext.Current.Web; node = new TreeNode(thisWeb.Title, null, null, thisWeb.Url, "_self"); siteStructure.Nodes.Add(node); TreeNode parentNode = node; foreach (SPList list in thisWeb.Lists) { if (!list.Hidden) { node = new TreeNode(list.Title, null, null, list.DefaultViewUrl, "_self"); parentNode.ChildNodes.Add(node); } } foreach (SPWeb childWeb in thisWeb.Webs) { addWebs(childWeb, parentNode); } } catch (Exception) { throw; } finally { thisWeb.Dispose(); }
private void addWebs(SPWeb web, TreeNode parentNode) {
TreeNode node; node = new TreeNode(web.Title, null, null, web.Url, "_self"); parentNode.ChildNodes.Add(node); parentNode = node; foreach (SPList list in web.Lists) { if (!list.Hidden) { node = new TreeNode(list.Title, null, null, list.DefaultViewUrl, "_self"); parentNode.ChildNodes.Add(node); } } foreach (SPWeb childWeb in web.Webs) { addWebs(childWeb, parentNode); }