CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Add TreeView to Site

For all of who use Randy Drisgill’s starter masters, it won’t help if you go to Site Actions TreView and just enable it, because the DelegateControl is in a hidden panel.

To really restore the original treeview you have to copy this xml from v4.master:

<Sharepoint:UIVersionedContent runat="server" UIVersion="4">
	<ContentTemplate>
		<Sharepoint:SPNavigationManager
		id="TreeViewNavigationManagerV4"
		runat="server"
		ContainedControl="TreeView"
		CssClass="s4-treeView"
		>
		  <SharePoint:SPLinkButton runat="server" 
			NavigateUrl="~site/_layouts/viewlsts.aspx" 
			id="idNavLinkSiteHierarchyV4" 
			Text="<%$Resources:wss,treeview_header%>" 
			accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>" 
			CssClass="s4-qlheader" />
			  <div class="ms-treeviewouter">
				<SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">
				  <Template_Controls>
					<SharePoint:SPHierarchyDataSourceControl
					 runat="server"
					 id="TreeViewDataSourceV4"
					 RootContextObject="Web"
					 IncludeDiscussionFolders="true"
					/>
					<SharePoint:SPRememberScroll runat="server" 
						id="TreeViewRememberScrollV4" 
						onscroll="javascript:_spRecordScrollPositions(this);" 
						style="overflow: auto;height: 400px;width: 155px; ">
					  <Sharepoint:SPTreeView
						id="WebTreeViewV4"
						runat="server"
						ShowLines="false"
						DataSourceId="TreeViewDataSourceV4"
						ExpandDepth="0"
						SelectedNodeStyle-CssClass="ms-tvselected"
						NodeStyle-CssClass="ms-navitem"
						SkipLinkText=""
						NodeIndent="12"
						ExpandImageUrl="/_layouts/images/tvclosed.png"
						ExpandImageUrlRtl="/_layouts/images/tvclosedrtl.png"
						CollapseImageUrl="/_layouts/images/tvopen.png"
						CollapseImageUrlRtl="/_layouts/images/tvopenrtl.png"
						NoExpandImageUrl="/_layouts/images/tvblank.gif"
					  >
					  </Sharepoint:SPTreeView>
					</Sharepoint:SPRememberScroll>
				  </Template_Controls>
				</SharePoint:DelegateControl>
			  </div>
		</Sharepoint:SPNavigationManager>
	</ContentTemplate>
</SharePoint:UIVersionedContent>

and paste it before:

<asp:ContentPlaceHolder id="PlaceHolderQuickLaunchBottom" runat="server">

And of course we must remove the delegatecontrol duplicate from the hidden panel:

	<!-- Usually shows the tree view but do not remove because of issue with changing views in the ribbon in publishing sites -->
	<SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource"></SharePoint:DelegateControl>
Advertisements

4 responses to “Add TreeView to Site

  1. Zong Low 2012-11-26 at 05:32

    Hi Mr Anatoly,

    A grateful thanks to your post.
    As a SharePoint beginner i have some question for you. Is it possible to add security trimming on the TreeView just allow the authorized user can see whatever are allowed them to see on the TreeView?

    My portal is shared with 3 different users and they can view my library title or document from the TreeView (just view, not access as they have not enough rights to access the library).

    **TreeView should not be disabled or hidden for the purpose of document and current location navigation.

    Example:
    Admin’s View for the TreeView:
    >All Site Content
    >Library A
    >Library B

    User1’s view for the TreeView: (No All site Content node & Library B node)
    >Library A

    User2’s view for the TreeView: (No All site Content node & Library A node)
    >Library B

    Regards,
    Zong

    • Anatoly Mironov 2012-11-26 at 11:01

      Hi Zong! Thanks for your reply and the question. It is very seldom I need to show the treeview and I haven’t used it with security trimming. I would recomment to ask your question on sharepoint.stackexchange.com. Maybe someone else has done it before.

      • Zong Low 2012-11-27 at 06:02

        HI Anatoly,

        Thanks for your reply and i will go stack exchange take a look. Hopefully able to find the solution at there.

        Have a nice day.

        Thanks and regards,
        Zong

  2. Free backlinks 2015-03-20 at 06:02

    I think that what you typed made a bunch of sense. However, think on this, what if you typed a catchier post
    title? I mean, I don’t want to tell you how to run your blog, but what
    if you added a headline that grabbed a person’s attention? I mean Add TreeView to Site
    | CHUVASH.eu is kinda boring. You might peek
    at Yahoo’s home page and note how they write article headlines to get people
    interested. You might add a related video or a related picture or two to grab people interested about what you’ve
    written. Just my opinion, it might make your posts a little bit more
    interesting.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Discovering SharePoint

And going crazy doing it

Bram de Jager talking Office 365, SharePoint and Azure

My view and thoughts on Productivity and more.

My programming life

and everything in between

SharePoint Development Lab by @avishnyakov

It is a good place to share some SharePoint stories and development practices.

SharePoint Dragons

Nikander & Margriet on SharePoint

RealActivity - Real-time and trustworthy

Blog site of founder, RealActivty - Paul J. Swider

Mai Omar Desouki - Avid SharePointer

Egyptian & Vodafoner - Senior SharePoint Consultant

Cameron Dwyer | Office 365, SharePoint, Outlook, OnePlace Solutions

Office 365, SharePoint, OnePlace Solutions & Life's Other Little Wonders

paul.tavares

Me and My doings!

Share SharePoint Points!!

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

SPJoel

SharePoint for everyone

SharePointRyan

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode, ya mama

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint

blksthl

Mostly what I know about SharePoint - CommunicoCuspis

%d bloggers like this: