<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2487384118182081439</id><updated>2011-11-28T00:41:08.662+01:00</updated><category term='click'/><category term='sharepoint'/><category term='webpart'/><category term='onselectednodechanged'/><category term='SQL'/><category term='webcontrol'/><category term='security'/><category term='asp.net'/><category term='CQWP'/><category term='treeview'/><category term='.net'/><category term='MOSS'/><category term='event'/><category term='TSQL'/><title type='text'>Sharepoint and ASP.NET</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-6932813708319929932</id><published>2008-04-16T09:48:00.004+02:00</published><updated>2008-04-25T16:30:55.124+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webpart'/><category scheme='http://www.blogger.com/atom/ns#' term='CQWP'/><category scheme='http://www.blogger.com/atom/ns#' term='MOSS'/><title type='text'>Displaying listname and sitename when querying data with CQWP</title><content type='html'>A colleague of mine who works with our MOSS Intranet asked me if I could help him tweak the Content Query Webpart to aggregate all announcements from all sites in our Intranet.&lt;br /&gt;&lt;br /&gt;He had already started to tune the content, following Heather Solomons excellent article:&lt;br /&gt;&lt;a href="http://www.heathersolomon.com/blog/articles/customitemstyle.aspx"&gt;http://www.heathersolomon.com/blog/articles/customitemstyle.aspx&lt;/a&gt; and an Microsoft article: &lt;a href="http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx"&gt;http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, there seemed to be no way of getting the listname and sitename where the item was coming from to the XSL transformation. After some digging deep with the reflector and some testing with the SPSiteDataQuery I found a solution that seems to do the trick.&lt;br /&gt;&lt;br /&gt;First (as described in step 3 in the Microsoft article) you need to export the .webpart file from the CQWP-webpart that you have configured.&lt;br /&gt;&lt;br /&gt;In the .webpart file there is a property called ViewFieldsOverride. This property overrides the fields that are loaded by the CQWP. This gives us an opportunity to add the Listname when querying the data.&lt;br /&gt;&lt;br /&gt;Since we are overriding it, we first need to add the default fields (Title, Created etc) manually. After that, we add the listname and sitename using the &amp;#60;ListProperty Name="Title" /&amp;#62;and &amp;#60;ProjectProperty Name="Title" /&amp;#62;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&amp;#60;property name="ViewFieldsOverride" type="string"&amp;#62;&amp;#60;![CDATA[&amp;#60;FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Nullable="True" Type="Text" /&amp;#62;&amp;#60;FieldRef ID="{94f89715-e097-4e8b-ba79-ea02aa8b7adb}" Nullable="True" Type="Lookup" /&amp;#62;&amp;#60;FieldRef ID="{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}" Nullable="True" Type="Counter" /&amp;#62;&amp;#60;FieldRef ID="{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}" Nullable="True" Type="DateTime" /&amp;#62;&amp;#60;FieldRef ID="{1df5e554-ec7e-46a6-901d-d85a3881cb18}" Nullable="True" Type="User" /&amp;#62;&amp;#60;FieldRef ID="{d31655d1-1d5b-4511-95a1-7a09e9b75bf2}" Nullable="True" Type="User" /&amp;#62;&amp;#60;FieldRef ID="{8c06beca-0777-48f7-91c7-6da68bc07b69}" Nullable="True" Type="DateTime" /&amp;#62;&amp;#60;FieldRef Name="PublishingRollupImage" Nullable="True" Type="Image" /&amp;#62;&amp;#60;FieldRef Name="_Level" Nullable="True" Type="Number" /&amp;#62;&amp;#60;FieldRef Name="Comments" Nullable="True" Type="Note" /&amp;#62;&amp;#60;ListProperty Name="Title" /&amp;#62;&amp;#60;ProjectProperty Name="Title" /&amp;#62;]]&amp;#62;&amp;#60;/property&amp;#62;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;(Note: I found the GUID:s of the default fields using the reflector)&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After importing the webpart file, the listname and sitename are now available in the xsl-file as ListProperty.Title and ProjectProperty.Title&lt;br /&gt;&lt;br /&gt;Insert the following xsl code in ItemStyle.xsl (for more details, see the Heather Solomon or Microsoft guides above):&lt;br /&gt;&lt;br /&gt;&amp;#60;xsl:value-of select="@ListProperty.Title" /&amp;#62;&lt;br /&gt;&amp;#60;xsl:value-of select="@ProjectProperty.Title" /&amp;#62;&lt;br /&gt;&lt;br /&gt;There is still one problem I'm trying to solve. The Author is for some reason presented as &lt;em&gt;ID&lt;/em&gt;#Name (where ID is a number, specifying the user) when using it in the XSL-file. This can be fixed with the variable below, but I would rather find why the override causes Author to be changed.&lt;br /&gt;&lt;br /&gt;&amp;#60;xsl:variable name="Author"&amp;#62;&lt;br /&gt;&amp;#160;&amp;#60;xsl:choose&amp;#62;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#60;xsl:when test="contains(@Author, '#')"&amp;#62;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#60;xsl:value-of select="substring-after(@Author, '#')" /&amp;#62;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#60;/xsl:when&amp;#62;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#60;xsl:otherwise&amp;#62;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#60;xsl:value-of select="@Author" /&amp;#62;&lt;br /&gt;&amp;#160;&amp;#160;&amp;#60;/xsl:otherwise&amp;#62;&lt;br /&gt;&amp;#160;&amp;#60;/xsl:choose&amp;#62;&lt;br /&gt;&amp;#60;/xsl:variable&amp;#62;&lt;br /&gt;&lt;br /&gt;Use it with the following xsl code:&lt;br /&gt;&amp;#60xsl:value-of select="$Author" /&amp;#62;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="red"&gt;Update:&lt;/font&gt; To enable Audience targeting, we first need to add another field into ViewFieldsOverride. Otherwise, the settings in the webpart won't work:&lt;br /&gt;&amp;#60;FieldRef ID="{61cbb965-1e04-4273-b658-eedaa662f48d}" Nullable="True" Type="TargetTo" /&amp;#62;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-6932813708319929932?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/6932813708319929932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=6932813708319929932' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/6932813708319929932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/6932813708319929932'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2008/04/displaying-listname-and-sitename-when.html' title='Displaying listname and sitename when querying data with CQWP'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-503492400991931273</id><published>2008-02-19T11:10:00.000+01:00</published><updated>2008-02-19T22:28:31.597+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Find localized name of the Everyone group</title><content type='html'>Today a colleague asked me if there is any way to find out what the Everyone group is called in a localized version of Windows. In a Swedish Windows, this group is kalled "Alla" and in a German version it's called "Jeder" etc.&lt;br /&gt;&lt;br /&gt;There is an easy way to do this with .NET with the (new) .NET 2.0 Security functions.&lt;br /&gt;&lt;br /&gt;&lt;pre style="BORDER-RIGHT: #999999 1px dashed; PADDING-RIGHT: 5px; BORDER-TOP: #999999 1px dashed; PADDING-LEFT: 5px; FONT-SIZE: 12px; PADDING-BOTTOM: 5px; OVERFLOW: auto; BORDER-LEFT: #999999 1px dashed; WIDTH: 100%; COLOR: #000000; LINE-HEIGHT: 14px; PADDING-TOP: 5px; BORDER-BOTTOM: #999999 1px dashed; FONT-FAMILY: Andale Mono, Lucida Console, Monaco, fixed, monospace; BACKGROUND-COLOR: #eee"&gt;&lt;code&gt;SecurityIdentifier si = new SecurityIdentifier(WellKnownSidType.WorldSid, null);&lt;br /&gt;NTAccount everyOneGroup = si.Translate(typeof(NTAccount)) as NTAccount;&lt;br /&gt;if (everyOneGroup != null) {&lt;br /&gt;      Console.WriteLine(everyOneGroup.Value); // now contains the localized name&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-503492400991931273?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/503492400991931273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=503492400991931273' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/503492400991931273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/503492400991931273'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2008/02/find-localized-name-of-everyone-group.html' title='Find localized name of the Everyone group'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-1802719255516818098</id><published>2008-02-12T14:35:00.000+01:00</published><updated>2008-02-27T23:53:44.266+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sharepoint'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><title type='text'>Relative URL in Sharepoint is incorrectly resolved</title><content type='html'>Today I had a problem with the TreeView WebControl. I wanted to set the NavigateUrl to a relative url in Sharepoint in one of my webparts (I allow user configuration of this property so this must be resolved correctly).&lt;br /&gt;&lt;br /&gt;When I set the NavigateUrl to "test.aspx" it's resolved to: "_catalogs/masterpage/test.aspx" which probably has something to do with the fact that the webpart manager containing my webparts is declared in the masterpage.&lt;br /&gt;&lt;br /&gt;The solution was simple: Use Page.ResolveUrl before setting the url. This correctly resolves the relative url before it's set to the TreeView:&lt;br /&gt;&lt;br /&gt;string relativeUrl = "test.aspx";&lt;br /&gt;treeNode.NavigateUrl = Page.ResolveUrl(relativeUrl);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-1802719255516818098?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/1802719255516818098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=1802719255516818098' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/1802719255516818098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/1802719255516818098'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2008/02/relative-url-in-sharepoint-resolves.html' title='Relative URL in Sharepoint is incorrectly resolved'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-8813246393175583584</id><published>2008-02-01T09:15:00.000+01:00</published><updated>2008-02-01T09:16:50.616+01:00</updated><title type='text'>CSS reference map!</title><content type='html'>There are a lot of css classes defined in Sharepoint and it's not always easy to know what they look like. There is however a great site that lists all sharepoint css classes with examples:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.heathersolomon.com/content/sp07cssreference.htm"&gt;http://www.heathersolomon.com/content/sp07cssreference.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-8813246393175583584?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/8813246393175583584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=8813246393175583584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/8813246393175583584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/8813246393175583584'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2008/02/css-reference-map.html' title='CSS reference map!'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-9007792968682174957</id><published>2008-01-25T16:06:00.005+01:00</published><updated>2008-04-17T10:52:37.217+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='webcontrol'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='onselectednodechanged'/><category scheme='http://www.blogger.com/atom/ns#' term='click'/><category scheme='http://www.blogger.com/atom/ns#' term='treeview'/><title type='text'>Custom TreeView with a Select (onclick) event</title><content type='html'>One thing that disturbs me a bit is that the TreeView control does not have an event that is triggered when the user clicks an already selected item (in my case, I need to know about this so that I can refresh data. The SelectedNodeChanged is never fired when you click on an already selected item).&lt;br /&gt;&lt;br /&gt;So wondered if it is possible to create my custom implementation of the TreeView and it turned out to be quite easy to do after a quick check in the reflector&lt;br /&gt;&lt;pre style="BORDER-RIGHT: #999999 1px dashed; PADDING-RIGHT: 5px; BORDER-TOP: #999999 1px dashed; PADDING-LEFT: 5px; FONT-SIZE: 12px; PADDING-BOTTOM: 5px; OVERFLOW: auto; BORDER-LEFT: #999999 1px dashed; WIDTH: 100%; COLOR: #000000; LINE-HEIGHT: 14px; PADDING-TOP: 5px; BORDER-BOTTOM: #999999 1px dashed; FONT-FAMILY: Andale Mono, Lucida Console, Monaco, fixed, monospace; HEIGHT: 944px; BACKGROUND-COLOR: #eee"&gt;&lt;p&gt;&lt;code&gt;using System;&lt;br /&gt;&lt;/code&gt;&lt;code&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;namespace GB.ControlLib { &lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;public class GTreeView : System.Web.UI.WebControls.TreeView&lt;br /&gt;{&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt; private static readonly object TreeViewSelected = new object();&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt; public event EventHandler Select&lt;br /&gt; {&lt;br /&gt;  add { base.Events.AddHandler(TreeViewSelected, value); }&lt;br /&gt;&lt;/code&gt;&lt;code&gt;  remove { base.Events.RemoveHandler(TreeViewSelected, value); }&lt;br /&gt; }&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt; protected virtual void OnSelect(EventArgs e)&lt;br /&gt; {&lt;br /&gt;  EventHandler handler = (EventHandler)base.Events[TreeViewSelected];&lt;br /&gt;  if (handler != null) {&lt;br /&gt;    handler(this, e);&lt;br /&gt;  }&lt;br /&gt;&lt;/code&gt;&lt;code&gt; }&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt; internal void RaiseOnSelect()&lt;br /&gt; {&lt;br /&gt;  this.OnSelect(EventArgs.Empty);&lt;br /&gt; }&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt; protected override void RaisePostBackEvent(string eventArgument)&lt;br /&gt; {&lt;br /&gt;  base.RaisePostBackEvent(eventArgument);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  if (eventArgument.Length != 0) {&lt;br /&gt;   char ch = eventArgument[0];&lt;br /&gt;   string val = HttpUtility.HtmlDecode(eventArgument.Substring(1));&lt;br /&gt;   // Pathseparator in eventArgument is backslash, so we must temporary set the separator&lt;br /&gt;   char oldPathSeparator = PathSeparator;&lt;br /&gt;   PathSeparator = '\\';&lt;br /&gt;   TreeNode node = FindNode(val);&lt;br /&gt;   PathSeparator = oldPathSeparator;&lt;br /&gt;&lt;br /&gt;   if (ch == 's') {&lt;br /&gt;    if (node != null) {&lt;br /&gt;     if ((node.SelectAction == TreeNodeSelectAction.Select) &amp;#124;&amp;#124; (node.SelectAction == TreeNodeSelectAction.SelectExpand)) {&lt;br /&gt;      RaiseOnSelect();&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; } &lt;/code&gt;&lt;/p&gt;&lt;code&gt;&lt;p&gt;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-9007792968682174957?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/9007792968682174957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=9007792968682174957' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/9007792968682174957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/9007792968682174957'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2008/01/treeview-with-select-onclick-event.html' title='Custom TreeView with a Select (onclick) event'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-737856915294939324</id><published>2008-01-18T10:38:00.000+01:00</published><updated>2008-02-19T12:18:48.288+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webcontrol'/><category scheme='http://www.blogger.com/atom/ns#' term='sharepoint'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><title type='text'>RichText control in Sharepoint</title><content type='html'>Today I needed a RichText editor in a sharepoint webpart, so after some googling and using the reflector I found a class in the Microsoft.SharePoint.WebControls namespace that fits my needs, InputFormTextBox!&lt;br /&gt;&lt;br /&gt;The control is not well documented (the same as all other controls in the Microsoft.SharePoint.WebControls namespace) but it's quite easy to use:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#66cccc;"&gt;InputFormTextBox&lt;/span&gt; richTextEditor = new &lt;span style="color:#66cccc;"&gt;InputFormTextBox&lt;/span&gt;();&lt;br /&gt;richTextEditor.RichText = &lt;span style="color:#000099;"&gt;true&lt;/span&gt;;&lt;br /&gt;richTextEditor.RichTextMode = &lt;span style="color:#66cccc;"&gt;SPRichTextMode&lt;/span&gt;.FullHtml; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#009900;"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;// (Can be set as FullHtml, Compatible or HtmlAsXml&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The text entered into the control can be get/set in the Text property.&lt;br /&gt;&lt;br /&gt;Set the richTextEditor.MultiLine to true if you want to enable multiline editing.&lt;br /&gt;&lt;br /&gt;You can control the height and width in the same way as you use the regular TextBox control from the System.Web.UI.WebControls namespace.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;References:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.inputformtextbox.aspx"&gt;&lt;span style="font-size:85%;"&gt;http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.inputformtextbox.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.sprichtextmode.aspx"&gt;&lt;span style="font-size:85%;"&gt;http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.sprichtextmode.aspx&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-737856915294939324?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/737856915294939324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=737856915294939324' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/737856915294939324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/737856915294939324'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2008/01/richtext-control-in-sharepoint.html' title='RichText control in Sharepoint'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-3233545873219746854</id><published>2008-01-16T13:45:00.000+01:00</published><updated>2008-02-20T14:28:42.031+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>How to determine the current database in MSSQL</title><content type='html'>Today I wanted to know what database I currently was connected to in an SQL-script (since I dynamically set the database name when calling SQLCMD) and found out that there is a simple function for this: db_name()&lt;br /&gt;&lt;br /&gt;SELECT DB_NAME()&lt;br /&gt;&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/ms189753.aspx"&gt;http://technet.microsoft.com/en-us/library/ms189753.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-3233545873219746854?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/3233545873219746854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=3233545873219746854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/3233545873219746854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/3233545873219746854'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2008/01/determine-current-database.html' title='How to determine the current database in MSSQL'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2487384118182081439.post-1310380049181769615</id><published>2007-12-27T12:46:00.000+01:00</published><updated>2008-01-18T08:59:10.592+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sharepoint'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><title type='text'>Impersonation in ASP.NET causes [COMException (0x80072020): An operations error occurred. ]</title><content type='html'>&lt;p&gt;When you run code that uses DirectorySearcher, DirectoryEntry or other classes that communicates with network resources from a webpart in a Sharepoint site, you recieve a: [COMException (0x80072020): An operations error occurred. ]&lt;/p&gt;&lt;p&gt;This is caused by the fact that when a user is authenticated against a sharepoint server using NTLM or Kerberos, a "secondary token" is sent to the server that it uses to authenticate the user. This token cannot be used to authenticate the current user against another server (e.g. a domain controller). &lt;/p&gt;&lt;p&gt;This can be circumvented by reverting the impersonation to the application pool account used by IIS (if this account has access to Active Directory) with the following code (this is equal to running with impersonation set to false in web.config):&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;&lt;span style="color:#000099;"&gt;using&lt;/span&gt; &lt;span style="color:#000000;"&gt;System.Web.Hosting;&lt;br /&gt;...&lt;br /&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;// Code here runs as the logged on user&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#009900;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#000099;"&gt;using&lt;/span&gt; (&lt;span style="color:#66cccc;"&gt;HostingEnvironment&lt;/span&gt;.Impersonate()) {&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;// This code runs as the application pool user&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#66cccc;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DirectorySearcher&lt;/span&gt; searcher ...&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;}&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;br /&gt;// Code here runs as logged on user again&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2487384118182081439-1310380049181769615?l=sharepoint-tweaking.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint-tweaking.blogspot.com/feeds/1310380049181769615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2487384118182081439&amp;postID=1310380049181769615' title='28 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/1310380049181769615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2487384118182081439/posts/default/1310380049181769615'/><link rel='alternate' type='text/html' href='http://sharepoint-tweaking.blogspot.com/2007/12/impersonation-in-aspnet-causes.html' title='Impersonation in ASP.NET causes [COMException (0x80072020): An operations error occurred. ]'/><author><name>Per Gårdebrink</name><uri>http://www.blogger.com/profile/01429141493102255235</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>28</thr:total></entry></feed>
