<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>The Black Knight Sings - SharePoint</title>
    <link>http://www.theblackknightsings.com/</link>
    <description>Songs about SharePoint and other adventures by Per Jakobsen</description>
    <image>
      <url>http://www.theblackknightsings.com/favicon.gif</url>
      <title>The Black Knight Sings - SharePoint</title>
      <link>http://www.theblackknightsings.com/</link>
    </image>
    <language>en-us</language>
    <copyright>Per Jakobsen</copyright>
    <lastBuildDate>Mon, 20 Jul 2009 13:01:05 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>PJBlackKnight@gmail.com</managingEditor>
    <webMaster>PJBlackKnight@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=657139ba-bd80-42af-a4bd-107516bff6b8</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,657139ba-bd80-42af-a4bd-107516bff6b8.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,657139ba-bd80-42af-a4bd-107516bff6b8.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=657139ba-bd80-42af-a4bd-107516bff6b8</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>List all SharePoint groups a user belongs to</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,657139ba-bd80-42af-a4bd-107516bff6b8.aspx</guid>
      <link>http://www.theblackknightsings.com/ListAllSharePointGroupsAUserBelongsTo.aspx</link>
      <pubDate>Mon, 20 Jul 2009 13:01:05 GMT</pubDate>
      <description>&lt;p&gt;
This is just a small Utility requested on one of the SharePoint Newsgroups 
&lt;/p&gt;
&lt;p&gt;
It uses the UserGroup web service to list all the SharePoint Groups a user belongs
to in a specified Site Collection 
&lt;/p&gt;
&lt;p&gt;
It's a small console application which requires two parameters:&lt;br /&gt;
···The first parameter is the Url of the site collection including protocol (example:
http://localhost)&lt;br /&gt;
···The second parameter is the full username including Domain (example: MOSSWORK\user)&lt;br /&gt;
&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.IO;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Xml;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; ListUsersGroups.ug;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; ListUsersGroups
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Program&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; Main(&lt;span style="color: blue;"&gt;string&lt;/span&gt;[]
args)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;if&lt;/span&gt;&lt; 2)&lt;/p&gt; (args.Length 
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;return&lt;/span&gt; help();
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;try&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;UserGroup&lt;/span&gt; usergroup = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;UserGroup&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
usergroup.UseDefaultCredentials = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
usergroup.Url = args[0]+&lt;span style="color: #a31515;"&gt;"/_vti_bin/usergroup.asmx"&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;XmlNode&lt;/span&gt; groupXml =usergroup.GetGroupCollectionFromUser(args[1]);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;XmlDocument&lt;/span&gt; doc = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlDocument&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
doc.Load(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlNodeReader&lt;/span&gt;(groupXml));
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;XmlNamespaceManager&lt;/span&gt; nsmgr = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;XmlNamespaceManager&lt;/span&gt;(doc.NameTable);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
nsmgr.AddNamespace(&lt;span style="color: #a31515;"&gt;"sp"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;"http://schemas.microsoft.com/sharepoint/soap/directory/"&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;XmlNode&lt;/span&gt; group &lt;span style="color: blue;"&gt;in&lt;/span&gt; doc.SelectNodes(&lt;span style="color: #a31515;"&gt;"//sp:Groups/sp:Group"&lt;/span&gt;,
nsmgr))
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(group.Attributes[&lt;span style="color: #a31515;"&gt;"Name"&lt;/span&gt;].Value);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;catch&lt;/span&gt; (&lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt; ex)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"{0}\r\n{1}"&lt;/span&gt;,
ex.Message, ex.StackTrace);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;return&lt;/span&gt; 0;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; help()
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;@"{0} 
&lt;site-url&gt;
&lt;username&gt;
"
&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;Path&lt;/span&gt;.GetFileNameWithoutExtension(&lt;span style="color: #2b91af;"&gt;Environment&lt;/span&gt;.GetCommandLineArgs()[0]));
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;@"
Site-url: Url of site collection including protocol (example http://localhost)"&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;@"
username: Full username including domain (example MOSSWORK\user)"&lt;/span&gt;);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;return&lt;/span&gt; -1;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;p&gt;
This execuable can be found &lt;a href="http://www.theblackknightsings.com/content/binary/ListUsersGroups.exe"&gt;here&lt;/a&gt; and
the source code &lt;a href="http://www.theblackknightsings.com/content/binary/ListUsersGroups.zip"&gt;here&lt;/a&gt; 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=657139ba-bd80-42af-a4bd-107516bff6b8" /&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,657139ba-bd80-42af-a4bd-107516bff6b8.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=ad7689b4-9600-4539-8d81-af8cc18cd1e9</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,ad7689b4-9600-4539-8d81-af8cc18cd1e9.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,ad7689b4-9600-4539-8d81-af8cc18cd1e9.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ad7689b4-9600-4539-8d81-af8cc18cd1e9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When You’re running a medium sized SharePoint Farm you may often get requests from
end users for a list of all the SharePoint sites they have access to.
</p>
        <p>
I’ve implemented a small feature which provides this information as an application
page, which you can access through a new menu item on the Welcome menu.
</p>
        <p>
The implementation of this is quiet simple:
</p>
        <p>
Add a menuitem to the Welcome menu pointing to our own application page: 
</p>
        <div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;">
          <p style="margin: 0px;">
            <span style="color: blue;">    &lt;</span>
            <span style="color: rgb(163, 21, 21);">CustomAction</span>
            <span style="color: blue;">
            </span>
            <span style="color: red;">Id</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">6346660F-707E-40d2-A7CF-AB6BAC7A98FD</span>"
</p>
          <p style="margin: 0px;">
            <span style="color: blue;">                  </span>
            <span style="color: red;">Location</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">Microsoft.SharePoint.StandardMenu</span>"
</p>
          <p style="margin: 0px;">
            <span style="color: blue;">                  </span>
            <span style="color: red;">GroupId</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">PersonalActions</span>"
</p>
          <p style="margin: 0px;">
            <span style="color: blue;">                  </span>
            <span style="color: red;">Sequence</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">400</span>"
</p>
          <p style="margin: 0px;">
            <span style="color: blue;">                  </span>
            <span style="color: red;">Title</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">Show
All Sites</span>"
</p>
          <p style="margin: 0px;">
            <span style="color: blue;">                  </span>
            <span style="color: red;">Description</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">Shows
all sites which you have access to</span>"<span style="color: blue;">&gt;</span></p>
          <p style="margin: 0px;">
            <span style="color: blue;">        &lt;</span>
            <span style="color: rgb(163, 21, 21);">UrlAction</span>
            <span style="color: blue;">
            </span>
            <span style="color: red;">Url</span>
            <span style="color: blue;">=</span>"<span style="color: blue;">_layouts/ShowAllSites/ShowAllSites.aspx</span>"<span style="color: blue;"> /&gt;</span></p>
          <p style="margin: 0px;">
            <span style="color: blue;">    &lt;/</span>
            <span style="color: rgb(163, 21, 21);">CustomAction</span>
            <span style="color: blue;">&gt;</span>
          </p>
        </div>
        <p>
 
</p>
        <p>
The application page just contains a ASP.NET TreeView control and the following code:
</p>
        <p>
Get Login of current user: 
</p>
        <div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;">
          <p style="margin: 0px;">
            login = <span style="color: rgb(43, 145, 175);">SPContext</span>.Current.Web.CurrentUser.LoginName;
</p>
        </div>
        <p>
 
</p>
        <p>
Loop through all SiteCollections inside RunWithElevatedPrivileges: 
</p>
        <div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;">
          <p style="margin: 0px;">
            <span style="color: rgb(43, 145, 175);">SPSecurity</span>.RunWithElevatedPrivileges(<span style="color: blue;">delegate</span>()
</p>
          <p style="margin: 0px;">
            {
</p>
          <p style="margin: 0px;">
                <span style="color: rgb(43, 145, 175);">SPWebService</span> cs
= <span style="color: rgb(43, 145, 175);">SPWebService</span>.ContentService;
</p>
          <p style="margin: 0px;">
                <span style="color: blue;">foreach</span> (<span style="color: rgb(43, 145, 175);">SPWebApplication</span> wa <span style="color: blue;">in</span> cs.WebApplications)
</p>
          <p style="margin: 0px;">
               
{
</p>
          <p style="margin: 0px;">
                    <span style="color: blue;">foreach</span> (<span style="color: rgb(43, 145, 175);">SPSite</span> site <span style="color: blue;">in</span> wa.Sites)
</p>
          <p style="margin: 0px;">
                   
{
</p>
          <p style="margin: 0px;">
                        <span style="color: blue;">using</span> (<span style="color: rgb(43, 145, 175);">SPWeb</span> web
= site.RootWeb)
</p>
          <p style="margin: 0px;">
                       
{
</p>
          <p style="margin: 0px;">
                           
AddWebToTreeIfAccess(web, tvSites.Nodes);
</p>
          <p style="margin: 0px;">
                       
}
</p>
          <p style="margin: 0px;">
                       
site.Dispose();
</p>
          <p style="margin: 0px;">
                   
}
</p>
          <p style="margin: 0px;">
               
}
</p>
          <p style="margin: 0px;">
            });
</p>
        </div>
        <p>
 
</p>
        <p>
Skip Shared Services Administration and My Sites: 
</p>
        <div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;">
          <p style="margin: 0px;">
            <span style="color: blue;">if</span> (web.WebTemplate
== <span style="color: rgb(163, 21, 21);">"OSRV"</span></p>
          <p style="margin: 0px;">
             || web.WebTemplate
== <span style="color: rgb(163, 21, 21);">"SPSMSITEHOST"</span></p>
          <p style="margin: 0px;">
             || web.WebTemplate
== <span style="color: rgb(163, 21, 21);">"SPSPERS"</span>)
</p>
          <p style="margin: 0px;">
                <span style="color: blue;">return</span>;
</p>
        </div>
        <p>
 
</p>
        <p>
Process all child sites: 
</p>
        <div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;">
          <p style="margin: 0px;">
            <span style="color: rgb(43, 145, 175);">TreeNode</span> tn
= <span style="color: blue;">new</span><span style="color: rgb(43, 145, 175);">TreeNode</span>();
</p>
          <p style="margin: 0px;">
            <span style="color: blue;">foreach</span> (<span style="color: rgb(43, 145, 175);">SPWeb</span> childweb <span style="color: blue;">in</span> web.Webs)
</p>
          <p style="margin: 0px;">
            {
</p>
          <p style="margin: 0px;">
               
AddWebToTreeIfAccess(childweb, tn.ChildNodes);
</p>
          <p style="margin: 0px;">
               
childweb.Dispose();
</p>
          <p style="margin: 0px;">
            }
</p>
        </div>
        <p>
 
</p>
        <p>
Check if user can view pages on this site: 
</p>
        <div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;">
          <p style="margin: 0px;">
            <span style="color: blue;">bool</span> userHasAccess
= web.DoesUserHavePermissions(login, <span style="color: rgb(43, 145, 175);">SPBasePermissions</span>.ViewPages);
</p>
        </div>
        <p>
 
</p>
        <p>
Add site to treeview if user can access it or any of it's decendents: 
</p>
        <div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;">
          <p style="margin: 0px;">
            <span style="color: blue;">if</span> (userHasAccess
</p>
          <p style="margin: 0px;">
             || tn.ChildNodes.Count
&gt; 0)
</p>
          <p style="margin: 0px;">
            {
</p>
          <p style="margin: 0px;">
                <span style="color: blue;">if</span> (userHasAccess)
</p>
          <p style="margin: 0px;">
               
{
</p>
          <p style="margin: 0px;">
                   
tn.Text = web.Title;
</p>
          <p style="margin: 0px;">
                   
tn.NavigateUrl = web.Url;
</p>
          <p style="margin: 0px;">
               
}
</p>
          <p style="margin: 0px;">
                <span style="color: blue;">else</span></p>
          <p style="margin: 0px;">
               
{
</p>
          <p style="margin: 0px;">
                   
tn.Text = <span style="color: rgb(163, 21, 21);">"("</span> + web.Title + <span style="color: rgb(163, 21, 21);">")"</span>;
</p>
          <p style="margin: 0px;">
                   
tn.SelectAction = <span style="color: rgb(43, 145, 175);">TreeNodeSelectAction</span>.Expand;
</p>
          <p style="margin: 0px;">
               
}
</p>
          <p style="margin: 0px;">
               
treeNodeCollection.Add(tn);
</p>
          <p style="margin: 0px;">
            }
</p>
        </div>
        <p>
 
</p>
        <p>
A prebuilt solution package can be found <a href="http://www.theblackknightsings.com/content/binary/ShowAllSites-wsp.zip">HERE</a> and
the full source code <a href="http://www.theblackknightsings.com/content/binary/ShowAllSites-src.zip">HERE</a></p>
        <img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=ad7689b4-9600-4539-8d81-af8cc18cd1e9" />
      </body>
      <title>Giving end users a list of all the SharePoint sites they have access to</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,ad7689b4-9600-4539-8d81-af8cc18cd1e9.aspx</guid>
      <link>http://www.theblackknightsings.com/GivingEndUsersAListOfAllTheSharePointSitesTheyHaveAccessTo.aspx</link>
      <pubDate>Sun, 26 Apr 2009 14:59:37 GMT</pubDate>
      <description>&lt;p&gt;
When You’re running a medium sized SharePoint Farm you may often get requests from
end users for a list of all the SharePoint sites they have access to.
&lt;/p&gt;
&lt;p&gt;
I’ve implemented a small feature which provides this information as an application
page, which you can access through a new menu item on the Welcome menu.
&lt;/p&gt;
&lt;p&gt;
The implementation of this is quiet simple:
&lt;/p&gt;
&lt;p&gt;
Add a menuitem to the Welcome menu pointing to our own application page: 
&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;"&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CustomAction&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Id&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;6346660F-707E-40d2-A7CF-AB6BAC7A98FD&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;Location&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Microsoft.SharePoint.StandardMenu&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;GroupId&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;PersonalActions&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;Sequence&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;400&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;Title&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Show
All Sites&lt;/span&gt;"
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red;"&gt;Description&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Shows
all sites which you have access to&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;UrlAction&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;Url&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;_layouts/ShowAllSites/ShowAllSites.aspx&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;CustomAction&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The application page just contains a ASP.NET TreeView control and the following code:
&lt;/p&gt;
&lt;p&gt;
Get Login of current user: 
&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;"&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; login = &lt;span style="color: rgb(43, 145, 175);"&gt;SPContext&lt;/span&gt;.Current.Web.CurrentUser.LoginName;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Loop through all SiteCollections inside RunWithElevatedPrivileges: 
&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;"&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(43, 145, 175);"&gt;SPSecurity&lt;/span&gt;.RunWithElevatedPrivileges(&lt;span style="color: blue;"&gt;delegate&lt;/span&gt;()
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(43, 145, 175);"&gt;SPWebService&lt;/span&gt; cs
= &lt;span style="color: rgb(43, 145, 175);"&gt;SPWebService&lt;/span&gt;.ContentService;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;SPWebApplication&lt;/span&gt; wa &lt;span style="color: blue;"&gt;in&lt;/span&gt; cs.WebApplications)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;SPSite&lt;/span&gt; site &lt;span style="color: blue;"&gt;in&lt;/span&gt; wa.Sites)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;SPWeb&lt;/span&gt; web
= site.RootWeb)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
AddWebToTreeIfAccess(web, tvSites.Nodes);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
site.Dispose();
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Skip Shared Services Administration and My Sites: 
&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;"&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (web.WebTemplate
== &lt;span style="color: rgb(163, 21, 21);"&gt;"OSRV"&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; || web.WebTemplate
== &lt;span style="color: rgb(163, 21, 21);"&gt;"SPSMSITEHOST"&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; || web.WebTemplate
== &lt;span style="color: rgb(163, 21, 21);"&gt;"SPSPERS"&lt;/span&gt;)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt;;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Process all child sites: 
&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;"&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(43, 145, 175);"&gt;TreeNode&lt;/span&gt; tn
= &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;TreeNode&lt;/span&gt;();
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;SPWeb&lt;/span&gt; childweb &lt;span style="color: blue;"&gt;in&lt;/span&gt; web.Webs)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
AddWebToTreeIfAccess(childweb, tn.ChildNodes);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
childweb.Dispose();
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Check if user can view pages on this site: 
&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;"&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; userHasAccess
= web.DoesUserHavePermissions(login, &lt;span style="color: rgb(43, 145, 175);"&gt;SPBasePermissions&lt;/span&gt;.ViewPages);
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Add site to treeview if user can access it or any of it's decendents: 
&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: courier new; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-size: 10pt;"&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (userHasAccess
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; || tn.ChildNodes.Count
&amp;gt; 0)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (userHasAccess)
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
tn.Text = web.Title;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
tn.NavigateUrl = web.Url;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;else&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
tn.Text = &lt;span style="color: rgb(163, 21, 21);"&gt;"("&lt;/span&gt; + web.Title + &lt;span style="color: rgb(163, 21, 21);"&gt;")"&lt;/span&gt;;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
tn.SelectAction = &lt;span style="color: rgb(43, 145, 175);"&gt;TreeNodeSelectAction&lt;/span&gt;.Expand;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
treeNodeCollection.Add(tn);
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
A prebuilt solution package can be found &lt;a href="http://www.theblackknightsings.com/content/binary/ShowAllSites-wsp.zip"&gt;HERE&lt;/a&gt; and
the full source code &lt;a href="http://www.theblackknightsings.com/content/binary/ShowAllSites-src.zip"&gt;HERE&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=ad7689b4-9600-4539-8d81-af8cc18cd1e9" /&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,ad7689b4-9600-4539-8d81-af8cc18cd1e9.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=20199986-abc1-4086-9454-4b241271b83d</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,20199986-abc1-4086-9454-4b241271b83d.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,20199986-abc1-4086-9454-4b241271b83d.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=20199986-abc1-4086-9454-4b241271b83d</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Custom pagers for SPGridView</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,20199986-abc1-4086-9454-4b241271b83d.aspx</guid>
      <link>http://www.theblackknightsings.com/CustomPagersForSPGridView.aspx</link>
      <pubDate>Fri, 19 Dec 2008 21:16:11 GMT</pubDate>
      <description>&lt;p&gt;I don't think that the built in pagers for SPGridView are the most useful and informative, so for one of my current projects I decided to implement two custom pagers&lt;/p&gt;
&lt;p&gt;The first was XofYPager which shows the page numbers like this:&lt;br&gt;
&lt;img src="http://www.theblackknightsings.com/content/binary/XofYPager1.gif" title="" border="0" width="70" height="22"&gt;&lt;br&gt;
&lt;img src="http://www.theblackknightsings.com/content/binary/XofYPager2.gif" alt="" border="0" width="70" height="23"&gt;&lt;br&gt;
&lt;img src="http://www.theblackknightsings.com/content/binary/XofYPager3.gif" alt="" border="0" width="77" height="27"&gt;&lt;/p&gt;
&lt;p&gt;The second was SmartPager which shows the page numbers like this:&lt;br&gt;
&lt;img src="http://www.theblackknightsings.com/content/binary/SmartPager1.gif" alt="" border="0" width="136" height="30"&gt;&lt;br&gt;
&lt;img src="http://www.theblackknightsings.com/content/binary/SmartPager2.gif" alt="" border="0" width="119" height="23"&gt;&lt;br&gt;
&lt;img src="http://www.theblackknightsings.com/content/binary/SmartPager3.gif" alt="" border="0" width="160" height="28"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="mark"&gt;The use of these pagers are very simple just include the classes below and then before you DataBind() your SPGridView set the PagerTemplate property to an instance of one of these classes.&lt;/span&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=20199986-abc1-4086-9454-4b241271b83d"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,20199986-abc1-4086-9454-4b241271b83d.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=4cc55359-1532-48ba-90a9-89bae5d94c5e</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,4cc55359-1532-48ba-90a9-89bae5d94c5e.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,4cc55359-1532-48ba-90a9-89bae5d94c5e.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4cc55359-1532-48ba-90a9-89bae5d94c5e</wfw:commentRss>
      <title>Caching a SharePoint list as a datatable</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,4cc55359-1532-48ba-90a9-89bae5d94c5e.aspx</guid>
      <link>http://www.theblackknightsings.com/CachingASharePointListAsADatatable.aspx</link>
      <pubDate>Fri, 19 Dec 2008 20:57:40 GMT</pubDate>
      <description>&lt;p&gt;For one of my current projects I needed to show a SPGridView with data from a small list on the frontpage of the Intranet.&lt;/p&gt;
&lt;p&gt;The list wasn't very small so didn't want to read if from the database on every hit of the frontpage, but on the hand it was so big that I couldn't cache it.&lt;/p&gt;
&lt;p&gt;Now the big question was how to cache it.&lt;br&gt;
If I used PortalSiteMapProvider then it'll always be refreshed when there was a change, but it would be hard to get the data into the SPGridView for displaying, sorting, paging and filtering.&lt;br&gt;
If I on the other hand justed cached a DataTable, then it'll be easy to use in the SPGridView, but then I'd have to figure out when to invalidate the cache. It should be often enough that users wasn't annoyed with out of date data, but seldom enoughtthat it didn't annoy them due to the performance hit.&lt;/p&gt;
&lt;p&gt;&lt;span class="mark"&gt;So I decided to combine the two and use the PortalSiteMapProvider to figure out when an update was needed and the DataTable for the real caching of the list items.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you need something similar then here is my class, it doesn't deal with item level permissions, so if you need that you'll have to implement something different:&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=4cc55359-1532-48ba-90a9-89bae5d94c5e"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,4cc55359-1532-48ba-90a9-89bae5d94c5e.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=941c1361-a02e-4804-b10f-8ccef8345ed3</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,941c1361-a02e-4804-b10f-8ccef8345ed3.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,941c1361-a02e-4804-b10f-8ccef8345ed3.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=941c1361-a02e-4804-b10f-8ccef8345ed3</wfw:commentRss>
      <title>WCMexport version 1.0</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,941c1361-a02e-4804-b10f-8ccef8345ed3.aspx</guid>
      <link>http://www.theblackknightsings.com/WCMexportVersion10.aspx</link>
      <pubDate>Sun, 16 Nov 2008 12:52:46 GMT</pubDate>
      <description>&lt;p&gt;
When you're branding a site using SharePoint 2007 Web Content Management, you really want to spend your time changing Master Pages and Page Layouts. But you often find that you spend a lot of your time editing your Feature.xml and different Elements.xml files especially if you have a lot of different Page Layouts with web parts for different parts of the site.&lt;br&gt;
&lt;span class="mark"&gt;WCMexport is a small utility which can help you if you don't like doing all the editing of the xml-files from scratch.&lt;/span&gt;&lt;br&gt;
With WCMexport you can use SharePoint Designer or what other tool you want to create the Master Pages, Page Layouts and Style Library Files on a development site.
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=941c1361-a02e-4804-b10f-8ccef8345ed3"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,941c1361-a02e-4804-b10f-8ccef8345ed3.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=8ab49345-71f2-4ca3-99c8-4dcd9fa0b478</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,8ab49345-71f2-4ca3-99c8-4dcd9fa0b478.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,8ab49345-71f2-4ca3-99c8-4dcd9fa0b478.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=8ab49345-71f2-4ca3-99c8-4dcd9fa0b478</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Turn Default Upload Overwrite Off in WSS 3.0</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,8ab49345-71f2-4ca3-99c8-4dcd9fa0b478.aspx</guid>
      <link>http://www.theblackknightsings.com/TurnDefaultUploadOverwriteOffInWSS30.aspx</link>
      <pubDate>Thu, 21 Aug 2008 10:52:41 GMT</pubDate>
      <description>&lt;p&gt;
By default the Overwrite checkbox in Upload.aspx is checked in WSS 3.0 and MOSS 2007, but sometimes you may want to change this default.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://mossjunkie.blogspot.com"&gt;MOSS junkie&lt;/a&gt; has a &lt;a href="http://mossjunkie.blogspot.com/2007/12/uncheck-add-as-new-version-to-existing.html"&gt;post&lt;/a&gt; on how to change that default.&lt;br&gt;
&lt;span class="mark"&gt;But his solution has the downside of having to modify one of the standard application pages which is unsupported and may be overwritten by a upgrade&lt;/span&gt;&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
So how do we change the default without modifying upload.aspx?&lt;br&gt;
&lt;br&gt;
Once again the &amp;lt;delegate&amp;gt; controls in the default masterpage can help us.&lt;br&gt;
This time it's the AdditionalPageHead delegate we can use. This delegate allows you to add any number of usercontrols to the page header of every page in sites where your feature is activated.&lt;br&gt;
So we add a feature with the following elements.xml file:&lt;br&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=8ab49345-71f2-4ca3-99c8-4dcd9fa0b478"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,8ab49345-71f2-4ca3-99c8-4dcd9fa0b478.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=0c80b994-b576-4a91-8ac9-a178a47b0896</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,0c80b994-b576-4a91-8ac9-a178a47b0896.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,0c80b994-b576-4a91-8ac9-a178a47b0896.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0c80b994-b576-4a91-8ac9-a178a47b0896</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Sometimes you don't want your users to be able to search on your SharePoint site.<br />
Part one of this is then to remove your site from the content source in SSP, but you
probably also want to remove the Search box from every page in your site.
</p>
        <p>
          <span class="mark">Fortunately SharePoint makes this very easy</span>
        </p>
        <p>
The different version of SharePoint has different requirements for the Search box
and the way these different serach boxes are implemented are using the Delegate feature
of WSS<br />
Delegates are controls in a masterpage/page whose content is determined by which Features
are activated.<br />
Each Delegate has an ID (SmallSearchInutBox for the Search box) and each Feature can
vote for it's content by specifying an Control element.<br />
For Delegates where AllowMultipleControls are false (like SmallSearchInputBox) the
Control with the lowest sequence wins (25 is the lowest sequence used by OOB Feature)<br />
So to disable the Search box all you have to do is implement a Feature which has a
Control element with sequence below 25 pointing to an empty UserControls.<br />
If you don't want to develop this yourselves you can just download my implementation
which makes a Feature with WebApplication scope.<br />
The source files are <a href="http://www.theblackknightsings.com/content/binary/NoSearchBox-source.zip">here</a> and
a precooked solution file is <a href="http://www.theblackknightsings.com/content/binary/NoSearchBox-wsp.zip">here</a></p>
        <img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=0c80b994-b576-4a91-8ac9-a178a47b0896" />
      </body>
      <title>Remove the Search Box from SharePoint Sites</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,0c80b994-b576-4a91-8ac9-a178a47b0896.aspx</guid>
      <link>http://www.theblackknightsings.com/RemoveTheSearchBoxFromSharePointSites.aspx</link>
      <pubDate>Fri, 15 Aug 2008 07:38:30 GMT</pubDate>
      <description>&lt;p&gt;
Sometimes you don't want your users to be able to search on your SharePoint site.&lt;br&gt;
Part one of this is then to remove your site from the content source in SSP, but you
probably also want to remove the Search box from every page in your site.
&lt;/p&gt;
&lt;p&gt;
&lt;span class="mark"&gt;Fortunately SharePoint makes this very easy&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
The different version of SharePoint has different requirements for the Search box
and the way these different serach boxes are implemented are using the Delegate feature
of WSS&lt;br&gt;
Delegates are controls in a masterpage/page whose content is determined by which Features
are activated.&lt;br&gt;
Each Delegate has an ID (SmallSearchInutBox for the Search box) and each Feature can
vote for it's content by specifying an Control element.&lt;br&gt;
For Delegates where AllowMultipleControls are false (like SmallSearchInputBox) the
Control with the lowest sequence wins (25 is the lowest sequence used by OOB Feature)&lt;br&gt;
So to disable the Search box all you have to do is implement a Feature which has a
Control element with sequence below 25 pointing to an empty UserControls.&lt;br&gt;
If you don't want to develop this yourselves you can just download my implementation
which makes a Feature with WebApplication scope.&lt;br&gt;
The source files are &lt;a href="http://www.theblackknightsings.com/content/binary/NoSearchBox-source.zip"&gt;here&lt;/a&gt; and
a precooked solution file is &lt;a href="http://www.theblackknightsings.com/content/binary/NoSearchBox-wsp.zip"&gt;here&lt;/a&gt; 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=0c80b994-b576-4a91-8ac9-a178a47b0896" /&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,0c80b994-b576-4a91-8ac9-a178a47b0896.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=1c85a4a8-879e-4974-b7c8-e48e6811eedd</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,1c85a4a8-879e-4974-b7c8-e48e6811eedd.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,1c85a4a8-879e-4974-b7c8-e48e6811eedd.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=1c85a4a8-879e-4974-b7c8-e48e6811eedd</wfw:commentRss>
      <slash:comments>25</slash:comments>
      <title>Remove Login box when anonymous users download office document from SharePoint Site</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,1c85a4a8-879e-4974-b7c8-e48e6811eedd.aspx</guid>
      <link>http://www.theblackknightsings.com/RemoveLoginBoxWhenAnonymousUsersDownloadOfficeDocumentFromSharePointSite.aspx</link>
      <pubDate>Wed, 16 Jul 2008 16:33:49 GMT</pubDate>
      <description>&lt;p&gt;
When developing Extranet/Internet site in SharePoint you often want to allow anonymous access and this works fairly well.&lt;br&gt;
&lt;span class="mark"&gt;But there is one are where the out of the box experience fails regarding anonymous access and that is when you allow the users to download Microsoft Office documents. In that case IE/Office pops up a couple of Login dialogs, if the user cancels out of these the document opens as expected, but you really don't want the user to have to cancel a couple of dialogs to open your documents&lt;/span&gt;
&lt;/p&gt;&lt;p&gt;
The problem is that office tries to be intelligent and issues a Microsoft Office Protocol Discovery request to see how much the user is allowed to do, but SharePoint responds with access denied until the users logs in.
&lt;/p&gt;&lt;p&gt;
The solution I've found is to implement a HttpModule which rejects the Microsoft Office Protocol Discovery request if the user isn't logged in and this gets rid of the Login boxes&lt;br&gt;
The essential code is fairly simple:
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=1c85a4a8-879e-4974-b7c8-e48e6811eedd"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,1c85a4a8-879e-4974-b7c8-e48e6811eedd.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=43cefa4a-b7ca-4fc0-873c-5fa6cd653723</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,43cefa4a-b7ca-4fc0-873c-5fa6cd653723.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,43cefa4a-b7ca-4fc0-873c-5fa6cd653723.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=43cefa4a-b7ca-4fc0-873c-5fa6cd653723</wfw:commentRss>
      <title>FeatureReceiver To Cleanup WebPart Files</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,43cefa4a-b7ca-4fc0-873c-5fa6cd653723.aspx</guid>
      <link>http://www.theblackknightsings.com/FeatureReceiverToCleanupWebPartFiles.aspx</link>
      <pubDate>Mon, 14 Jul 2008 17:02:34 GMT</pubDate>
      <description>&lt;p&gt;
Many web-part developers are surprised to see that their web-parts are listed as available even though they have deactivated the feature which contains them
&lt;/p&gt;&lt;p&gt;
And the users are equally surprised when they then try to add the web-part only to see it fail because the code (and safe-control entry) has been removed.
&lt;/p&gt;&lt;p&gt;
&lt;span class="mark"&gt;The problem comes from the fact that deactivating a Feature doesn't remove files provisioned using Module and File entries&lt;/span&gt;
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=43cefa4a-b7ca-4fc0-873c-5fa6cd653723"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,43cefa4a-b7ca-4fc0-873c-5fa6cd653723.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=03a303b6-d6f4-49b7-ae6e-763f94ed73d9</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,03a303b6-d6f4-49b7-ae6e-763f94ed73d9.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,03a303b6-d6f4-49b7-ae6e-763f94ed73d9.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=03a303b6-d6f4-49b7-ae6e-763f94ed73d9</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <title>Features inside a Solution isn't deactivated when the Solution is retracted</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,03a303b6-d6f4-49b7-ae6e-763f94ed73d9.aspx</guid>
      <link>http://www.theblackknightsings.com/FeaturesInsideASolutionIsntDeactivatedWhenTheSolutionIsRetracted.aspx</link>
      <pubDate>Mon, 14 Jul 2008 16:40:41 GMT</pubDate>
      <description>&lt;p&gt;Features and Solutions are two of the best features in WSS 3.0 (except for their names, which makes it very hard to write and speak about them):&lt;br&gt;
* Features because they make it very easy (at least compared to WSS 2.0) to add functionality to a SharePoint site&lt;br&gt;
* Solutions because they take care of much of the hassle about getting the features out on all the servers in the farm&lt;br&gt;
&lt;/p&gt;&lt;p&gt;
One of the great strengths of Features is the ability to have code executed when the Feature is activated and again when it's deactivated. This is very handy for doing any kind of setup and teardown. Especially as there is quiet a few of the declarative features of Features which only works on the first activation (e.g. existing files/content types isn't updated) and some of the declarative features which is left when deactivating. In the last category is the one that surprises web-part developers most.
They've learnt to install .webpart files into the WebPart gallery using Module/File elements and are quiet surprised when they later deactivate their feature and finds that the WebParts is still listed as being available because the .webpart files are left in the WebPart gallery, but when users then try to add the webpart it fails because the code has been removed. See this &lt;a href="/FeatureReceiverToCleanupWebPartFiles.aspx"&gt;post&lt;/a&gt; on how to fix that.
&lt;/p&gt;&lt;p&gt;
The possibility to execute code on install/uninstall of a feature isn't normally that interesting until you notice the bug in the Feature/Solution cooperation:&lt;br&gt;
&lt;span class="mark"&gt;Features inside a Solution isn't deactivated when the Solution is retracted&lt;/span&gt;&lt;br&gt;
Instead the solution just uninstalls the feature while it's still activated, this means that the e.g web parts is removed but that the FeatureDeactivating code isn't run with all kinds of nasty error as a result.
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=03a303b6-d6f4-49b7-ae6e-763f94ed73d9"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,03a303b6-d6f4-49b7-ae6e-763f94ed73d9.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=e68521d6-65d2-46e9-85d9-232a9d1175b1</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,e68521d6-65d2-46e9-85d9-232a9d1175b1.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,e68521d6-65d2-46e9-85d9-232a9d1175b1.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e68521d6-65d2-46e9-85d9-232a9d1175b1</wfw:commentRss>
      <title>Implementing a simple Cascading Dropdown in a usercontrol</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,e68521d6-65d2-46e9-85d9-232a9d1175b1.aspx</guid>
      <link>http://www.theblackknightsings.com/ImplementingASimpleCascadingDropdownInAUsercontrol.aspx</link>
      <pubDate>Thu, 03 Jul 2008 06:29:00 GMT</pubDate>
      <description>&lt;p&gt;A user wanted some guidance on how to implement a cascading dropdown in SharePoint. The following will show a simple example of how to implement that as a user control which has properties for selecting a list, a choice field in that list for the first dropdown and a field for which all appropriate values are shown in the second dropdown&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=e68521d6-65d2-46e9-85d9-232a9d1175b1"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,e68521d6-65d2-46e9-85d9-232a9d1175b1.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=cd1ff8a5-44c6-4403-a29d-b7841d274db5</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,cd1ff8a5-44c6-4403-a29d-b7841d274db5.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,cd1ff8a5-44c6-4403-a29d-b7841d274db5.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=cd1ff8a5-44c6-4403-a29d-b7841d274db5</wfw:commentRss>
      <title>How to use a publishing page as display form</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,cd1ff8a5-44c6-4403-a29d-b7841d274db5.aspx</guid>
      <link>http://www.theblackknightsings.com/HowToUseAPublishingPageAsDisplayForm.aspx</link>
      <pubDate>Fri, 27 Jun 2008 10:17:59 GMT</pubDate>
      <description>&lt;p&gt;&lt;span style="font-family: Lucida Console;"&gt;A client wanted to place a SharePoint calendar on a publishing page and have it configured such that when you clicked an event the full details showed up at the top of the page, and searching for calendar items should also put you at this page.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family: Lucida Console;"&gt;Sounds easy just put the calendar view on the page and set the calendars display form to be that page. But setting the display form to be the publishing page puts the ID of the calendar item in the URL of the publishing page which then confuses SharePoint as it thinks it has to lookup that id in the Pages list.
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:red; font-family: Lucida Console;"&gt;The solution is to introduce a page as display form which the redirects back but with the ID of the calendar item as a querystring parameter with another name than ID.
&lt;/span&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=cd1ff8a5-44c6-4403-a29d-b7841d274db5"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,cd1ff8a5-44c6-4403-a29d-b7841d274db5.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=01166c43-4a5f-4bcb-9cac-41e572bc3f40</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,01166c43-4a5f-4bcb-9cac-41e572bc3f40.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,01166c43-4a5f-4bcb-9cac-41e572bc3f40.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=01166c43-4a5f-4bcb-9cac-41e572bc3f40</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Look up instance of potentially recurring calendar event</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,01166c43-4a5f-4bcb-9cac-41e572bc3f40.aspx</guid>
      <link>http://www.theblackknightsings.com/LookUpInstanceOfPotentiallyRecurringCalendarEvent.aspx</link>
      <pubDate>Fri, 27 Jun 2008 08:39:29 GMT</pubDate>
      <description>&lt;p&gt;
In my &lt;a href="http://www.theblackknightsings.com/HowToUseAPublishingPageAsDisplayForm.aspx"&gt;last post&lt;/a&gt; I described how to redirect to a publishing page in order to use it as display form for a calendar.
&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
It caused the problem of having to look up the right instance of the calendar event (in case of recurrence) ourselves. If we just implement an ordinary display form SPContext does the lookup for us.
&lt;/p&gt;&lt;p&gt;
I poked around in the SDK to find a method which could look up an item from a list based on the RecurrenceID, but without any luck. I knew SPContext did this so I fired up &lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;Reflector&lt;/a&gt; to see how SPContext did this and found GetInstanceItem which did what I wanted, but tightly coupled to the SPContext's current List and then it was also a private method.
&lt;/p&gt;&lt;p&gt;
&lt;span class="mark"&gt;Despite the &lt;a href="http://en.wikipedia.org/wiki/don%27t_repeat_yourself"&gt;DRY principle&lt;/a&gt; I had to reimplement the same function.&lt;/span&gt;
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=01166c43-4a5f-4bcb-9cac-41e572bc3f40"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,01166c43-4a5f-4bcb-9cac-41e572bc3f40.aspx</comments>
      <category>SharePoint</category>
    </item>
    <item>
      <trackback:ping>http://www.theblackknightsings.com/Trackback.aspx?guid=e729df2b-4f6c-4ba7-b69e-ff0a73be5b4b</trackback:ping>
      <pingback:server>http://www.theblackknightsings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.theblackknightsings.com/PermaLink,guid,e729df2b-4f6c-4ba7-b69e-ff0a73be5b4b.aspx</pingback:target>
      <dc:creator>Per Jakobsen</dc:creator>
      <wfw:comment>http://www.theblackknightsings.com/CommentView,guid,e729df2b-4f6c-4ba7-b69e-ff0a73be5b4b.aspx</wfw:comment>
      <wfw:commentRss>http://www.theblackknightsings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e729df2b-4f6c-4ba7-b69e-ff0a73be5b4b</wfw:commentRss>
      <title>How to change Checkin comment after save</title>
      <guid isPermaLink="false">http://www.theblackknightsings.com/PermaLink,guid,e729df2b-4f6c-4ba7-b69e-ff0a73be5b4b.aspx</guid>
      <link>http://www.theblackknightsings.com/HowToChangeCheckinCommentAfterSave.aspx</link>
      <pubDate>Wed, 25 Jun 2008 12:11:53 GMT</pubDate>
      <description>&lt;p&gt;
If your company has very strict requirements on version numbering and want the comments to each of these versions to be correct, then you may run into a problem if you store the documents in SharePoint.
&lt;/p&gt;&lt;p&gt;
The version comment is determined when you check in your document, and after the checkin there is no supported way to change these comments.
&lt;/p&gt;&lt;p&gt;
&lt;span style="color: red;"&gt;If you really need to change the comments of a document and are willing to go the unsupported way of changing the content database directly then this little program can do the work for you:&lt;/span&gt;
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.theblackknightsings.com/aggbug.ashx?id=e729df2b-4f6c-4ba7-b69e-ff0a73be5b4b"/&gt;</description>
      <comments>http://www.theblackknightsings.com/CommentView,guid,e729df2b-4f6c-4ba7-b69e-ff0a73be5b4b.aspx</comments>
      <category>SharePoint</category>
    </item>
  </channel>
</rss>