<?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-5908350786857321120</id><updated>2012-01-27T10:29:45.788-08:00</updated><title type='text'>SharePoint Level Orange</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-1532438617141581425</id><published>2007-12-11T11:14:00.001-08:00</published><updated>2007-12-11T11:14:26.703-08:00</updated><title type='text'>Final Post?</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;For the last year I have been using this blog as a sort of playground, however, now that the mirror site is up internally on Microsoft at &lt;a href='http://sharepoint.microsoft.com/blogs/levelorange'&gt;http://sharepoint.microsoft.com/blogs/levelorange&lt;/a&gt; I feel that it may be prudent to start directing people that way.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thank you for all the support that I have received and this may or may not be the last post ;)  We shall see.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Cheers&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-1532438617141581425?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/1532438617141581425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=1532438617141581425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1532438617141581425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1532438617141581425'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/12/final-post.html' title='Final Post?'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-6445325722949001367</id><published>2007-12-10T14:26:00.001-08:00</published><updated>2007-12-10T14:26:06.507-08:00</updated><title type='text'>Finding Assembly Information</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Once again, in an attempt to segment information to prevent information overload, this is a simple one.  In MOSS development, you will many times have to reference assemblies by class name and assembly name along with the public key token.  To accomplish this I use a tool called .NET reflector which can be located &lt;a href='http://www.aisto.com/roeder/dotnet/download.aspx?file=reflector'&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you drag your assembly on the user interface of the tool, you can click on it and see the assembly information as such:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;If you drill down to the actual class, you can see the class information as such:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Promised it would be short but invaluable if this is the first time you've seen the tool.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-6445325722949001367?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/6445325722949001367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=6445325722949001367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/6445325722949001367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/6445325722949001367'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/12/finding-assembly-information.html' title='Finding Assembly Information'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-4307221811160011714</id><published>2007-12-10T12:50:00.001-08:00</published><updated>2007-12-10T12:50:18.680-08:00</updated><title type='text'>GAC’ing an assembly</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Probably not a blog-able subject but wanted something to link to so here goes.&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;div&gt;First thing to do here is strong-name your assembly.  Simply go to properties on the project and signing section.&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;					&lt;/p&gt;&lt;/li&gt;&lt;li&gt;Build your assembly by pressing F7 or however you wish&lt;br /&gt;&lt;/li&gt;&lt;li&gt;From here you can use gacutil, add gacutil to a post-build event or simply navigate to dll and drop it into "c:\windows\assembly"&lt;/li&gt;&lt;/ol&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-4307221811160011714?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/4307221811160011714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=4307221811160011714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4307221811160011714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4307221811160011714'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/12/gacing-assembly.html' title='GAC’ing an assembly'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-4963496101743842280</id><published>2007-12-10T07:18:00.001-08:00</published><updated>2007-12-10T07:18:06.445-08:00</updated><title type='text'>Find GUID of List</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Ok, I have decided to compartamentalize some of these into just a couple searchable topics that I can link to in other things so this is simply going to find out the GUID of an existing list.  There are several ways we can do this including simply writing a quick code snippet.  Technically, we should even be able to write a quick Console App that spits out the GUID based on a URL.  However, we can simply look at the URL after going to the list we want.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;See (If you look at the URL you will see a URLEncoded GUID at the List=:  )&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-4963496101743842280?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/4963496101743842280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=4963496101743842280' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4963496101743842280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4963496101743842280'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/12/find-guid-of-list.html' title='Find GUID of List'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-2685121492295138214</id><published>2007-12-10T07:02:00.001-08:00</published><updated>2007-12-10T07:02:39.652-08:00</updated><title type='text'>Generating a new GUID</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Inevitably in MOSS if you are doing custom development there will come a point where you will have to generate new GUIDs for your features, lists, fields and whatever else.  There is a quick and easy way of doing this from Visual Studio.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Simply open Visual Studio and go to Tools &lt;span style='font-family:Wingdings'&gt;à&lt;/span&gt; Create GUID&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Choose Registry Format and then Copy.  Done and Done.  Know that certain GUIDs in MOSS will complain if you have curly braces {} and some will not.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you are more of a command-line person you can get to the same screen by typing: &lt;br /&gt;&lt;/p&gt;&lt;p style='background: #dddddd; margin-left: 12pt'&gt;&lt;pre&gt;&lt;code&gt;guidgen&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;in the Visual Studio Command Window&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-2685121492295138214?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/2685121492295138214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=2685121492295138214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/2685121492295138214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/2685121492295138214'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/12/generating-new-guid.html' title='Generating a new GUID'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-308119211938308216</id><published>2007-11-27T07:53:00.001-08:00</published><updated>2007-11-27T07:53:17.188-08:00</updated><title type='text'>Implementing a New Authorization Provider</title><content type='html'>&lt;span xmlns=''&gt;&lt;h2&gt;Membership Provider Setup&lt;br /&gt;&lt;/h2&gt;&lt;h3&gt;Tools Needed and other Assumptions&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;The following is assuming you have a working Central Administration Site and Website you wish to apply the custom membership provider to.   You will also need access to the latest of the following files:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Security.dll (Custom Membership and Role Provider)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;In implementing the custom membership provider we are also assuming that you will have access to the custom provider database.  Please note anything &lt;span style='color:red'&gt;&lt;strong&gt;bold and red&lt;/strong&gt;&lt;/span&gt; is configurable.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;We also must note that these instructions apply to the changes that need to be made to the MOSS Server and will need to be done on each WFE that you wish to host the custom membership on.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Once you have completed the following directions to configure the custom provider for your site, the Sharepoint Designer application will not be able to connect to it.  For this reason, I recommend you extend your web application to the "intranet" zone with AD credentials and let the designers know the URL to connect to for Sharepoint Designer.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Please keep in mind that without the SP1 of the .NET 2.0 Framework, the below will throw http Cookie exceptions in the Event viewer.  If you cannot implement the Service Pack, please change CacheRolesInCookie to equal False.&lt;br /&gt;&lt;/p&gt;&lt;h3&gt;GAC&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;The first thing we will do is GAC the following files:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Security.dll&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;Machine.config&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;We are now going to modify the machine.config located at &lt;span style='font-family:Courier New'&gt;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config.&lt;/span&gt;  We will make the following entries:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;membership&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;add name="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" type="&lt;span style='color:red'&gt;&lt;strong&gt;Security.sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;, Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d003b67fe3e7980d" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;            &amp;lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;/providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/membership&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;profile&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        &amp;lt;add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;/providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/profile&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;roleManager&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;add name="&lt;span style='color:red'&gt;&lt;strong&gt;sqlroleproviderName&lt;/strong&gt;&lt;/span&gt;" type="&lt;span style='color:red'&gt;&lt;strong&gt;Security.sqlroleproviderName&lt;/strong&gt;&lt;/span&gt;, Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d003b67fe3e7980d" connectionStringName="OdbcServices" applicationName="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        &amp;lt;add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        &amp;lt;add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;/providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/roleManager&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;These entries will take the place of the existing &amp;lt;Membership&amp;gt;, &amp;lt;Profile&amp;gt;, and &amp;lt;Role Manager&amp;gt; tags.&lt;br /&gt;&lt;/p&gt;&lt;h3&gt;Central Administration Web.config&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;Add the Membership and Role Providers directly under &amp;lt;System.Web&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;membership defaultProvider="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;"&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        &amp;lt;remove name="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        &amp;lt;add connectionStringName="LocalSqlServer"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      passwordAttemptWindow="10"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      enablePasswordRetrieval="false"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      enablePasswordReset="true"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      requiresQuestionAndAnswer="true"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      applicationName="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      requiresUniqueEmail="false"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      passwordFormat="Hashed"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      description="Stores and retrieves membership data from the Microsoft SQL Server database"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      name="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      type="&lt;span style='color:red'&gt;&lt;strong&gt;Security.sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;, Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d003b67fe3e7980d" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;/providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/membership&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;roleManager defaultProvider="AspNetWindowsTokenRoleProvider" &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  enabled="true"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  cacheRolesInCookie="true"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  cookieName=".ASPROLES"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  cookieTimeout="30"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  cookiePath="/"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  cookieRequireSSL="false"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  cookieSlidingExpiration="true"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  cookieProtection="All" &amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;/providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/roleManager&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Replace the &amp;lt;PeoplePickerWildcards/&amp;gt; with the following keys&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;PeoplePickerWildcards&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;clear /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;add key="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" value="%" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;add key="&lt;span style='color:red'&gt;&lt;strong&gt;sqlroleproviderName&lt;/strong&gt;&lt;/span&gt;" value="%" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;add key="AspNetSqlMembershipProvider" value="%" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/PeoplePickerWildcards&amp;gt;&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Add the following directly under &amp;lt;/appsettings&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  &amp;lt;connectionStrings&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;add name="SQLDB"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        connectionString="Data Source=&lt;span style='color:red'&gt;&lt;strong&gt;SQLServer&lt;/strong&gt;&lt;/span&gt;;Initial Catalog=&lt;span style='color:red'&gt;&lt;strong&gt;WSS_Membership&lt;/strong&gt;&lt;/span&gt;;User ID=&lt;span style='color:red'&gt;&lt;strong&gt;sa&lt;/strong&gt;&lt;/span&gt;; Password=&lt;span style='color:red'&gt;&lt;strong&gt;password&lt;/strong&gt;&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        providerName="System.Data.SqlClient" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  &amp;lt;/connectionStrings&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;Web Application Web.config&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;Add the Membership and Role Providers directly under &amp;lt;System.Web&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;membership defaultProvider="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;"&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        &amp;lt;remove name="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;        &amp;lt;add connectionStringName="LocalSqlServer" passwordAttemptWindow="10" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" requiresUniqueEmail="false" passwordFormat="Hashed" description="Stores and retrieves membership data from the Microsoft SQL Server database" name="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" type="&lt;span style='color:red'&gt;&lt;strong&gt;Security.sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;, &lt;span style='color:red'&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/span&gt;, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d003b67fe3e7980d" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;/providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/membership&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;roleManager defaultProvider="&lt;span style='color:red'&gt;&lt;strong&gt;sqlroleproviderName&lt;/strong&gt;&lt;/span&gt;" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All"&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;/providers&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/roleManager&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Replace the &amp;lt;PeoplePickerWildcards/&amp;gt; with the following keys&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;PeoplePickerWildcards&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;clear /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;add key="&lt;span style='color:red'&gt;&lt;strong&gt;sqlmembershipproviderName&lt;/strong&gt;&lt;/span&gt;" value="%" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;add key="&lt;span style='color:red'&gt;&lt;strong&gt;sqlroleproviderName&lt;/strong&gt;&lt;/span&gt;" value="%" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;      &amp;lt;add key="AspNetSqlMembershipProvider" value="%" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;/PeoplePickerWildcards&amp;gt;&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Add the following directly under &amp;lt;/appsettings&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  &amp;lt;connectionStrings&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;    &amp;lt;add name="SQLDB" connectionString="Data Source=&lt;span style='color:red'&gt;&lt;strong&gt;SQLServer&lt;/strong&gt;&lt;/span&gt;;Initial Catalog=&lt;span style='color:red'&gt;&lt;strong&gt;WSS_Membership&lt;/strong&gt;&lt;/span&gt;;User ID=&lt;span style='color:red'&gt;&lt;strong&gt;sa&lt;/strong&gt;&lt;/span&gt;; Password=&lt;span style='color:red'&gt;&lt;strong&gt;password&lt;/strong&gt;&lt;/span&gt;" providerName="System.Data.SqlClient" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:8pt'&gt;  &amp;lt;/connectionStrings&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;Set Authentication Provider for Web Application&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;Log in to your central administration site and go to Application Management &lt;span style='font-family:Wingdings'&gt;à&lt;/span&gt; Authentication Providers.  This can be accessed at &lt;a href='http://ServerName/_admin/authenticationproviders.aspx'&gt;http://&lt;span style='color:red'&gt;&lt;strong&gt;ServerName&lt;/strong&gt;&lt;/span&gt;/_admin/authenticationproviders.aspx&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Make sure that you are in the right web application that you wish to implement the provider for.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Click on the default zone which should be the only one listed at this moment.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Choose forms authentication type and type in [&lt;span style='color:red'&gt;&lt;strong&gt;membershipproviderName&lt;/strong&gt;&lt;/span&gt;],[&lt;span style='color:red'&gt;&lt;strong&gt;sqlroleproviderName&lt;/strong&gt;&lt;/span&gt;] in the appropriate boxes.  Choose Save.&lt;br /&gt;&lt;/p&gt;&lt;h3&gt;Set Policy Administrator for your web application&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;Since you have now changed the authentication for your web application, no one can actually log in quite yet.  What you want to do is set the administrator for the account.  I do not recommend setting more than one or two at this level.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Log in to your central administration site and go to Application Management &lt;span style='font-family:Wingdings'&gt;à&lt;/span&gt; Policy for Web Application.  This can be accessed at &lt;a href='http://ServerName/_admin/policy.aspx'&gt;http://&lt;strong&gt;ServerName&lt;/strong&gt;/_admin/policy.aspx&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Click on "Add Users" and choose Default zone&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Choose Next&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Use the People Picker to set your administrator&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Choose Full Control and click on Finish.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-308119211938308216?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/308119211938308216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=308119211938308216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/308119211938308216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/308119211938308216'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/11/implementing-new-authorization-provider.html' title='Implementing a New Authorization Provider'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-4335477491380485095</id><published>2007-11-27T07:29:00.001-08:00</published><updated>2007-11-27T07:29:24.052-08:00</updated><title type='text'>Designer Changes Best Practices</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;strong&gt;Purpose&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;This document is going outline the Microsoft Best Practices regarding designer changes.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Introduction&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;So we all know that objects in a production environment should follow some pretty fundamental principles.  Some of these would be objects should be source controlled, objects should go through test before deployment to production, objects should be performant to the best of their ability and so on.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;With code this is pretty well documented.  Use Source Safe, VSTS or some other Source Control system, create drop zones and move from environment to environment.  Even the more complex GAC procedures and the like are very well documented and have several approaches to accomplish the environment issues.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Unfortunately, this is not the case for designer changes.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;What are designer changes?&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Designer changes consist of items such as but not limited to:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Master Pages&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Layouts&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Cascading Style Sheets&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Themes&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Feature Overview&lt;/strong&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;To understand the solution is to understand MOSS features.  The following is quote from Microsoft Office SharePoint Server 2007:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;"&lt;span style='font-size:10pt'&gt;&lt;span style='font-family:Arial'&gt;New to the Microsoft Office SharePoint Server 2007 architecture, &lt;/span&gt;&lt;span style='font-family:Arial'&gt;&lt;em&gt;Features &lt;/em&gt;&lt;/span&gt;&lt;span style='font-family:Arial'&gt;offer flexibility&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;in terms of developing and deploying extended functionality—such as page templates,&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;lists, content types, Web Parts, workflow, and events—to new and existing Office Share-&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;Point Server 2007 sites. By default, SharePoint Server 2007 includes prepackaged Features&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;as part of its base installation, such as a My Site Feature. The Feature framework has&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;been extended to allow developers to create custom Features.&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;If you worked with site definitions in SharePoint Portal Server 2003, you'll appreciate the&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;flexibility of Features! With SharePoint Portal Server 2003, if you wanted to add a list or&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;document library to an existing site definition, you had to work with one large&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;ONET.XML file to modify the XML code and then track each of those changes throughout&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;the ONET.XML file. Likewise, if you wanted to add items to the SharePoint toolbars&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;or menus, you had to work with complex Collaborative Application Markup Language&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;(CAML). Features overcome the complexity of injecting such changes by chunking code&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;into smaller, more manageable files, which can be more easily tracked, versioned, and&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;deployed.&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;Both developers and administrators will benefit from using Features throughout a Share-&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;Point Server 2007 deployment. Through Feature schemas, developers can scope and add&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;simple changes, such as provisioning new pages to a SharePoint site, or registering and&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;deploying complex solutions developed in Microsoft Visual Studio 2005, such as event&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;handlers or workflows. Developers can also work with the SharePoint object model,&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;which includes Feature classes to effect changes throughout the life cycle of Features.&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;Examples of these changes include whether certain actions or events occur when a Feature&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;is installed, activated, deactivated, or uninstalled. In addition, administrators can&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;install and deploy Features with ease, using command-line tools, and will have at their&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;fingertips the ability to switch Features on or off via the activate and deactivate options on&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Arial; font-size:10pt'&gt;administrative user-interface pages&lt;/span&gt;"&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;The benefits of using features in this context are as follows:&lt;br /&gt;&lt;/p&gt;&lt;ul style='margin-left: 69pt'&gt;&lt;li&gt;&lt;strong&gt;Ability to leverage a rich source control management solution: &lt;/strong&gt;Because everything is now on the file system, this is no different than your non-SharePoint ASP.NET 2.0 Web projects, or class libraries, etc... they are just files on the file system so you can easily add them to your source control management system of choice! &lt;em&gt;This is HUGE!&lt;/em&gt;&lt;br /&gt;				&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Ability to package up the feature (and all it's files) in a SharePoint solution:&lt;/strong&gt; See where I'm going? If you package up your feature and it's files into a &lt;a href='http://msdn2.microsoft.com/en-us/library/aa543741.aspx'&gt;&lt;span style='color:#ee7900'&gt;SharePoint solution file&lt;/span&gt;&lt;/a&gt; (*.WSP) which you can then use to... &lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Deploy to all SharePoint web front end (WFE) servers in your farm at one time: &lt;/strong&gt;Solution deployment can be scheduled to run at a future time... and the best part: SharePoint's solution framework will automatically deploy the feature to ~all~ your WFE's in the farm at that time. But that's not the only advantage of solutions... &lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Ability to retract deployed solutions: &lt;/strong&gt;Ever had that "oh crap, we gotta get that off the servers NOW!" moment? The solution framework has the ability to yank a deployed solution back at a scheduled time as well (or immediately if you have the "oh crap" moment). &lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;No need for developers to have access to your production environment: &lt;/strong&gt;Since the files are in a feature that's packaged in a single solution (*.WSP) file, your production administrators can easily add the files to your production environment without developers having to open SharePoint Designer to make changes! &lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;All files remain ghosted (uncustomized) on the file system: &lt;/strong&gt;Remember, they are provisioned as Type=GhostableInLibrary which means the content doesn't really reside within the content database, they are on the file system. &lt;em&gt;This is HUGE!&lt;/em&gt; This way... &lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Easier to make changes to existing files going forward: &lt;/strong&gt;Everyone has changes to files once deployed into production. Using this mechanism, you can just upgrade the solution with an updated feature (don't change the solution or feature ID's) and every site that's activated the feature will automatically get the changes applied to their site! &lt;em&gt;This is HUGE!&lt;/em&gt;&lt;br /&gt;				&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Deployment of Features&lt;/strong&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Now we move on to the technical implementation.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;[Will follow up with actual technical details but essentially we will use stsadm with an upgrade flag to remove, and re-add these files]&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;The proper way to move these designer changes should be done utilizing feature deployment methodology in MOSS.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-4335477491380485095?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/4335477491380485095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=4335477491380485095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4335477491380485095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4335477491380485095'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/11/designer-changes-best-practices.html' title='Designer Changes Best Practices'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-5531008806292284325</id><published>2007-11-26T09:32:00.001-08:00</published><updated>2007-11-26T09:32:20.354-08:00</updated><title type='text'>Writing your First Custom Authorization Provider</title><content type='html'>&lt;span xmlns=''&gt;&lt;h3&gt;Intro&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;There are several people who are experts in the area of Custom Authorization Providers in MOSS.  I want to thank each one of them who have helped me over the last year on my authorization provider.  First and foremost I would like to thank Steve Peschka in relation to the base structure and more recently Mitch Prince both from MSFT.  What I would like to demonstrate in this post is writing a brand new Custom Authentication Provider for MOSS for the beginner.  I will make mention that in a different Post I will be addressing Site Minder integration with the custom provider, however, what you need to know here is that this provider will work regardless.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I will be utilizing a basic SQL table structure although you will see that it is not necessary, however, for simplicity sake, I figure it will be the easiest to demonstrate.&lt;br /&gt;&lt;/p&gt;&lt;h3&gt;Creating the Data Structure&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;The first thing we are going to do is just set up some simple tables that we are going to store our users and roles (groups) in.&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #f2f2f2'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;CREATE TABLE dbo.spUser(&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    username VARCHAR (50) NOT NULL,&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    email VARCHAR (200) NOT NULL,&lt;br /&gt;&lt;/p&gt;&lt;p&gt;)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;GO&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;CREATE TABLE dbo.spRole(&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    spRole VARCHAR (200) NOT NULL&lt;br /&gt;&lt;/p&gt;&lt;p&gt;)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;GO&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;CREATE TABLE dbo.spRole_spUser(&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    username VARCHAR (50) NOT NULL,&lt;br /&gt;&lt;/p&gt;&lt;p&gt;    spRole VARCHAR (200) NOT NULL,&lt;br /&gt;&lt;/p&gt;&lt;p&gt;)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Normally, you would add identities, primary keys, foreign keys with relationships etcetera but you get the point.  We have a table to store users a table to store roles and an association between the two.  Once again, this could be whatever data store you wish and have whatever other attributes like telephone number, password, hair color….&lt;br /&gt;&lt;/p&gt;&lt;h3&gt;Understanding the Methods (Membership)&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;Now that we have the base data structure we are going to open up .NET and build our role Provider.  In this case, I will be hooking each critical method up to a SQL Stored Procedure simply because I am more comfortable with this approach.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The first thing we will do is have an understanding of the methods and what they are used for.  I will be only going over the necessary overloads that you must implement and correctly write for your provider to work.  There will be several other properties and methods that you must override, but we will simply throw an exception on these.&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;void&lt;/span&gt; Initialize(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:teal'&gt;NameValueCollection&lt;/span&gt; config)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Initialize simply will set the properties of the provider.  Usually these properties are set in the web.config and read in as a &lt;span style='color:teal; font-family:Courier New; font-size:10pt'&gt;NameValueCollection&lt;/span&gt;.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;bool&lt;/span&gt; ValidateUser(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:blue'&gt;string&lt;/span&gt; password)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;The Validate User method simply takes in a user name and password and returns true or false based on your credential cache.  Here is where you would authenticate.   Your login page then would check this method first and based on the result do something.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:teal'&gt;MembershipUser&lt;/span&gt; GetUser(&lt;span style='color:blue'&gt;object&lt;/span&gt; userId, &lt;span style='color:blue'&gt;bool&lt;/span&gt; userIsOnline)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;This Overload of the Get User method will simply return a Membership User object based on an object.  The way that I normally implement this is to actually take the ID, and pass to the other Get User Method as a .ToString().  This way there is only one code base.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:teal'&gt;MembershipUser&lt;/span&gt; GetUser(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:blue'&gt;bool&lt;/span&gt; userIsOnline)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Here we will be getting the Membership User based on name.  Use intellisense on the new MembershipUser(&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;string&lt;/span&gt; GetUserNameByEmail(&lt;span style='color:blue'&gt;string&lt;/span&gt; email)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;I have searched and searched but cannot find where this method is actually called, however, easy enough to implement and so just get the string that you would pass to the GetUser method based on the email passed in.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:teal'&gt;MembershipUserCollection&lt;/span&gt; FindUsersByEmail(&lt;span style='color:blue'&gt;string&lt;/span&gt; emailToMatch, &lt;span style='color:blue'&gt;int&lt;/span&gt; pageIndex, &lt;span style='color:blue'&gt;int&lt;/span&gt; pageSize, &lt;span style='color:blue'&gt;out&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;int&lt;/span&gt; totalRecords)&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;This method is called on the people picker and will be hit when searching for a person.  Simply pass in the email and set the totalRecords (you can do this with your MembershipCollection.Count property and you are good to go.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:teal'&gt;MembershipUserCollection&lt;/span&gt; FindUsersByName(&lt;span style='color:blue'&gt;string&lt;/span&gt; usernameToMatch, &lt;span style='color:blue'&gt;int&lt;/span&gt; pageIndex, &lt;span style='color:blue'&gt;int&lt;/span&gt; pageSize, &lt;span style='color:blue'&gt;out&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;int&lt;/span&gt; totalRecords)&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;This method is also hit as part of the people picker.  It is the most important people picker method in my opinion and you can write your own wildcard characters.  So something like:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;SELECT username, Email FROM spUser WHERE UserName LIKE %userNameToMatch%&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;The following methods we will not implement even though "must override" is on.  We will set Booleans to false or throw not implemented exceptions here.&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:teal'&gt;MembershipUserCollection&lt;/span&gt; GetAllUsers(&lt;span style='color:blue'&gt;int&lt;/span&gt; pageIndex, &lt;span style='color:blue'&gt;int&lt;/span&gt; pageSize, &lt;span style='color:blue'&gt;out&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; totalRecords)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; DeleteUser(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:blue'&gt;bool&lt;/span&gt; deleteAllRelatedData)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; GetNumberOfUsersOnline()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:teal'&gt;MembershipUser&lt;/span&gt; CreateUser(&lt;span style='color:blue'&gt;string&lt;/span&gt; username, &lt;span style='color:blue'&gt;string&lt;/span&gt; password, &lt;span style='color:blue'&gt;string&lt;/span&gt; email, &lt;span style='color:blue'&gt;string&lt;/span&gt; passwordQuestion, &lt;span style='color:blue'&gt;string&lt;/span&gt; passwordAnswer, &lt;span style='color:blue'&gt;bool&lt;/span&gt; isApproved, &lt;span style='color:blue'&gt;object&lt;/span&gt; providerUserKey, &lt;span style='color:blue'&gt;out&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:teal'&gt;MembershipCreateStatus&lt;/span&gt; status)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; ChangePasswordQuestionAndAnswer(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:blue'&gt;string&lt;/span&gt; password, &lt;span style='color:blue'&gt;string&lt;/span&gt; newPwdQuestion, &lt;span style='color:blue'&gt;string&lt;/span&gt; newPwdAnswer)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;string&lt;/span&gt; GetPassword(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:blue'&gt;string&lt;/span&gt; answer)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; ChangePassword(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:blue'&gt;string&lt;/span&gt; oldPwd, &lt;span style='color:blue'&gt;string&lt;/span&gt; newPwd)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;string&lt;/span&gt; ResetPassword(&lt;span style='color:blue'&gt;string&lt;/span&gt; name, &lt;span style='color:blue'&gt;string&lt;/span&gt; answer)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;void&lt;/span&gt; UpdateUser(&lt;span style='color:teal'&gt;MembershipUser&lt;/span&gt; user)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; UnlockUser(&lt;span style='color:blue'&gt;string&lt;/span&gt; userName)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; EnablePasswordRetrieval&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; EnablePasswordReset&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; RequiresQuestionAndAnswer&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;string&lt;/span&gt; ApplicationName&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; MaxInvalidPasswordAttempts&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; PasswordAttemptWindow&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;bool&lt;/span&gt; RequiresUniqueEmail&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:teal'&gt;MembershipPasswordFormat&lt;/span&gt; PasswordFormat&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; MinRequiredPasswordLength&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;int&lt;/span&gt; MinRequiredNonAlphanumericCharacters&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;br /&gt;					&lt;span style='color:blue'&gt;string&lt;/span&gt; PasswordStrengthRegularExpression&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-5531008806292284325?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/5531008806292284325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=5531008806292284325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/5531008806292284325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/5531008806292284325'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/11/writing-your-first-custom-authorization.html' title='Writing your First Custom Authorization Provider'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-8366760020881629279</id><published>2007-11-26T08:27:00.001-08:00</published><updated>2007-11-26T08:27:10.466-08:00</updated><title type='text'>Provision a New List with Data</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;This is going to be a first in a larger series related to the SharePoint provisioning concept that may be re-written in a more organized fashion, but I figured while it was on my mind, the prerogative of a blogger &lt;span style='font-family:Wingdings'&gt;J&lt;/span&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;So as many of you may or may not have heard the way to deploy new "stuff" in SharePoint is by means of a feature deployments and this phantom thing called "provisioning".  We will go over specific feature deployments in a later post but for now, I wanted to take the easy way and show you how to take the pre-built definitions for VSE and build a new list complete with data.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Let us say I want to create a new list that has lookup data in it (Wait for another post and you will be awed and amazed at how we will build on top of this list&lt;span style='font-family:Wingdings'&gt;J&lt;/span&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;We will store Types of People in this list so I will split it up for now between Business Contacts and Personal Contacts.  We will also store some other piece of information related to this obscure level of data.  Let's make it Send Christmas Cards Boolean.  I know that typically this would be stored at a contact level, but just appease me here.  We'll assume that this will be a default and that individuals can override the base setting.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So essentially our list is going to look something like:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:103px'/&gt;&lt;col style='width:155px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr style='height: 20px'&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  none' vAlign='bottom'&gt;&lt;p&gt;&lt;span style='color:black'&gt;&lt;strong&gt;Contact Type&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  none' vAlign='bottom'&gt;&lt;p&gt;&lt;span style='color:black'&gt;&lt;strong&gt;Send Christmas Cards&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style='height: 20px; background: #d8d8d8'&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none' vAlign='bottom'&gt;&lt;p&gt;&lt;span style='color:black'&gt;Business&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none' vAlign='bottom'&gt;&lt;p style='text-align: center'&gt;&lt;span style='color:black'&gt;FALSE&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style='height: 20px'&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  none' vAlign='bottom'&gt;&lt;p&gt;&lt;span style='color:black'&gt;Personal&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  solid black 0.5pt; border-right:  none' vAlign='bottom'&gt;&lt;p style='text-align: center'&gt;&lt;span style='color:black'&gt;TRUE&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Pretty easy so far right?  It really is, however, as a colleague of mine recently stated:  &lt;em&gt;"this type of info seems kinda hard to find, like it is somekind of arcane tribal knowledge not-often shared with outsiders". &lt;/em&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;So first things first, let's go ahead and download the SharePoint Extensions for Visual Studio 2005 located at:  &lt;a href='http://www.microsoft.com/downloads/details.aspx?familyid=19F21E5E-B715-4F0C-B959-8C6DCBDC1057&amp;amp;displaylang=en'&gt;http://www.microsoft.com/downloads/details.aspx?familyid=19F21E5E-B715-4F0C-B959-8C6DCBDC1057&amp;amp;displaylang=en&lt;/a&gt;.  &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Before we move on, I have to say if this is your first development experience inside of MOSS, you may want to read my article on &lt;a href='http://codeintegrators.blogspot.com/2007/05/moss-2007-development-101-part-1.html'&gt;MOSS Development 101&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now open Visual Studio 2005 and create a new Project.  You will notice some new cool templates when this occurs.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Pretty cool stuff yes?  Now, in a later post, I will outline some of the stuff this will be doing for you behind the scenes but this is just basics right now.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;You will get a pop-up when you choose ok with a drop-down and two checkboxes.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;The drop-down outlines which SharePoint list you wish to inherit from.  Depending on what you choose, we will get different fields pulled in.  For purposes of this example we will be choosing "Custom List".&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The first checkbox essentially is asking if you want to pre-populate this list with values.  Note that these values can be changed once this list is provisioned or created in the site.  For this example we definitely want to do this.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The second checkbox is asking if you want to write code when an event fires for this list.  We are not going to do this for this list but we will be doing this in a later post.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;After choosing ok on this window, Visual Studio will create all the necessary code to create a list and deploy this list in a solution package.  We do, however, need to configure it the way we wish.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This will be done in two steps:&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Configure the Fields we want to use&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Configure the Data we want to pre-populate&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;For the first step, we are going to focus on the newly created schema.xml file.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;Note specifically the &amp;lt;Fields&amp;gt; Section.   Here is the actual:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;        &amp;lt;&lt;/span&gt;&lt;span style='color:maroon'&gt;Fields&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;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:10pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:maroon'&gt;Field&lt;/span&gt;&lt;span style='color:blue'&gt;&lt;br /&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;{244AB5C6-102E-4355-905A-8A4C1F394C19}&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;Name&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;ContactType&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;DisplayName&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;Contact Type&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;Type&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;Text&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;Group&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;Sample Fields&lt;/span&gt;"&lt;span style='color:blue'&gt; /&amp;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:10pt'&gt;&lt;span style='color:blue'&gt;      &amp;lt;&lt;/span&gt;&lt;span style='color:maroon'&gt;Field&lt;/span&gt;&lt;span style='color:blue'&gt;&lt;br /&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;{BB365ADB-3B48-4bc5-B57C-9063226B5C31}&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;Name&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;SendChristmasCards&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;DisplayName&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;Send Christmas Cards?&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;Type&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;Boolean&lt;/span&gt;"&lt;span style='color:blue'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:red'&gt;Group&lt;/span&gt;&lt;span style='color:blue'&gt;=&lt;/span&gt;"&lt;span style='color:blue'&gt;Sample Fields&lt;/span&gt;"&lt;span style='color:blue'&gt; /&amp;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:10pt'&gt;&lt;span style='color:blue'&gt;        &amp;lt;/&lt;/span&gt;&lt;span style='color:maroon'&gt;Fields&lt;/span&gt;&lt;span style='color:blue'&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Notice the IDs.  You may wonder where I got these.  Well, truth be told, I made them up, or rather, I had Visual Studio do this for me.&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='color:red'&gt;&lt;strong&gt;Creating New GUIDs:&lt;/strong&gt;&lt;/span&gt;  To create new GUIDs, simply open up Visual Studio 2005, choose Tools, Create New Guid and select Registry setting.  Then copy to clipboard and paste.  Ta-da!  Keep in mind that some items in SharePoint require the curly braces {} and some do not.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Now for step two (Creating the Data):&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here we are going to focus on the newly created instance.xml.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;In this case, you will notice that we added the &amp;lt;Data&amp;gt; tags.  We can at this point build and deploy.  When building it will create a set.bat in the debug/release folder and you can modify this to point to the correct site.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-8366760020881629279?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/8366760020881629279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=8366760020881629279' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/8366760020881629279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/8366760020881629279'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/11/provision-new-list-with-data.html' title='Provision a New List with Data'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-1239092634581153629</id><published>2007-11-26T07:04:00.001-08:00</published><updated>2007-11-26T07:04:18.450-08:00</updated><title type='text'>Adding Users to a SharePoint List</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;Say you have a list and you wish to copy and paste from excel through the Grid-View Function.  You will notice two things as it relates to the People and Groups Field.&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;It will not take users that do not already exist in SharePoint&lt;br /&gt;&lt;/li&gt;&lt;li&gt;It will not copy at all if the people and groups has the "Allow Multiple Selections" checkbox checked&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Well now that's a bummer.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The following solution is just what I came up with:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;What we are going to do is make a new field that will store a semi-comma delimited list and populate the users in there.  We are then going to write some quick c# do take the data from that column and populate correctly across to the correct column.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The first function we will write will take in the SPWeb that you wish to do this for as well as the semi-comma delimited list.&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #f2f2f2'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:green'&gt;//Return properly validated and added users&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;private&lt;/span&gt; SPFieldUserValueCollection UserValidation(SPWeb web, &lt;span style='color:blue'&gt;string&lt;/span&gt; Users)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            SPFieldUserValueCollection userCollection = &lt;span style='color:blue'&gt;new&lt;/span&gt; SPFieldUserValueCollection();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;string&lt;/span&gt; FormatedUsers = &lt;span style='color:blue'&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;string&lt;/span&gt;[] UserArray = Users.Split(&lt;span style='color:maroon'&gt;';'&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:blue'&gt;string&lt;/span&gt; sUser &lt;span style='color:blue'&gt;in&lt;/span&gt; UserArray)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                SPUser user = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;try&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                    user = web.AllUsers[sUser];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;catch&lt;/span&gt; { }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;if&lt;/span&gt; (user == &lt;span style='color:blue'&gt;null&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;try&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        web.AllUsers.Add(sUser, &lt;span style='color:maroon'&gt;""&lt;/span&gt;, sUser, &lt;span style='color:maroon'&gt;""&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        web.Update();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        user = web.AllUsers[sUser];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;catch&lt;/span&gt; { }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;if&lt;/span&gt; (user != &lt;span style='color:blue'&gt;null&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                    userCollection.Add(&lt;span style='color:blue'&gt;new&lt;/span&gt; SPFieldUserValue(web, user.ID, user.LoginName));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;return&lt;/span&gt; userCollection;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    }&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;The second function we will write will be to take the list, and actually update the list based on the previous method.&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #f2f2f2'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;void&lt;/span&gt; UpdateMyList()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;try&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:green'&gt;//Should do something like:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:green'&gt;//string TopLevelSite = ConfigurationSettings.AppSettings["Site"];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;string&lt;/span&gt; TopLevelSite = &lt;span style='color:maroon'&gt;"http://r2-basemachine:1111"&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;using&lt;/span&gt; (SPSite SPSSite = &lt;span style='color:blue'&gt;new&lt;/span&gt; SPSite(TopLevelSite))&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;using&lt;/span&gt; (SPWeb sPWeb = SPSSite.OpenWeb())&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;string&lt;/span&gt; listName = &lt;span style='color:maroon'&gt;"DatasheetTest"&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        SPList list = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:teal'&gt;DataTable&lt;/span&gt; dt = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        SPListItemCollection listCol = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        list = sPWeb.Lists[listName];&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        listCol = list.Items;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        dt = listCol.GetDataTable();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;                        &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:teal'&gt;DataRow&lt;/span&gt; dr &lt;span style='color:blue'&gt;in&lt;/span&gt; dt.Rows)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                            SPFieldUserValueCollection userCollection = &lt;span style='color:blue'&gt;new&lt;/span&gt; SPFieldUserValueCollection();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                            userCollection = UserValidation(sPWeb, dr[&lt;span style='color:maroon'&gt;"Multi"&lt;/span&gt;].ToString());&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                            SPListItem ListItem = list.GetItemById((&lt;span style='color:blue'&gt;int&lt;/span&gt;)dr[&lt;span style='color:maroon'&gt;"Id"&lt;/span&gt;]);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                            ListItem[&lt;span style='color:maroon'&gt;"PersonField"&lt;/span&gt;] = userCollection;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                            ListItem.Update();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                        }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                   }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;                }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;catch&lt;/span&gt; (&lt;span style='color:teal'&gt;Exception&lt;/span&gt; ex)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:maroon'&gt;"Error:  "&lt;/span&gt; + ex.ToString());&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;            }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;        }&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Happy coding!&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-1239092634581153629?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/1239092634581153629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=1239092634581153629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1239092634581153629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1239092634581153629'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/11/adding-users-to-sharepoint-list.html' title='Adding Users to a SharePoint List'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-9101496646339453199</id><published>2007-09-27T07:12:00.001-07:00</published><updated>2007-09-27T07:15:20.648-07:00</updated><title type='text'>SQL:   Search Procedure</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;This is another useful tool.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This Stored Procedure will allow for searching every table and every field and return a passed value. Essentially, if you forgot where something was, you could use this as a diagnostic tool. It is not recommended for programmatic execution as you could imagine, dependent on optimization of your db structure it could take a while.&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="BACKGROUND: #d9d9d9; BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 638px"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;color:green;"&gt;/****** Object: StoredProcedure [dbo].[SearchAllTables] Script Date: 09/27/2007 10:06:17 ******/&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:blue;"&gt;SET&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;ANSI_NULLS&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;ON&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:blue;"&gt;SET&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;QUOTED_IDENTIFIER&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;ON&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:blue;"&gt;ALTER&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;PROC&lt;/span&gt; [dbo]&lt;span style="color:gray;"&gt;.&lt;/span&gt;[SearchAllTables]&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;color:gray;"&gt;(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    @SearchStr &lt;span style="color:blue;"&gt;nvarchar&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;100&lt;span style="color:gray;"&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:10;color:gray;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;color:blue;"&gt;AS&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;color:blue;"&gt;BEGIN&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:green;"&gt;-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:green;"&gt;-- Purpose: To search all columns of all tables for a given search string&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:green;"&gt;-- Written by: Narayana Vyas Kondreddi&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:green;"&gt;-- Site: http://vyaskn.tripod.com&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:green;"&gt;-- Tested on: SQL Server 7.0 and SQL Server 2000&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:green;"&gt;-- Date modified: 28th July 2002 22:50 GMT&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:blue;"&gt;CREATE&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;TABLE&lt;/span&gt; #Results &lt;span style="color:gray;"&gt;(&lt;/span&gt;ColumnName &lt;span style="color:blue;"&gt;nvarchar&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;370&lt;span style="color:gray;"&gt;),&lt;/span&gt; ColumnValue &lt;span style="color:blue;"&gt;nvarchar&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;3630&lt;span style="color:gray;"&gt;))&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:blue;"&gt;SET&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;NOCOUNT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;ON&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:blue;"&gt;DECLARE&lt;/span&gt; @TableName &lt;span style="color:blue;"&gt;nvarchar&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;256&lt;span style="color:gray;"&gt;),&lt;/span&gt; @ColumnName &lt;span style="color:blue;"&gt;nvarchar&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;128&lt;span style="color:gray;"&gt;),&lt;/span&gt; @SearchStr2 &lt;span style="color:blue;"&gt;nvarchar&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;110&lt;span style="color:gray;"&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:10;"&gt;    &lt;span style="color:blue;"&gt;SET&lt;/span&gt; @TableName &lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&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:10;"&gt;    &lt;span style="color:blue;"&gt;SET&lt;/span&gt; @SearchStr2 &lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:red;"&gt;'%'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt; @SearchStr &lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'%'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;/span&gt;&lt;span style="color:red;"&gt;''''&lt;/span&gt;&lt;span style="color:gray;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:blue;"&gt;WHILE&lt;/span&gt; @TableName &lt;span style="color:gray;"&gt;IS&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NOT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NULL&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:blue;"&gt;BEGIN&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;        &lt;span style="color:blue;"&gt;SET&lt;/span&gt; @ColumnName &lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&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:10;"&gt;        &lt;span style="color:blue;"&gt;SET&lt;/span&gt; @TableName &lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;        &lt;span style="color:gray;"&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:10;"&gt;            &lt;span style="color:blue;"&gt;SELECT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;MIN&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;TABLE_SCHEMA&lt;span style="color:gray;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'.'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;TABLE_NAME&lt;span style="color:gray;"&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:10;"&gt;            &lt;span style="color:blue;"&gt;FROM&lt;/span&gt;     &lt;span style="color:green;"&gt;INFORMATION_SCHEMA.TABLES&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;            &lt;span style="color:blue;"&gt;WHERE&lt;/span&gt;         TABLE_TYPE &lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'BASE TABLE'&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                &lt;span style="color:gray;"&gt;AND&lt;/span&gt;    &lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;TABLE_SCHEMA&lt;span style="color:gray;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'.'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;TABLE_NAME&lt;span style="color:gray;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;&amp;gt;&lt;/span&gt; @TableName&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                &lt;span style="color:gray;"&gt;AND&lt;/span&gt;    &lt;span style="color:fuchsia;"&gt;OBJECTPROPERTY&lt;/span&gt;&lt;span style="color:gray;"&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:10;"&gt;                        &lt;span style="color:fuchsia;"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color:gray;"&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:10;"&gt;                            &lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;TABLE_SCHEMA&lt;span style="color:gray;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'.'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;TABLE_NAME&lt;span style="color:gray;"&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:10;"&gt;                             &lt;span style="color:gray;"&gt;),&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'IsMSShipped'&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                         &lt;span style="color:gray;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;=&lt;/span&gt; 0&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;        &lt;span style="color:gray;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;        &lt;span style="color:blue;"&gt;WHILE&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;@TableName &lt;span style="color:gray;"&gt;IS&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NOT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NULL)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;AND&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;@ColumnName &lt;span style="color:gray;"&gt;IS&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NOT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NULL)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;        &lt;span style="color:blue;"&gt;BEGIN&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;            &lt;span style="color:blue;"&gt;SET&lt;/span&gt; @ColumnName &lt;span style="color:gray;"&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:10;"&gt;            &lt;span style="color:gray;"&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:10;"&gt;                &lt;span style="color:blue;"&gt;SELECT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;MIN&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;COLUMN_NAME&lt;span style="color:gray;"&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:10;"&gt;                &lt;span style="color:blue;"&gt;FROM&lt;/span&gt;     &lt;span style="color:green;"&gt;INFORMATION_SCHEMA.COLUMNS&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                &lt;span style="color:blue;"&gt;WHERE&lt;/span&gt;         TABLE_SCHEMA    &lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;PARSENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;@TableName&lt;span style="color:gray;"&gt;,&lt;/span&gt; 2&lt;span style="color:gray;"&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:10;"&gt;                    &lt;span style="color:gray;"&gt;AND&lt;/span&gt;    TABLE_NAME    &lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="color:fuchsia;"&gt;PARSENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;@TableName&lt;span style="color:gray;"&gt;,&lt;/span&gt; 1&lt;span style="color:gray;"&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:10;"&gt;                    &lt;span style="color:gray;"&gt;AND&lt;/span&gt;    DATA_TYPE &lt;span style="color:gray;"&gt;IN&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:red;"&gt;'char'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'varchar'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'nchar'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'nvarchar'&lt;/span&gt;&lt;span style="color:gray;"&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:10;"&gt;                    &lt;span style="color:gray;"&gt;AND&lt;/span&gt;    &lt;span style="color:fuchsia;"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;COLUMN_NAME&lt;span style="color:gray;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;&amp;gt;&lt;/span&gt; @ColumnName&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;            &lt;span style="color:gray;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;            &lt;span style="color:blue;"&gt;IF&lt;/span&gt; @ColumnName &lt;span style="color:gray;"&gt;IS&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NOT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;NULL&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;            &lt;span style="color:blue;"&gt;BEGIN&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                &lt;span style="color:blue;"&gt;INSERT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;INTO&lt;/span&gt; #Results&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                &lt;span style="color:blue;"&gt;EXEC&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                &lt;span style="color:gray;"&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:10;"&gt;                    &lt;span style="color:red;"&gt;'SELECT '''&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt; @TableName &lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;'.'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt; @ColumnName &lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;''', LEFT('&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt; @ColumnName &lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;', 3630)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:red;"&gt;                    FROM '&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt; @TableName &lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;' (NOLOCK) '&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&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:10;"&gt;                    &lt;span style="color:red;"&gt;' WHERE '&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt; @ColumnName &lt;span style="color:gray;"&gt;+&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;' LIKE '&lt;/span&gt;&lt;br /&gt;&lt;span style="color:gray;"&gt;+&lt;/span&gt; @SearchStr2&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;                &lt;span style="color:gray;"&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:10;"&gt;            &lt;span style="color:blue;"&gt;END&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;        &lt;span style="color:blue;"&gt;END&lt;/span&gt;    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:blue;"&gt;END&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;    &lt;span style="color:blue;"&gt;SELECT&lt;/span&gt; ColumnName&lt;span style="color:gray;"&gt;,&lt;/span&gt; ColumnValue &lt;span style="color:blue;"&gt;FROM&lt;/span&gt; #Results&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;color:blue;"&gt;END&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;The utilization would be something like:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="BACKGROUND: #d9d9d9; BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 638px"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;SearchAllTables &lt;span style="color:red;"&gt;'MyValueToFind'&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;Output would be something like:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 319px"&gt;&lt;col style="WIDTH: 319px"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr style="BACKGROUND: #d9d9d9"&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;ColumnName&lt;/p&gt;&lt;/td&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: medium none; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;Column Value&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: medium none; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;[dbo].[MyTable].[MyField1]&lt;/p&gt;&lt;/td&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: medium none; PADDING-LEFT: 7px; BORDER-LEFT: medium none; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;&lt;a href="http://myvaluetofind.net/"&gt;http://myValueToFind.net&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: medium none; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;[dbo].[MyTable].[MyField2]&lt;/p&gt;&lt;/td&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: medium none; PADDING-LEFT: 7px; BORDER-LEFT: medium none; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;&lt;a href="http://myvaluetofind.net/morevalues"&gt;http://myValueToFind.net/morevalues&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-9101496646339453199?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/9101496646339453199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=9101496646339453199' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/9101496646339453199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/9101496646339453199'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/09/sql-search-procedure.html' title='SQL:   Search Procedure'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-5279195083404307232</id><published>2007-09-27T07:04:00.001-07:00</published><updated>2007-09-27T07:04:01.377-07:00</updated><title type='text'>SQL:   Split Procedure</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;I decided to include a couple tools that I use quite frequently so that there is ease of use.  I cannot take the credit and this is probably on many people's blogs but I wanted to centralize my most common ones.  Thanks to those who contributed.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This Stored Procedure will allow for separating a comma delimited list and returning a table.&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;SET&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;ANSI_NULLS&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;ON&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;SET&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;QUOTED_IDENTIFIER&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;ON&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;ALTER&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;PROCEDURE&lt;/span&gt; [dbo]&lt;span style='color:gray'&gt;.&lt;/span&gt;[Split]&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:gray; font-family:Courier New; font-size:10pt'&gt;(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    @ItemList &lt;span style='color:blue'&gt;NVARCHAR&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;4000&lt;span style='color:gray'&gt;),&lt;/span&gt;&lt;br /&gt;									&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    @delimiter &lt;span style='color:blue'&gt;CHAR&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;1&lt;span style='color:gray'&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:gray; font-family:Courier New; font-size:10pt'&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;AS&lt;/span&gt;&lt;br /&gt;									&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;BEGIN&lt;/span&gt;&lt;br /&gt;									&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    &lt;span style='color:blue'&gt;DECLARE&lt;/span&gt; @IDTable &lt;span style='color:blue'&gt;TABLE&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:gray'&gt;(&lt;/span&gt;Item &lt;span style='color:blue'&gt;VARCHAR&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;100&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;DECLARE&lt;/span&gt; @tempItemList &lt;span style='color:blue'&gt;NVARCHAR&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;4000&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @tempItemList &lt;span style='color:gray'&gt;=&lt;/span&gt; @ItemList&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;DECLARE&lt;/span&gt; @i &lt;span style='color:blue'&gt;INT&lt;/span&gt;&lt;br /&gt;									&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;DECLARE&lt;/span&gt; @Item &lt;span style='color:blue'&gt;NVARCHAR&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;4000&lt;span style='color:gray'&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @tempItemList &lt;span style='color:gray'&gt;=&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:fuchsia'&gt;REPLACE&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:gray'&gt;(&lt;/span&gt;@tempItemList&lt;span style='color:gray'&gt;,&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:red'&gt;' '&lt;/span&gt;&lt;span style='color:gray'&gt;,&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:red'&gt;''&lt;/span&gt;&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @i &lt;span style='color:gray'&gt;=&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:fuchsia'&gt;CHARINDEX&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;@delimiter&lt;span style='color:gray'&gt;,&lt;/span&gt; @tempItemList&lt;span style='color:gray'&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;WHILE&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:gray'&gt;(&lt;/span&gt;&lt;span style='color:fuchsia'&gt;LEN&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;@tempItemList&lt;span style='color:gray'&gt;)&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:gray'&gt;&amp;gt;&lt;/span&gt; 0&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;BEGIN&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;IF&lt;/span&gt; @i &lt;span style='color:gray'&gt;=&lt;/span&gt; 0&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @Item &lt;span style='color:gray'&gt;=&lt;/span&gt; @tempItemList&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;ELSE&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @Item &lt;span style='color:gray'&gt;=&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:gray'&gt;LEFT(&lt;/span&gt;@tempItemList&lt;span style='color:gray'&gt;,&lt;/span&gt; @i &lt;span style='color:gray'&gt;-&lt;/span&gt; 1&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;INSERT&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;INTO&lt;/span&gt; @IDTable&lt;span style='color:gray'&gt;(&lt;/span&gt;Item&lt;span style='color:gray'&gt;)&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;VALUES&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;@Item&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;IF&lt;/span&gt; @i &lt;span style='color:gray'&gt;=&lt;/span&gt; 0&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @tempItemList &lt;span style='color:gray'&gt;=&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:red'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;ELSE&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @tempItemList &lt;span style='color:gray'&gt;=&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:gray'&gt;RIGHT(&lt;/span&gt;@tempItemList&lt;span style='color:gray'&gt;,&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:fuchsia'&gt;LEN&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;@tempItemList&lt;span style='color:gray'&gt;)&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:gray'&gt;-&lt;/span&gt; @i&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;SET&lt;/span&gt; @i &lt;span style='color:gray'&gt;=&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:fuchsia'&gt;CHARINDEX&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;@delimiter&lt;span style='color:gray'&gt;,&lt;/span&gt; @tempItemList&lt;span style='color:gray'&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:10pt'&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;END&lt;/span&gt;&lt;br /&gt;									&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;    &lt;span style='color:blue'&gt;SELECT&lt;/span&gt; Item &lt;span style='color:blue'&gt;FROM&lt;/span&gt; @IDTable&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;END&lt;/span&gt;&lt;br /&gt;									&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;The utilization would be something like:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px; border-top:  solid black 0.5pt; border-left:  solid black 0.5pt; border-bottom:  solid black 0.5pt; border-right:  solid black 0.5pt'&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;CREATE&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;TABLE&lt;/span&gt; #MgrList &lt;span style='color:gray'&gt;(&lt;/span&gt;ManagersUID &lt;span style='color:blue'&gt;VARCHAR&lt;/span&gt;&lt;span style='color:gray'&gt;(&lt;/span&gt;50&lt;span style='color:gray'&gt;))&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;INSERT&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:blue'&gt;INTO&lt;/span&gt; #MgrList&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;&lt;span style='color:blue'&gt;EXEC&lt;/span&gt; Split &lt;span style='color:red'&gt;'100,101,102,103'&lt;/span&gt;&lt;span style='color:gray'&gt;,&lt;/span&gt;&lt;br /&gt;										&lt;span style='color:red'&gt;','&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-5279195083404307232?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/5279195083404307232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=5279195083404307232' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/5279195083404307232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/5279195083404307232'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/09/sql-split-procedure.html' title='SQL:   Split Procedure'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-1016439021986545027</id><published>2007-09-27T04:49:00.001-07:00</published><updated>2007-09-27T04:49:22.519-07:00</updated><title type='text'>Creating Media and Flash Controls in MOSS</title><content type='html'>&lt;span xmlns=''&gt;&lt;h1&gt;Media Control&lt;br /&gt;&lt;/h1&gt;&lt;p&gt;Please note that this code is taken directly from Microsoft's website: &lt;a href='http://msdn2.microsoft.com/en-us/library/aa981226.aspx'&gt;http://msdn2.microsoft.com/en-us/library/aa981226.aspx&lt;/a&gt;  I modified the render output for streaming and cross-browser compatibility&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;The Media Class File should look something like this:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; System.Web;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; System.Web.UI;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; System.Web.UI.WebControls;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; Microsoft.SharePoint;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; Microsoft.SharePoint.Utilities;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; Microsoft.SharePoint.WebControls;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; Microsoft.SharePoint.Publishing.WebControls;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;using&lt;/span&gt;&lt;span style='color:black'&gt; Microsoft.SharePoint.Publishing.Fields;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;namespace&lt;/span&gt;&lt;span style='color:black'&gt; VZ.Controls.CustomFieldControls&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; A Field control that binds to fields of type LinkField and is &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; specialized to select and render embedded media files.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; The RenderFieldForDisplay function generates the HTML markup to &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; display the media file. The MediaSelector control is&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; used at edit time to allow authors to select a media file in&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; the Asset Picker dialog box.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;class&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;MediaPlayerFieldControl&lt;/span&gt;&lt;span style='color:black'&gt; : &lt;/span&gt;&lt;span style='color:teal'&gt;BaseFieldControl&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;MediaSelector&lt;/span&gt;&lt;span style='color:black'&gt; mediaSelector = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;MediaSelector&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt; MediaPlayerFieldControl()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Gets and sets the value in the edit controls&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;object&lt;/span&gt;&lt;span style='color:black'&gt; Value&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;get&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt; mediaUrlValue = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaUrlValue.NavigateUrl =&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaSelector.MediaUrl;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaUrlValue.Text =&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt;.GetDefaultDisplayText(mediaUrlValue.NavigateUrl);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt; mediaUrlValue;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;set&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt; mediaLinkFieldValue =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;value&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;as&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:black'&gt; != mediaLinkFieldValue)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaSelector.MediaUrl =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaLinkFieldValue.NavigateUrl;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;else&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaSelector.MediaUrl = &lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.Empty;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Get the default name used to find the template and &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; control for the MediaPlayerSelector in the control &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; template ASCX files.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;protected&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; DefaultTemplateName&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;get&lt;/span&gt;&lt;span style='color:black'&gt; { &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:maroon'&gt;"MediaPlayerFieldControl"&lt;/span&gt;&lt;span style='color:black'&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;const&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; AllowExternalUrlsViewStateKey = &lt;/span&gt;&lt;span style='color:maroon'&gt;"AllowExternalUrls"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; A flag that determines whether to allow saving of external &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; media URLs.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;bool&lt;/span&gt;&lt;span style='color:black'&gt; AllowExternalUrls&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;get&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Return true by default if not already in view state.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (ViewState[AllowExternalUrlsViewStateKey] == &lt;/span&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:black'&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;true&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:blue'&gt;bool&lt;/span&gt;&lt;span style='color:black'&gt;)ViewState[AllowExternalUrlsViewStateKey];&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;set&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;ViewState[AllowExternalUrlsViewStateKey] = &lt;/span&gt;&lt;span style='color:blue'&gt;value&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Creates the edit control when not in display mode.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;protected&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;/span&gt;&lt;span style='color:black'&gt; CreateChildControls()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;base&lt;/span&gt;&lt;span style='color:black'&gt;.CreateChildControls();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.ControlMode != &lt;/span&gt;&lt;span style='color:teal'&gt;SPControlMode&lt;/span&gt;&lt;span style='color:black'&gt;.Display)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;MediaSelector&lt;/span&gt;&lt;span style='color:black'&gt; mediaSelectorInTemplate =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.TemplateContainer.FindControl(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.TemplateName)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;as&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;MediaSelector&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:black'&gt; == mediaSelectorInTemplate)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// No media selector was found in the control&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// template ASCX files. Add the default selector.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Controls.Add(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaSelector);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;else&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Get the media selector from the control &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// template ASCX file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaSelectorInTemplate.MediaUrl =&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaSelector.MediaUrl;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaSelector = mediaSelectorInTemplate;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Gets the current value for the media URL as stored&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; in the list item.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; itemFieldValueMediaUrl&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;get&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt; currentLinkValue =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.ItemFieldValue &lt;/span&gt;&lt;span style='color:blue'&gt;as&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:black'&gt; != currentLinkValue)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt; currentLinkValue.NavigateUrl;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;else&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.Empty;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Renders the current list item value for the media URL&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; with embedded media player markup.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:gray'&gt;&amp;lt;param name="output"&amp;gt;&amp;lt;/param&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;protected&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;RenderFieldForDisplay(System.Web.UI.&lt;/span&gt;&lt;span style='color:teal'&gt;HtmlTextWriter&lt;/span&gt;&lt;span style='color:black'&gt; output)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (!&lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.IsNullOrEmpty(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.itemFieldValueMediaUrl))&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;output.Write(&lt;/span&gt;&lt;span style='color:teal'&gt;MediaRenderingUtilities&lt;/span&gt;&lt;span style='color:black'&gt;.GetMediaPlayerHtmlMarkup(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.itemFieldValueMediaUrl));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Verifies that the MediaUrl is valid.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;/span&gt;&lt;span style='color:black'&gt; Validate()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;base&lt;/span&gt;&lt;span style='color:black'&gt;.Validate();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.IsValid)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt; currentMediaUrlValue =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Value &lt;/span&gt;&lt;span style='color:blue'&gt;as&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (currentMediaUrlValue ==&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:black'&gt; || &lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.IsNullOrEmpty(currentMediaUrlValue.NavigateUrl))&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Ensure the field is not required.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Field != &lt;/span&gt;&lt;span style='color:blue'&gt;null&lt;/span&gt;&lt;span style='color:black'&gt; &amp;amp;&amp;amp; &lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Field.Required)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.IsValid = &lt;/span&gt;&lt;span style='color:blue'&gt;false&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.ErrorMessage =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"This field is required and must contain a media file URL."&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;else&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// The field is empty and not required.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// The data is valid.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Perform validation on the media file URL.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;HtmlValidationContext&lt;/span&gt;&lt;span style='color:black'&gt; validationContext =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;HtmlValidationContext&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (!&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.AllowExternalUrls)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Restrict URLs to be either from the current site&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// collection or server-relative.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;validationContext.RestrictUrlsToSiteCollection = &lt;/span&gt;&lt;span style='color:blue'&gt;true&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;validationContext.GuidOfThisSiteCollection =&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPContext&lt;/span&gt;&lt;span style='color:black'&gt;.Current.Site.ID;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;bool&lt;/span&gt;&lt;span style='color:black'&gt; droppedTags;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;bool&lt;/span&gt;&lt;span style='color:black'&gt; droppedUrls;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;LinkFieldValue&lt;/span&gt;&lt;span style='color:black'&gt; validatedValue =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;validationContext.ValidateLinkValue(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;currentMediaUrlValue,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;out&lt;/span&gt;&lt;span style='color:black'&gt; droppedTags,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;out&lt;/span&gt;&lt;span style='color:black'&gt; droppedUrls);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (droppedUrls || &lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.IsNullOrEmpty(validatedValue.NavigateUrl))&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// The media file URL in the link field value was&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// not valid so report the error message.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Setting IsValid to false stops saving the page.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.IsValid = &lt;/span&gt;&lt;span style='color:blue'&gt;false&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.ErrorMessage =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"The URL for the media file was invalid."&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (!&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.AllowExternalUrls)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.ErrorMessage +=&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;" You must select a URL within the current site collection."&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; This edit control for the MediaPlayerFieldControl has &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; a toolbar and text box for selecting a media file URL.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; This example intentionally uses a separate toolbar button&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; and text box for the AssetUrlSelctor to show a more complex&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; example. You can use an AssetUrlSelector control instead of &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; a TextBox child control, which displays its own browse button.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;class&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;MediaSelector&lt;/span&gt;&lt;span style='color:black'&gt; : &lt;/span&gt;&lt;span style='color:teal'&gt;WebControl&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;TextBox&lt;/span&gt;&lt;span style='color:black'&gt; mediaUrlTextBox = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;TextBox&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt; MediaSelector()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; This is the media URL value that you can edit in the text&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; box or Asset Picker dialog box.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; MediaUrl&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;get&lt;/span&gt;&lt;span style='color:black'&gt; { &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaUrlTextBox.Text; }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;set&lt;/span&gt;&lt;span style='color:black'&gt; { &lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaUrlTextBox.Text = &lt;/span&gt;&lt;span style='color:blue'&gt;value&lt;/span&gt;&lt;span style='color:black'&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;protected&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;/span&gt;&lt;span style='color:black'&gt; OnInit(&lt;/span&gt;&lt;span style='color:teal'&gt;EventArgs&lt;/span&gt;&lt;span style='color:black'&gt; e)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;base&lt;/span&gt;&lt;span style='color:black'&gt;.OnInit(e);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// This ensures that the TextBox child control receives&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// its postback.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;EnsureChildControls();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Gets JavaScript required to launch an Asset Picker dialog&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; box for choosing a media file URL.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; GetAssetPickerButtonScript()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;AssetUrlSelector&lt;/span&gt;&lt;span style='color:black'&gt; mediaAssetSelector =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;AssetUrlSelector&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// When the AssetUrlSelector control is not added to the&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// page control tree, the Page and ID properties are&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// required because&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// AssetUrlSelector.GetClientLaunchPickerReference() &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// needs register script in the page.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaAssetSelector.Page = &lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Page;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaAssetSelector.ID = &lt;/span&gt;&lt;span style='color:maroon'&gt;"MediaUrlAssetSelector"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Uses the TextBox client ID to connect the Asset Picker&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// dialog box to the text box.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaAssetSelector.AssetUrlClientID =&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaUrlTextBox.ClientID;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Autopostback to see the new media file rendered after&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// clicking OK on the Asset Picker dialog box.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaAssetSelector.AutoPostBack = &lt;/span&gt;&lt;span style='color:blue'&gt;true&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaAssetSelector.OverrideDialogTitle = &lt;/span&gt;&lt;span style='color:maroon'&gt;"Select a media file"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaAssetSelector.OverrideDialogDescription =&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"Select a media file to embed in this page"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaAssetSelector.UseImageAssetPicker = &lt;/span&gt;&lt;span style='color:blue'&gt;false&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt; mediaAssetSelector.GetClientLaunchPickerReference();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;Literal&lt;/span&gt;&lt;span style='color:black'&gt; mediaPlayerOutput = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;Literal&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;protected&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;/span&gt;&lt;span style='color:black'&gt; CreateChildControls()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SimpleToolbar&lt;/span&gt;&lt;span style='color:black'&gt; mediaSelectorToolbar = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;SimpleToolbar&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaSelectorToolbar.ID = &lt;/span&gt;&lt;span style='color:maroon'&gt;"ToolBar"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Controls.Add(mediaSelectorToolbar);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;Label&lt;/span&gt;&lt;span style='color:black'&gt; mediaUrlLabel = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;Label&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaUrlLabel.Text = &lt;/span&gt;&lt;span style='color:maroon'&gt;"Selected media file URL: "&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;mediaUrlLabel.AssociatedControlID = &lt;/span&gt;&lt;span style='color:maroon'&gt;"MediaUrlTextBox"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Controls.Add(mediaUrlLabel);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaUrlTextBox.ID = &lt;/span&gt;&lt;span style='color:maroon'&gt;"MediaUrlTextBox"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaUrlTextBox.CssClass =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"ms-input ms-lactiontable sample-mediaselector-urltextbox"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Controls.Add(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaUrlTextBox);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Add the button after the rest so that the text box&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// ClientID is already determined and can be connected&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// in the Asset Picker dialog box client script.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaSelectorToolbar.AddToolbarButton(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"SelectMediaFile"&lt;/span&gt;&lt;span style='color:black'&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"Select a media file"&lt;/span&gt;&lt;span style='color:black'&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.GetAssetPickerButtonScript(),&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"Open a picker to select a media file URL"&lt;/span&gt;&lt;span style='color:black'&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Add a refresh button to perform a basic postback to&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// to update the MediaUrl rendering.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;mediaSelectorToolbar.AddToolbarButton(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"RefreshMediaFile"&lt;/span&gt;&lt;span style='color:black'&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"Refresh"&lt;/span&gt;&lt;span style='color:black'&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Page.ClientScript.GetPostBackEventReference(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.Empty),&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"Refresh the page to reload the current media file URL"&lt;/span&gt;&lt;span style='color:black'&gt;,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"/_layouts/IMAGES/refresh.gif"&lt;/span&gt;&lt;span style='color:black'&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// If there is a media file URL, this code creates&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// the media player markup.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Controls.Add(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaPlayerOutput);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;protected&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;override&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;/span&gt;&lt;span style='color:black'&gt; OnPreRender(&lt;/span&gt;&lt;span style='color:teal'&gt;EventArgs&lt;/span&gt;&lt;span style='color:black'&gt; e)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; mediaFileOutputHtml =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;MediaRenderingUtilities&lt;/span&gt;&lt;span style='color:black'&gt;.GetMediaPlayerHtmlMarkup(&lt;/span&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.MediaUrl);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.IsNullOrEmpty(mediaFileOutputHtml))&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaPlayerOutput.Text =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"&amp;lt;BR&amp;gt;{There is no valid media file URL to display}&amp;lt;BR&amp;gt;"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;else&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.mediaPlayerOutput.Text =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"&amp;lt;BR&amp;gt;"&lt;/span&gt;&lt;span style='color:black'&gt; + mediaFileOutputHtml + &lt;/span&gt;&lt;span style='color:maroon'&gt;"&amp;lt;BR&amp;gt;"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;base&lt;/span&gt;&lt;span style='color:black'&gt;.OnPreRender(e);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; A simple toolbar class that matches the styles of the&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; publishing field control toolbars.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;class&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;SimpleToolbar&lt;/span&gt;&lt;span style='color:black'&gt; : &lt;/span&gt;&lt;span style='color:teal'&gt;RepeatedControls&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt; SimpleToolbar()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.HeaderHtml =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;"&amp;lt;div class=\"ms-toolbarContainer\" width=\"100%\"&amp;gt;"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.FooterHtml = &lt;/span&gt;&lt;span style='color:maroon'&gt;"&amp;lt;/div&amp;gt;"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.SeparatorHtml = &lt;/span&gt;&lt;span style='color:maroon'&gt;""&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;/span&gt;&lt;span style='color:black'&gt; AddToolbarButton(&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; buttonId,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; buttonText,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; clientOnClick,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; tooltipText)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;Literal&lt;/span&gt;&lt;span style='color:black'&gt; buttonMarkupLiteral = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;Literal&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;buttonMarkupLiteral.Text = &lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.Format(&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;SimpleToolbarButtonHtmlFormat,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlEncode(buttonText),&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlEncode(clientOnClick),&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlEncode(tooltipText));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;buttonMarkupLiteral.ID = buttonId;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Controls.Add(buttonMarkupLiteral);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;void&lt;/span&gt;&lt;span style='color:black'&gt; AddToolbarButton(&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; buttonId,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; buttonText,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; clientOnClick,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; tooltipText,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; buttonImageSrc)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;Literal&lt;/span&gt;&lt;span style='color:black'&gt; buttonMarkupLiteral = &lt;/span&gt;&lt;span style='color:blue'&gt;new&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;Literal&lt;/span&gt;&lt;span style='color:black'&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:black'&gt;buttonMarkupLiteral.Text = &lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.Format(&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;SimpleToolbarButtonImageHtmlFormat,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlEncode(buttonText),&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlEncode(clientOnClick),&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlEncode(tooltipText),&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlUrlAttributeEncode(buttonImageSrc));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;buttonMarkupLiteral.ID = buttonId;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;this&lt;/span&gt;&lt;span style='color:black'&gt;.Controls.Add(buttonMarkupLiteral);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// {0} = Button text&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// {1} = onclick script&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// {2} = Tooltip text&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;const&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; SimpleToolbarButtonHtmlFormat = &lt;/span&gt;&lt;span style='color:maroon'&gt;@"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;DIV class=""ms-toolbarItem ms-selectorlink""&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;A href=""#"" onclick=""{1}"" title=""{2}""&amp;gt;&amp;amp;nbsp;{0}&amp;lt;/A&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;&amp;lt;/DIV&amp;gt;"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// {0} = Button text&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// {1} = onclick script&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// {2} = Tooltip text&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// {3} = Button image markup&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;const&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; SimpleToolbarButtonImageHtmlFormat = &lt;/span&gt;&lt;span style='color:maroon'&gt;@"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;DIV class=""ms-toolbarItem ms-selectorlink""&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;A href=""#"" onclick=""{1}"" title=""{2}""&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;IMG alt=""{2}"" src=""{3}"" border=""0""&amp;gt;{0}&amp;lt;/A&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;&amp;lt;/DIV&amp;gt;"&lt;/span&gt;&lt;span style='color:black'&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;static&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;class&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;MediaRenderingUtilities&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; Take a media file URL and generate HTML markup&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt; for playing the file.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:gray'&gt;///&lt;/span&gt;&lt;span style='color:green'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:gray'&gt;&amp;lt;param name="mediaUrl"&amp;gt;&amp;lt;/param&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;static&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; GetMediaPlayerHtmlMarkup(&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; mediaUrl)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// HtmlUrlAttributeEncode returns an empty string if the &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// URL protocol is not allowed (e.g., JavaScript:)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; encodedUrl =&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:teal'&gt;SPHttpUtility&lt;/span&gt;&lt;span style='color:black'&gt;.HtmlUrlAttributeEncode(mediaUrl);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt;&lt;span style='color:black'&gt; (&lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.IsNullOrEmpty(encodedUrl))&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.Empty;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:blue; font-family:Tahoma; font-size:10pt'&gt;else&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:teal'&gt;String&lt;/span&gt;&lt;span style='color:black'&gt;.Format(MediaPlayerHtmlMarkupFormat, encodedUrl);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// Currently, this code includes only a parameter for the media&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// file URL, but it could also include parameters for the&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// width, height, and other rendering properties from field&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:green; font-family:Tahoma; font-size:10pt'&gt;// control properties or authored data value properties.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;const&lt;/span&gt;&lt;span style='color:black'&gt;&lt;br /&gt;										&lt;/span&gt;&lt;span style='color:blue'&gt;string&lt;/span&gt;&lt;span style='color:black'&gt; MediaPlayerHtmlMarkupFormat = &lt;/span&gt;&lt;span style='color:maroon'&gt;@"&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;@"&amp;lt;object id=""MediaPlayer"" &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;width=400 height=300 &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;classid=""CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"" &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;standby=""Loading Windows Media Player components..."" &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;type=""application/x-oleobject"" &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;codebase=""http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112""&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;param name=""filename"" value=""{0}""&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;param name=""Showcontrols"" value=""True""&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;param name=""autoStart"" value=""True""&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;&amp;lt;embed type=""application/x-mplayer2"" &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;src=""{0}"" name=""MediaPlayer"" &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:maroon; font-family:Tahoma; font-size:10pt'&gt;width=400 height=300&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;&lt;span style='color:maroon'&gt;&amp;lt;/object&amp;gt;";&lt;/span&gt;&lt;span style='color:black'&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='color:black; font-family:Tahoma; font-size:10pt'&gt;}&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h2&gt;Flash Control&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;I took the liberty to slightly modify the Media Control "mainly HTML markup" to Support Flash&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse; background: #d9d9d9'&gt;&lt;colgroup&gt;&lt;col style='width:638px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-left: 7px; padding-right: 7px'&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;using System;&lt;br/&gt;using System.Web;&lt;br/&gt;using System.Web.UI;&lt;br/&gt;using System.Web.UI.WebControls;&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;using Microsoft.SharePoint;&lt;br/&gt;using Microsoft.SharePoint.Utilities;&lt;br/&gt;using Microsoft.SharePoint.WebControls;&lt;br/&gt;using Microsoft.SharePoint.Publishing.WebControls;&lt;br/&gt;using Microsoft.SharePoint.Publishing.Fields;&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;namespace VZ.Controls.CustomFieldControls&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;/// A Field control that binds to fields of type LinkField and is &lt;br/&gt;/// specialized to select and render embedded flash files.&lt;br/&gt;/// The RenderFieldForDisplay function generates the HTML markup to &lt;br/&gt;/// display the flash file.  The FlashSelector control is&lt;br/&gt;/// used at edit time to allow authors to select a flash file in&lt;br/&gt;/// the Asset Picker dialog box.&lt;br/&gt;{&lt;br/&gt;    public class FlashFieldControl : BaseFieldControl&lt;br/&gt;    {&lt;br/&gt;        private FlashSelector flashSelector = new FlashSelector();&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        public FlashFieldControl()&lt;br/&gt;        {&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// Gets and sets the value in the edit controls&lt;br/&gt;        public override object Value&lt;br/&gt;        {&lt;br/&gt;            get&lt;br/&gt;            {&lt;br/&gt;                LinkFieldValue flashUrlValue = new LinkFieldValue();&lt;br/&gt;                flashUrlValue.NavigateUrl =&lt;br/&gt;                  this.flashSelector.FlashUrl;&lt;br/&gt;                flashUrlValue.Text =&lt;br/&gt;                  LinkFieldValue.GetDefaultDisplayText(flashUrlValue.NavigateUrl);&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;                return flashUrlValue;&lt;br/&gt;            }&lt;br/&gt;            set&lt;br/&gt;            {&lt;br/&gt;                LinkFieldValue flashLinkFieldValue =&lt;br/&gt;                  value as LinkFieldValue;&lt;br/&gt;                if (null != flashLinkFieldValue)&lt;br/&gt;                {&lt;br/&gt;                    this.flashSelector.FlashUrl =&lt;br/&gt;                      flashLinkFieldValue.NavigateUrl;&lt;br/&gt;                }&lt;br/&gt;                else&lt;br/&gt;                {&lt;br/&gt;                    this.flashSelector.FlashUrl = String.Empty;&lt;br/&gt;                }&lt;br/&gt;            }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// Get the default name used to find the template and &lt;br/&gt;        /// control for the FlashSelector in the control &lt;br/&gt;        /// template ASCX files.&lt;br/&gt;        protected override string DefaultTemplateName&lt;br/&gt;        {&lt;br/&gt;            get { return "FlashFieldControl"; }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        private const string AllowExternalUrlsViewStateKey = "AllowExternalUrls";&lt;br/&gt;        /// A flag that determines whether to allow saving of external &lt;br/&gt;        /// flash URLs.&lt;br/&gt;        public bool AllowExternalUrls&lt;br/&gt;        {&lt;br/&gt;            get&lt;br/&gt;            {&lt;br/&gt;                // Return true by default if not already in view state.&lt;br/&gt;                if (ViewState[AllowExternalUrlsViewStateKey] == null)&lt;br/&gt;                {&lt;br/&gt;                    return true;&lt;br/&gt;                }&lt;br/&gt;                return (bool)ViewState[AllowExternalUrlsViewStateKey];&lt;br/&gt;            }&lt;br/&gt;            set&lt;br/&gt;            {&lt;br/&gt;                ViewState[AllowExternalUrlsViewStateKey] = value;&lt;br/&gt;            }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// Creates the edit control when not in display mode.&lt;br/&gt;        protected override void CreateChildControls()&lt;br/&gt;        {&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            base.CreateChildControls();&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            if (this.ControlMode != SPControlMode.Display)&lt;br/&gt;            {&lt;br/&gt;                FlashSelector flashSelectorInTemplate =&lt;br/&gt;                  this.TemplateContainer.FindControl(this.TemplateName)&lt;br/&gt;                  as FlashSelector;&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;                if (null == flashSelectorInTemplate)&lt;br/&gt;                {&lt;br/&gt;                    // No flash selector was found in the control&lt;br/&gt;                    // template ASCX files. Add the default selector.&lt;br/&gt;                    this.Controls.Add(this.flashSelector);&lt;br/&gt;                }&lt;br/&gt;                else&lt;br/&gt;                {&lt;br/&gt;                    // Get the flash selector from the control &lt;br/&gt;                    // template ASCX file.&lt;br/&gt;                    flashSelectorInTemplate.FlashUrl =&lt;br/&gt;                      this.flashSelector.FlashUrl;&lt;br/&gt;                    this.flashSelector = flashSelectorInTemplate;&lt;br/&gt;                }&lt;br/&gt;            }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// Gets the current value for the flash URL as stored&lt;br/&gt;        /// in the list item.&lt;br/&gt;        private string itemFieldValueFlashUrl&lt;br/&gt;        {&lt;br/&gt;            get&lt;br/&gt;            {&lt;br/&gt;                LinkFieldValue currentLinkValue =&lt;br/&gt;                  this.ItemFieldValue as LinkFieldValue;&lt;br/&gt;                if (null != currentLinkValue)&lt;br/&gt;                {&lt;br/&gt;                    return currentLinkValue.NavigateUrl;&lt;br/&gt;                }&lt;br/&gt;                else&lt;br/&gt;                {&lt;br/&gt;                    return String.Empty;&lt;br/&gt;                }&lt;br/&gt;            }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// Renders the current list item value for the flash URL&lt;br/&gt;        /// with embedded flash player markup.&lt;br/&gt;        /// &amp;lt;param name="output"&amp;gt;&amp;lt;/param&amp;gt;&lt;br/&gt;        protected override void&lt;br/&gt;          RenderFieldForDisplay(System.Web.UI.HtmlTextWriter output)&lt;br/&gt;        {&lt;br/&gt;            if (!String.IsNullOrEmpty(this.itemFieldValueFlashUrl))&lt;br/&gt;            {&lt;br/&gt;                output.Write(FlashRenderingUtilities.GetFlashHtmlMarkup(this.itemFieldValueFlashUrl));&lt;br/&gt;            }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// Verifies that the FlashUrl is valid.&lt;br/&gt;        public override void Validate()&lt;br/&gt;        {&lt;br/&gt;            base.Validate();&lt;br/&gt;            if (this.IsValid)&lt;br/&gt;            {&lt;br/&gt;                LinkFieldValue currentFlashUrlValue =&lt;br/&gt;                  this.Value as LinkFieldValue;&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;                if (currentFlashUrlValue ==&lt;br/&gt;                  null || String.IsNullOrEmpty(currentFlashUrlValue.NavigateUrl))&lt;br/&gt;                {&lt;br/&gt;                    // Ensure the field is not required.&lt;br/&gt;                    if (this.Field != null &amp;amp;&amp;amp; this.Field.Required)&lt;br/&gt;                    {&lt;br/&gt;                        this.IsValid = false;&lt;br/&gt;                        this.ErrorMessage =&lt;br/&gt;                          "This field is required and must contain a flash file URL.";&lt;br/&gt;                        return;&lt;br/&gt;                    }&lt;br/&gt;                    else&lt;br/&gt;                    {&lt;br/&gt;                        // The field is empty and not required.&lt;br/&gt;                        // The data is valid.&lt;br/&gt;                        return;&lt;br/&gt;                    }&lt;br/&gt;                }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;                // Perform validation on the flash file URL.&lt;br/&gt;                HtmlValidationContext validationContext =&lt;br/&gt;                  new HtmlValidationContext();&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;                if (!this.AllowExternalUrls)&lt;br/&gt;                {&lt;br/&gt;                    // Restrict URLs to be either from the current site&lt;br/&gt;                    // collection or server-relative.&lt;br/&gt;                    validationContext.RestrictUrlsToSiteCollection = true;&lt;br/&gt;                    validationContext.GuidOfThisSiteCollection =&lt;br/&gt;                      SPContext.Current.Site.ID;&lt;br/&gt;                }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;                bool droppedTags;&lt;br/&gt;                bool droppedUrls;&lt;br/&gt;                LinkFieldValue validatedValue =&lt;br/&gt;                    validationContext.ValidateLinkValue(&lt;br/&gt;                        currentFlashUrlValue,&lt;br/&gt;                        out droppedTags,&lt;br/&gt;                        out droppedUrls);&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;                if (droppedUrls || String.IsNullOrEmpty(validatedValue.NavigateUrl))&lt;br/&gt;                {&lt;br/&gt;                    // The flash file URL in the link field value was&lt;br/&gt;                    // not valid so report the error message.&lt;br/&gt;                    // Setting IsValid to false stops saving the page.&lt;br/&gt;                    this.IsValid = false;&lt;br/&gt;                    this.ErrorMessage =&lt;br/&gt;                      "The URL for the flash file was invalid.";&lt;br/&gt;                    if (!this.AllowExternalUrls)&lt;br/&gt;                    {&lt;br/&gt;                        this.ErrorMessage +=&lt;br/&gt;                          "  You must select a URL within the current site collection.";&lt;br/&gt;                    }&lt;br/&gt;                }&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;    }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;    /// This edit control for the FlashFieldControl has &lt;br/&gt;    /// a toolbar and text box for selecting a flash file URL.&lt;br/&gt;    /// This example intentionally uses a separate toolbar button&lt;br/&gt;    /// and text box for the AssetUrlSelctor to show a more complex&lt;br/&gt;    /// example. You can use an AssetUrlSelector control instead of &lt;br/&gt;    /// a TextBox child control, which displays its own browse button.&lt;br/&gt;    public class FlashSelector : WebControl&lt;br/&gt;    {&lt;br/&gt;        private TextBox flashUrlTextBox = new TextBox();&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        public FlashSelector()&lt;br/&gt;        {&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// This is the flash URL value that you can edit in the text&lt;br/&gt;        /// box or Asset Picker dialog box.&lt;br/&gt;        public string FlashUrl&lt;br/&gt;        {&lt;br/&gt;            get { return this.flashUrlTextBox.Text; }&lt;br/&gt;            set { this.flashUrlTextBox.Text = value; }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        protected override void OnInit(EventArgs e)&lt;br/&gt;        {&lt;br/&gt;            base.OnInit(e);&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            // This ensures that the TextBox child control receives&lt;br/&gt;            // its postback.&lt;br/&gt;            EnsureChildControls();&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        /// Gets JavaScript required to launch an Asset Picker dialog&lt;br/&gt;        /// box for choosing a flash file URL.&lt;br/&gt;        private string GetAssetPickerButtonScript()&lt;br/&gt;        {&lt;br/&gt;            AssetUrlSelector flashAssetSelector =&lt;br/&gt;              new AssetUrlSelector();&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            // When the AssetUrlSelector control is not added to the&lt;br/&gt;            // page control tree, the Page and ID properties are&lt;br/&gt;            // required because&lt;br/&gt;            // AssetUrlSelector.GetClientLaunchPickerReference() &lt;br/&gt;            // needs register script in the page.&lt;br/&gt;            flashAssetSelector.Page = this.Page;&lt;br/&gt;            flashAssetSelector.ID = "FlashUrlAssetSelector";&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            // Uses the TextBox client ID to connect the Asset Picker&lt;br/&gt;            // dialog box to the text box.&lt;br/&gt;            flashAssetSelector.AssetUrlClientID =&lt;br/&gt;              this.flashUrlTextBox.ClientID;&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            // Autopostback to see the new flash file rendered after&lt;br/&gt;            // clicking OK on the Asset Picker dialog box.&lt;br/&gt;            flashAssetSelector.AutoPostBack = true;&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            flashAssetSelector.OverrideDialogTitle = "Select a flash file";&lt;br/&gt;            flashAssetSelector.OverrideDialogDescription =&lt;br/&gt;              "Select a flash file to embed in this page";&lt;br/&gt;            flashAssetSelector.UseImageAssetPicker = false;&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            return flashAssetSelector.GetClientLaunchPickerReference();&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        private Literal flashOutput = new Literal();&lt;br/&gt;        protected override void CreateChildControls()&lt;br/&gt;        {&lt;br/&gt;            SimpleToolbar flashSelectorToolbar = new SimpleToolbar();&lt;br/&gt;            flashSelectorToolbar.ID = "ToolBar";&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            this.Controls.Add(flashSelectorToolbar);&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            Label flashUrlLabel = new Label();&lt;br/&gt;            flashUrlLabel.Text = "Selected flash file URL: ";&lt;br/&gt;            flashUrlLabel.AssociatedControlID = "FlashUrlTextBox";&lt;br/&gt;            this.Controls.Add(flashUrlLabel);&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            this.flashUrlTextBox.ID = "FlashUrlTextBox";&lt;br/&gt;            this.flashUrlTextBox.CssClass =&lt;br/&gt;              "ms-input ms-lactiontable sample-flashselector-urltextbox";&lt;br/&gt;            this.Controls.Add(this.flashUrlTextBox);&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            // Add the button after the rest so that the text box&lt;br/&gt;            // ClientID is already determined and can be connected&lt;br/&gt;            // in the Asset Picker dialog box client script.&lt;br/&gt;            flashSelectorToolbar.AddToolbarButton(&lt;br/&gt;                "SelectFlashFile",&lt;br/&gt;                "Select a flash file",&lt;br/&gt;                this.GetAssetPickerButtonScript(),&lt;br/&gt;                "Open a picker to select a flash file URL");&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            // Add a refresh button to perform a basic postback to&lt;br/&gt;            // to update the FlashUrl rendering.&lt;br/&gt;            flashSelectorToolbar.AddToolbarButton(&lt;br/&gt;                "RefreshFlashFile",&lt;br/&gt;                "Refresh",&lt;br/&gt;                this.Page.ClientScript.GetPostBackEventReference(this,&lt;br/&gt;                  String.Empty),&lt;br/&gt;                  "Refresh the page to reload the current flash file URL",&lt;br/&gt;                  "/_layouts/IMAGES/refresh.gif");&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            // If there is a flash file URL, this code creates&lt;br/&gt;            // the flash player markup.&lt;br/&gt;            this.Controls.Add(this.flashOutput);&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        protected override void OnPreRender(EventArgs e)&lt;br/&gt;        {&lt;br/&gt;            string flashFileOutputHtml =&lt;br/&gt;              FlashRenderingUtilities.GetFlashHtmlMarkup(this.FlashUrl);&lt;br/&gt;            if (String.IsNullOrEmpty(flashFileOutputHtml))&lt;br/&gt;            {&lt;br/&gt;                this.flashOutput.Text =&lt;br/&gt;                  "&amp;lt;BR&amp;gt;{There is no valid flash file URL to display}&amp;lt;BR&amp;gt;";&lt;br/&gt;            }&lt;br/&gt;            else&lt;br/&gt;            {&lt;br/&gt;                this.flashOutput.Text =&lt;br/&gt;                  "&amp;lt;BR&amp;gt;" + flashFileOutputHtml + "&amp;lt;BR&amp;gt;";&lt;br/&gt;            }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            base.OnPreRender(e);&lt;br/&gt;        }&lt;br/&gt;    }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;    public static class FlashRenderingUtilities&lt;br/&gt;    {&lt;br/&gt;        /// Take a flash file URL and generate HTML markup&lt;br/&gt;        /// for playing the file.&lt;br/&gt;        /// &amp;lt;param name="flashUrl"&amp;gt;&amp;lt;/param&amp;gt;&lt;br/&gt;        public static string GetFlashHtmlMarkup(string flashUrl)&lt;br/&gt;        {&lt;br/&gt;            // HtmlUrlAttributeEncode returns an empty string if the &lt;br/&gt;            // URL protocol is not allowed (e.g., JavaScript:)&lt;br/&gt;            string encodedUrl =&lt;br/&gt;                SPHttpUtility.HtmlUrlAttributeEncode(flashUrl);&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;            if (String.IsNullOrEmpty(encodedUrl))&lt;br/&gt;            {&lt;br/&gt;                return String.Empty;&lt;br/&gt;            }&lt;br/&gt;            else&lt;br/&gt;            {&lt;br/&gt;                return String.Format(FlashHtmlMarkupFormat, encodedUrl);&lt;br/&gt;            }&lt;br/&gt;        }&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Tahoma; font-size:10pt'&gt;        // Currently, this code includes only a parameter for the flash&lt;br/&gt;        // file URL, but it could also include parameters for the&lt;br/&gt;        // width, height, and other rendering properties from field&lt;br/&gt;        // control properties or authored data value properties.&lt;br/&gt;        private const string FlashHtmlMarkupFormat = @"&lt;br/&gt;&amp;lt;object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000""&lt;br/&gt;    codebase=""&lt;a target='_blank' href='https://mail.microsoft.com/OWA/redir.aspx?C=d291654573d84c8ab8a07667bf3c1843&amp;amp;URL=http%3a%2f%2fdownload.macromedia.com%2fpub%2fshockwave%2fcabs%2fflash%2fswflash.cab%23version%3d6%2c0%2c40%2c0'&gt;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&lt;/a&gt;""&lt;br/&gt;    width=""300"" height=""450""&amp;gt; &lt;br/&gt;    &amp;lt;param name=""movie"" value=""{0}"" /&amp;gt;  &lt;br/&gt;    &amp;lt;param name=""quality"" value=""high"" /&amp;gt; &lt;br/&gt;    &amp;lt;param name=""bgcolor"" value=""#ffffff"" /&amp;gt; &lt;br/&gt;    &amp;lt;embed src=""{0}"" quality=""high"" &lt;br/&gt;        bgcolor=""#ffffff"" width=""468"" height=""60"" &lt;br/&gt;        name=""mymoviename"" align="" type=""application/x-shockwave-flash"" &lt;br/&gt;        pluginspage=""&lt;a target='_blank' href='https://mail.microsoft.com/OWA/redir.aspx?C=d291654573d84c8ab8a07667bf3c1843&amp;amp;URL=http%3a%2f%2fwww.macromedia.com%2fgo%2fgetflashplayer'&gt;http://www.macromedia.com/go/getflashplayer&lt;/a&gt;""&amp;gt; &lt;br/&gt;    &amp;lt;/embed&amp;gt; &lt;br/&gt;&amp;lt;/object&amp;gt;";&lt;br/&gt;    }&lt;br/&gt;}&lt;/span&gt;&lt;br /&gt;								&lt;/p&gt;&lt;p&gt; &lt;br /&gt; &lt;/p&gt;&lt;p&gt; &lt;br /&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-1016439021986545027?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/1016439021986545027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=1016439021986545027' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1016439021986545027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1016439021986545027'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/09/creating-media-and-flash-controls-in.html' title='Creating Media and Flash Controls in MOSS'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-2730853849904355850</id><published>2007-06-04T15:33:00.001-07:00</published><updated>2007-06-05T09:47:07.527-07:00</updated><title type='text'>MOSS 2007 Development 101 – Part 2</title><content type='html'>&lt;span xmlns=""&gt;&lt;span style="font-size:14;"&gt;&lt;strong&gt;Building a Rotating Banner for Images&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first thing you should do is have your environment configured and have the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=19f21e5e-b715-4f0c-b959-8c6dcbdc1057&amp;displaylang=en"&gt;web extensions for MOSS&lt;/a&gt;. Please see the article located here: &lt;a href="http://codeintegrators.blogspot.com/2007/05/moss-2007-development-101-part-1.html"&gt;blogspot article&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Open Visual Studio and create a new project of type "web part"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photobucket.com" target="_blank"&gt;&lt;img alt="Photo Sharing and Video Hosting at Photobucket" src="http://i195.photobucket.com/albums/z302/jakrupin/BlogPictures/060407_1.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I then am going to create a sharepoint picture library and upload some pictures into it. Now, because I am going to create a rotating banner, and I am concerned about real estate, I will make sure that all the pictures are the same size. In this case I took some button images.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photobucket.com" target="_blank"&gt;&lt;img alt="Photo Sharing and Video Hosting at Photobucket" src="http://i195.photobucket.com/albums/z302/jakrupin/BlogPictures/060407_2.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The goal at the end will be to have a random image from this selection appear on a web part on a web page within my portal.&lt;br /&gt;&lt;br /&gt;What we are going to do next is create the *.webpart file. This file will expose and set certain properties that will be used for the webpart. Please keep in mind that many of these properties are required.&lt;br /&gt;&lt;br /&gt;We are going to add a file of XML type to the project and call it RotatingImage.webpart.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photobucket.com" target="_blank"&gt;&lt;img alt="Photo Sharing and Video Hosting at Photobucket" src="http://i195.photobucket.com/albums/z302/jakrupin/BlogPictures/060407_3.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It will look something like this: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;table style="BACKGROUND: #d9d9d9; BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 638px"&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#984806;"&gt;xml&lt;/span&gt; &lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;1.0&lt;/span&gt;" &lt;span style="color:red;"&gt;encoding&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;utf-8&lt;/span&gt;" &lt;span style="color:#002060;"&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;webParts&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;webPart&lt;/span&gt; &lt;span style="color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;&lt;a href="http://schemas.microsoft.com/WebPart/v3"&gt;http://schemas.microsoft.com/WebPart/v3&lt;/span&gt;"&lt;span style="color:#002060;"&gt;&gt;&lt;/a&gt;;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;metaData&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;type&lt;/span&gt; &lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;CI.CustomWebParts.Randomize.RotatingImage,CI.CustomWebParts.Randomize, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3d0e3c375c2b1907&lt;/span&gt;" &lt;span style="color:#002060;"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;importErrorMessage&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;Cannot import this Web Part.&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;importErrorMessage&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;metaData&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;data&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;properties&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;property&lt;/span&gt; &lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;Title&lt;/span&gt;" &lt;span style="color:red;"&gt;type&lt;/span&gt;="&lt;span style="color:#002060;"&gt;string&lt;/span&gt;"&amp;gt;RotatingImage&amp;lt;/&lt;span style="color:#984806;"&gt;property&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:78%;"&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;property&lt;/span&gt; &lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;Description&lt;/span&gt;" &lt;span style="color:red;"&gt;type&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;string&lt;/span&gt;"&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;Rotates Pictures from a Picture Library.&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;property&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;property&lt;/span&gt; &lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;AllowClose&lt;/span&gt;" &lt;span style="color:red;"&gt;type&lt;/span&gt;="&lt;span style="color:#002060;"&gt;bool&lt;/span&gt;"&amp;gt;FALSE&amp;lt;/&lt;span style="color:#984806;"&gt;property&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;property&lt;/span&gt; &lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;PictureLibraryURL&lt;/span&gt;" &lt;span style="color:red;"&gt;type&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;string&lt;/span&gt;"&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;http://moss-test/RotatingBanner&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;property&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;properties&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;data&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;webPart&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;webParts&lt;/span&gt;&lt;span style="color:#002060;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Obviously you would replace your public key token with the one generated from the sn command. For details on this please see my post on &lt;a href="http://codeintegrators.blogspot.com/2007/05/moss-code-access-security-and-web-parts_31.html"&gt;Code Access Security&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Next you will need to add the following to the assembly.cs file:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;table style="BACKGROUND: #d9d9d9; BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 638px"&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;[assembly: &lt;span style="color:#00b0f0;"&gt;AllowPartiallyTrustedCallers&lt;/span&gt;()]&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Before adding your web part make sure to add it to the safe controls section of the website you are going to add it to if it is not already there. If you do a deploy from visual studio and you have chosen the Sharepoint WebPart project, this should automatically be done. It would look something like this:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;table style="BACKGROUND: #d9d9d9; BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 638px"&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;SafeControl&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;Assembly&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;CI.CustomWebParts.Randomize, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3d0e3c375c2b1907&lt;/span&gt;" &lt;span style="color:red;"&gt;Namespace&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;CI.CustomWebParts.Randomize&lt;/span&gt;" &lt;span style="color:red;"&gt;TypeName&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;RotatingImage&lt;/span&gt;" &lt;span style="color:red;"&gt;Safe&lt;/span&gt;&lt;span style="color:#002060;"&gt;=&lt;/span&gt;"&lt;span style="color:#002060;"&gt;True&lt;/span&gt;" &lt;span style="color:#002060;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Finally, the code. I recommend to deploy as is and add to a page first because at this point you have generated the "plumbing" of the part if you will. This will at least ensure that all is deployed correctly and you only have to worry about your custom code if it doesn't quite go as planned ;)&lt;br /&gt;&lt;br /&gt;As I alluded to earlier in the post we are just going to pull the pictures out of a picture library and add a random one to the page. The way I did this in this example was instead of overriding the Render method that came out of the box, I deleted it and added the following code in the *.cs file:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;table style="BACKGROUND: #d9d9d9; BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 638px"&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="BORDER-RIGHT: black 0.5pt solid; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; PADDING-LEFT: 7px; BORDER-LEFT: black 0.5pt solid; BORDER-BOTTOM: black 0.5pt solid"&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; System.Runtime.InteropServices;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; System.Web;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; System.Web.UI;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; System.Web.UI.WebControls.WebParts;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; System.Xml.Serialization;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; Microsoft.SharePoint;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; Microsoft.SharePoint.WebControls;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; Microsoft.SharePoint.WebPartPages;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;using&lt;/span&gt; System.Web.UI.WebControls;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;namespace&lt;/span&gt; CI.CustomWebParts.Randomize&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;[&lt;span style="color:#00b0f0;"&gt;Guid&lt;/span&gt;&lt;span style="color:#984806;"&gt;("0b1a09b8-98d1-4349-acce-fe4b715751a9"&lt;/span&gt;)]&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;public class&lt;/span&gt; RotatingImage : System.Web.UI.WebControls.WebParts.&lt;span style="color:#00b0f0;"&gt;WebPart&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b050;"&gt;// Fields&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;public string&lt;/span&gt; strPath = &lt;span style="color:#984806;"&gt;""&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;public string&lt;/span&gt; strUrlPath;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b050;"&gt;// Constructor&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;public&lt;/span&gt; RotatingImage()&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;this&lt;/span&gt;.ExportMode = &lt;span style="color:#00b0f0;"&gt;WebPartExportMode&lt;/span&gt;.All;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b050;"&gt;//protected override void Render(HtmlTextWriter writer)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;color:#00b050;"&gt;//{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;color:#00b050;"&gt;// // TODO: add custom rendering code here.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;color:#00b050;"&gt;// // writer.Write("Output HTML");&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;color:#00b050;"&gt;// writer.Write(DateTime.Now.ToLongTimeString());&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b050;"&gt;//}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;protected override void&lt;/span&gt; CreateChildControls()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#002060;"&gt;base&lt;/span&gt;.CreateChildControls();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b050;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b050;"&gt;// Declarations&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b0f0;"&gt;Image&lt;/span&gt; img = &lt;span style="color:#002060;"&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#00b050;"&gt;// Determine the location of the class resources using&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;color:#00b050;"&gt;// the SPWebPartManager on the Web page&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b0f0;"&gt;SPSite&lt;/span&gt; site = new &lt;span style="color:#00b0f0;"&gt;SPSite&lt;/span&gt;(&lt;span style="color:#984806;"&gt;"http://moss-test"&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b0f0;"&gt;SPWeb&lt;/span&gt; web = site.OpenWeb();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#00b050;"&gt;//Gets Picture Items from Library&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b0f0;"&gt;SPList&lt;/span&gt; list = web.Lists[&lt;span style="color:#984806;"&gt;"RotatingBanner"&lt;/span&gt;]; &lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b0f0;"&gt;SPListItem&lt;/span&gt; item;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#00b0f0;"&gt;SPListItemCollection&lt;/span&gt; items = list.Items;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#002060;"&gt;int&lt;/span&gt; iCount = 0;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#00b0f0;"&gt;Random&lt;/span&gt; r = &lt;span style="color:#002060;"&gt;new&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00b0f0;"&gt;Random&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;iCount = r.Next(0, list.ItemCount - 1);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;item = items[iCount];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#002060;"&gt;string&lt;/span&gt; imageUrl = &lt;span style="color:#984806;"&gt;"http://Moss-Test/RotatingBanner/"&lt;/span&gt; + item.Name;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#00b050;"&gt;// Instantiate, Initialize, and Insert the image&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;img = &lt;span style="color:#002060;"&gt;new&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00b0f0;"&gt;Image&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;img.ImageUrl = imageUrl;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#002060;"&gt;this&lt;/span&gt;.Controls.Add(img);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#00b050;"&gt;//Close&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;site.Close();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;site.Dispose();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;web.Close();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;web.Dispose();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Essentially what we have done here is override the child controls method and added our own image to the controls collection. You could essentially add any control you wished to this collection and it would render.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Go ahead and add your new web part to a page if you have not already done so and poof! You now have a randomized picture from your picture library. I know it probably didn't work the first time but if it did great!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-2730853849904355850?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/2730853849904355850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=2730853849904355850' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/2730853849904355850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/2730853849904355850'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/06/moss-2007-development-101-part-2_04.html' title='MOSS 2007 Development 101 – Part 2'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://i195.photobucket.com/albums/z302/jakrupin/BlogPictures/th_060407_1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-5410627931077702074</id><published>2007-05-31T14:57:00.001-07:00</published><updated>2007-06-05T09:15:50.148-07:00</updated><title type='text'>MOSS Code Access Security and Web Parts</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;Congratulations! You've built a web part and successfully deployed to your &lt;a href="http://en.wikipedia.org/wiki/Microsoft_Office_SharePoint_Server_2007"&gt;MOSS&lt;/a&gt; server. &lt;span style="color:red;"&gt;&lt;strong&gt;Access Denied!&lt;/strong&gt;&lt;/span&gt; What?! (*&amp;*^%&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Well, that's what I said when I deployed my MOSS &lt;a href="http://en.wikipedia.org/wiki/Web_part"&gt;Web Part&lt;/a&gt;. Join the club. It turns out that we were blocked by the &lt;a href="http://en.wikipedia.org/wiki/Code_access_security"&gt;Code Access Security&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As with any security token changes, you will need to get the Public Key Token as well as your Public Key Blob from your dll assembly. You can do this by running &lt;strong&gt;sn.exe –Tp [pathToAssembly]\[assemblyFileName]"&lt;/strong&gt;. There are some nifty things you can do by adding this as a button in your VS IDE as well, but that would be a topic for a later post. &lt;/p&gt;&lt;p&gt;You can find sn.exe in "[&lt;span style="color:#ff0000;"&gt;Drive]:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe&lt;/span&gt;" &lt;/p&gt;&lt;p&gt;&lt;span style="color:#663366;"&gt;&lt;em&gt;&lt;strong&gt;***Please note you would replace the purple sections with your own key tokens&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:12;"&gt;&lt;strong&gt;Approaches&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;There are quite a few approaches to this problem but as with most things technical, there are best practice approaches.&lt;br /&gt;&lt;/p&gt;&lt;h5&gt;First – GAC It&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;Of course the first thing a developer would do would be to throw the DLL into the &lt;a href="http://en.wikipedia.org/wiki/Global_Assembly_Cache"&gt;GAC&lt;/a&gt;. This does give full trust and will solve the problem; however, full trust is not always the best thing and is not best practice.&lt;br /&gt;&lt;/p&gt;&lt;h5&gt;Second - _App_Bin&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;The second thing you may try to do is throw the DLL into the &lt;strong&gt;_app_bin&lt;/strong&gt; folder. Poof! That worked but some other stuff doesn't work quite right? That is correct ladies and gentlemen because this location is meant for dll's supporting the &lt;a href="http://en.wikipedia.org/wiki/Microsoft_Office_SharePoint_Server_2007"&gt;MOSS&lt;/a&gt; _layout applications and is not meant for you.&lt;br /&gt;&lt;/p&gt;&lt;h5&gt;Third – Medium/Full Trust&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;While you may read on some posts, just to switch your trust level in &lt;a href="http://en.wikipedia.org/wiki/Web.config"&gt;web.config&lt;/a&gt; to medium or full trust, this will not give you the control you may want and may in fact give too much access.&lt;br /&gt;&lt;/p&gt;&lt;h5&gt;Fourth – Custom Policy File&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;What now? Custom Policies are the answer. If you opened the &lt;a href="http://en.wikipedia.org/wiki/Web.config"&gt;web.config&lt;/a&gt; file for the application you are looking to deploy to, you will see a trust level. By default, the trust level for &lt;a href="http://en.wikipedia.org/wiki/Microsoft_Office_SharePoint_Server_2007"&gt;MOSS&lt;/a&gt; Apps is &lt;strong&gt;WSS_Minimal&lt;/strong&gt; and for a decent reason. What does this mean? Well, the trust levels are configured in another section of the document and pointed to files in the config section of your &lt;a href="http://en.wikipedia.org/wiki/Microsoft_Office_SharePoint_Server_2007"&gt;MOSS&lt;/a&gt; installation.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:12;"&gt;&lt;strong&gt;File Sections&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;h5&gt;First Section&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;These are your permission classes pointing to public key tokens. Basically a listing of all possible permissions&lt;br /&gt;&lt;/p&gt;&lt;h5&gt;Second Section&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;These are permission groups that will group above sets of permissions and sets the level of permission&lt;br /&gt;&lt;/p&gt;&lt;h5&gt;Third Section&lt;br /&gt;&lt;/h5&gt;&lt;p&gt;These code groups for associating what assemblies go to what permission sets&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This file is essentially a hierarchal flow of permissions to dll's.&lt;br /&gt;&lt;/p&gt;&lt;table style="BORDER-COLLAPSE: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="WIDTH: 634px"&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr style="BACKGROUND: #cccccc"&gt;&lt;td style="BORDER-RIGHT: #dddddd 0.75pt solid; PADDING-RIGHT: 5px; BORDER-TOP: #dddddd 0.75pt solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #dddddd 0.75pt solid; PADDING-TOP: 5px; BORDER-BOTTOM: #dddddd 0.75pt solid" valign="bottom"&gt;&lt;p style="TEXT-ALIGN: center"&gt;&lt;span style="font-family:Trebuchet MS;font-size:8;color:#333333;"&gt;&lt;strong&gt;Important: &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="BACKGROUND: white"&gt;&lt;td style="BORDER-RIGHT: #dddddd 0.75pt solid; PADDING-RIGHT: 5px; BORDER-TOP: medium none; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #dddddd 0.75pt solid; PADDING-TOP: 5px; BORDER-BOTTOM: #dddddd 0.75pt solid" valign="center"&gt;&lt;p style="TEXT-ALIGN: center"&gt;&lt;span style="font-family:Trebuchet MS;font-size:8;color:#333333;"&gt;It is important to note that it is not only best practice but most certainly recommended that you sign your assembly and give it a strong name.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;What we are going to do:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Copy the &lt;strong&gt;WSS_Minimaltrust.config&lt;/strong&gt; to &lt;strong&gt;WSS_Custom_Minimaltrust.config&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;(drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config)&lt;/em&gt;. &lt;/li&gt;&lt;li&gt;You are then going to Add a new key to the Trust levels that will look like:&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;&lt;trustlevel name="WSS_Custom_Minimal" policyfile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_custom_minimaltrust.config"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Let's also make sure to rename the trust level in the web.config of your application to your newly created file.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;          Currently it probably looks like: &lt;span style="font-family:courier new;"&gt;&lt;trust level="WSS_Minimal" originurl=""&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;We are then going to add the Sharepoint Permission to be able to read the Sharepoint &lt;a href="http://en.wikipedia.org/wiki/Object_Model"&gt;Object Model&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;ul&gt;&lt;li&gt;Do this by copying the medium trust Sharepoint Permission into the second section of the minimum trust file&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;SecurityClass&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;SharePointPermission&lt;/span&gt;" &lt;span style="color:red;"&gt;Description&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=&lt;/span&gt;&lt;strong&gt;&lt;span style="color:#663366;"&gt;71e9bce111e9429c&lt;/span&gt;&lt;/strong&gt;"&lt;span style="color:#17365d;"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Create a new Permission Set called SPObjectModelRead:&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;PermissionSet&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;class&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;NamedPermissionSet&lt;/span&gt;" &lt;span style="color:red;"&gt;version&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;1&lt;/span&gt;" &lt;span style="color:red;"&gt;Name&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;SPObjectModelRead&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;IPermission&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;class&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;SharePointPermission&lt;/span&gt;" &lt;span style="color:red;"&gt;version&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;1&lt;/span&gt;" &lt;span style="color:red;"&gt;ObjectModel&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;True&lt;/span&gt;" &lt;span style="color:#17365d;"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;IPermission&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;class&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;AspNetHostingPermission&lt;/span&gt;" &lt;span style="color:red;"&gt;version&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;1&lt;/span&gt;" &lt;span style="color:red;"&gt;Level&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;Minimal&lt;/span&gt;" &lt;span style="color:#17365d;"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;IPermission&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;class&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;SecurityPermission&lt;/span&gt;" &lt;span style="color:red;"&gt;version&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;1&lt;/span&gt;" &lt;span style="color:red;"&gt;Flags&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;Execution&lt;/span&gt;" &lt;span style="color:#17365d;"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;IPermission&lt;/span&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;class&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;WebPartPermission&lt;/span&gt;" &lt;span style="color:red;"&gt;version&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;1&lt;/span&gt;" &lt;span style="color:red;"&gt;Connections&lt;/span&gt;="&lt;span style="color:#17365d;"&gt;True&lt;/span&gt;" &lt;span style="color:#17365d;"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;PermissionSet&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#17365d;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Create a new Code Group to map your newly created Permission set to your Assembly:&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;CodeGroup&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:red;"&gt;class&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;UnionCodeGroup&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;1&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;PermissionSetName&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;SPObjectModelRead&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;Rotating Image Web Part&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;Description&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;This&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#17365d;"&gt;code group grants the Rotating Image Web Part SPObjectModelRead permissions.&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#984806;"&gt;IMembershipCondition&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:red;"&gt;class&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;StrongNameMembershipCondition&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:red;"&gt;version&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;span style="color:#17365d;"&gt;1&lt;/span&gt;"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 72pt"&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;span style="color:red;"&gt;PublicKeyBlob&lt;/span&gt;&lt;span style="color:#17365d;"&gt;=&lt;/span&gt;"&lt;strong&gt;&lt;span style="color:#663366;"&gt;0024000004800000940000000602000000240000525341310004000001000100af8c04c7f1100d8af5aa7792388fee59f8e07dba7ff313d5fc9cf694aa8dcc394e0db13f96d699c8f6c5a6fe155a0123d817a1363f4cc2fa1ea90ea4c7971bee26717b116d68346efdea6011baa994aced602761da653781b5eece7045b916d4e82431ef4467599c5425194bb564664d83a08d269ec6c38031460e0b0047f4d3&lt;/span&gt;&lt;/strong&gt;" &lt;span style="color:#17365d;"&gt;/&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;span style="color:#17365d;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#984806;"&gt;CodeGroup&lt;/span&gt;&lt;span style="color:#17365d;"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Courier New;font-size:10;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-5410627931077702074?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/5410627931077702074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=5410627931077702074' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/5410627931077702074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/5410627931077702074'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/05/moss-code-access-security-and-web-parts_31.html' title='MOSS Code Access Security and Web Parts'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-7166194533201046070</id><published>2007-05-15T11:03:00.001-07:00</published><updated>2007-05-15T14:01:01.767-07:00</updated><title type='text'>MOSS 2007 Development 101 – Part 1</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;So I have done quite a bit of Googling and would you believe it… There are very few articles on starting MOSS 2007 development.  Well perhaps this is due to the fact that many MOSS developers are coming from SharePoint 2003 (SPS 2003).  Not I, some of us actually come from the MSFT Content Management Server Background (MCMS), so this article is just an overview for those of us that say we've had enough, let's get MOSS.  This article will also provide download links to get some tools that I am using.  I am writing this as a series so this will be focused on tools of the trade.  In a future post I will begin to write about the actual implementation.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Ok, let's get started…..&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;First we obviously must have a MOSS server to connect to, this is not the focus of this article but noted as a requirement.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&gt;&lt;div style='margin-left: 30pt'&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:634px'&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr style='background: #cccccc'&gt;&lt;td style='padding-top: 5px; padding-left: 5px; padding-bottom: 5px; padding-right: 5px; border-top:  solid #dddddd 0.75pt; border-left:  solid #dddddd 0.75pt; border-bottom:  solid #dddddd 0.75pt; border-right:  solid #dddddd 0.75pt' vAlign='bottom'&gt;&lt;p&gt;&lt;span style='font-size:8pt'&gt;&lt;strong&gt;Important: &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style='background: white'&gt;&lt;td style='padding-top: 5px; padding-left: 5px; padding-bottom: 5px; padding-right: 5px; border-top:  none; border-left:  solid #dddddd 0.75pt; border-bottom:  solid #dddddd 0.75pt; border-right:  solid #dddddd 0.75pt'&gt;&lt;p&gt;&lt;span style='font-size:8pt'&gt;It is important to note that when coding against much of the MOSS 2007 Object Model, that your environment be Windows Server 2003 SP1 or higher!  Also at least WSS 3.0 must be installed.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;Tools&lt;br /&gt;&lt;/h2&gt;&lt;ol&gt;&lt;li&gt;I would recommend &lt;strong&gt;Microsoft Office SharePoint Designer&lt;/strong&gt;.  &lt;em&gt;This tool will allow the user to customize master pages, themes, layouts, create new workflows and SharePoint objects and much more.  If some of you are old like me, you will remember the good old days of FrontPage.  Yup, this is it, but I would say mucho better.  Unfortunately, this is not a free download and must be purchased&lt;br /&gt;&lt;/em&gt;&lt;/li&gt;&lt;li&gt;Well, you will use this quite often in your development although it is really an admin tool.  &lt;strong&gt;stsAdm.exe&lt;/strong&gt;&lt;br /&gt;     &lt;em&gt;will be a lifesaver for you and will allow you to do things such as create new sites, export, import fix mistakes, and other admin tasks.  This tool is located on the MOSS server itself in most likely "&lt;strong&gt;c:\program files\common files\microsoft shared\web server extensions\12\bin&lt;/strong&gt;".&lt;br /&gt;&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;.NET 3.0&lt;/strong&gt; is    It can be downloaded here:  &lt;a href='http://www.microsoft.com/downloads/details.aspx?familyid=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en'&gt;&lt;strong&gt;http://www.microsoft.com/downloads/details.aspx?familyid=10CC340B-F857-4A14-83F5-25634C3BF043&amp;amp;displaylang=en&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;&lt;strong&gt;.NET 3.0 Extensions&lt;/strong&gt; will allow you to create Windows Presentation Foundation (WPF) &lt;a href='http://en.wikipedia.org/wiki/Windows_Presentation_Foundation'&gt;http://en.wikipedia.org/wiki/Windows_Presentation_Foundation&lt;/a&gt; and Windows Communication Foundation (WCF) &lt;a href='http://en.wikipedia.org/wiki/Windows_Communication_Foundation'&gt;http://en.wikipedia.org/wiki/Windows_Communication_Foundation&lt;/a&gt; projects.  It can be downloaded here: &lt;a href='http://www.microsoft.com/downloads/details.aspx?familyid=F54F5537-CC86-4BF5-AE44-F5A1E805680D&amp;amp;displaylang=en'&gt;&lt;strong&gt;http://www.microsoft.com/downloads/details.aspx?familyid=F54F5537-CC86-4BF5-AE44-F5A1E805680D&amp;amp;displaylang=en&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;br /&gt;     &lt;/strong&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;&lt;strong&gt;MOSS SDK&lt;/strong&gt;:  This tool will give you the full technical lowdown on MOSS development although it can be tricky to navigate through the hundreds of pages.  The MOSS SDK can be downloaded here:  &lt;a href='http://www.microsoft.com/downloads/thankyou.aspx?familyId=6d94e307-67d9-41ac-b2d6-0074d6286fa9&amp;amp;displayLang=en'&gt;&lt;strong&gt;http://www.microsoft.com/downloads/thankyou.aspx?familyId=6d94e307-67d9-41ac-b2d6-0074d6286fa9&amp;amp;displayLang=en&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;br /&gt;     &lt;/strong&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;strong&gt;Log Viewer&lt;/strong&gt; is a &lt;em&gt;great external tool to view the SharePoint logs.  &lt;/em&gt;These will be extremely helpful to you in diagnosing issues.  It can be downloaded here:  &lt;a href='http://www.codeplex.com/features/Release/ProjectReleases.aspx?ReleaseId=2502'&gt;&lt;strong&gt;http://www.codeplex.com/features/Release/ProjectReleases.aspx?ReleaseId=2502&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;     &lt;/div&gt;&lt;p&gt;&lt;em&gt;In this location you can also download other features such as debugging&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Visual Studio 2005&lt;/strong&gt; – Who could forget MSFT's core IDE for development… apparently me because it's way down here.  &lt;em&gt;Most of the tools above will have hooks into the VS 2005 IDE.  As with Designer, the VS 2005 must be purchased.&lt;/em&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;&lt;strong&gt;WSS 3.0 SDK&lt;/strong&gt; – &lt;em&gt;This will give you the underlying SharePoint Services Framework and can be downloaded here:&lt;/em&gt;&lt;br /&gt;     &lt;a href='http://www.microsoft.com/downloads/details.aspx?familyid=05E0DD12-8394-402B-8936-A07FE8AFAFFD&amp;amp;displaylang=en'&gt;&lt;strong&gt;http://www.microsoft.com/downloads/details.aspx?familyid=05E0DD12-8394-402B-8936-A07FE8AFAFFD&amp;amp;displaylang=en&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Web Part Templates&lt;/strong&gt; – &lt;em&gt;MOSS is extendible through Web Parts and this tool will integrate into the VS 2005 IDE and help to build these parts.  Can be downloaded here:   &lt;a href='http://www.microsoft.com/downloads/details.aspx?familyid=CAC3E0D2-BEC1-494C-A74E-75936B88E3B5&amp;amp;displaylang=en'&gt;&lt;/a&gt;&lt;/em&gt;&lt;strong&gt;http://www.microsoft.com/downloads/details.aspx?familyid=CAC3E0D2-BEC1-494C-A74E-75936B88E3B5&amp;amp;displaylang=en &lt;/strong&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;&lt;strong&gt;MOSS Extensions&lt;/strong&gt; – Ok, the ever elusive development environment.  These can be downloaded here:  &lt;a href='http://www.microsoft.com/downloads/details.aspx?familyid=19f21e5e-b715-4f0c-b959-8c6dcbdc1057&amp;amp;displaylang=en'&gt;&lt;strong&gt;http://www.microsoft.com/downloads/details.aspx?familyid=19f21e5e-b715-4f0c-b959-8c6dcbdc1057&amp;amp;displaylang=en&lt;/strong&gt;&lt;/a&gt;  These will plug into the VS 2005 IDE&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;The next post will focus on utilizing some of these tools and getting started on the actual development.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Cheers&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-7166194533201046070?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/7166194533201046070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=7166194533201046070' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/7166194533201046070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/7166194533201046070'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/05/moss-2007-development-101-part-1.html' title='MOSS 2007 Development 101 – Part 1'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-6096738810868231787</id><published>2007-05-09T13:38:00.001-07:00</published><updated>2007-05-09T13:43:34.251-07:00</updated><title type='text'>MOSS Authentication Links</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;The following are great articles related to authentication in MOSS:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;LDAP:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://www.sharepointblogs.com/helloitsliam/archive/2006/08/15/10027.aspx'&gt;http://www.sharepointblogs.com/helloitsliam/archive/2006/08/15/10027.aspx&lt;/a&gt;&lt;br /&gt;   &lt;/p&gt;&lt;p&gt;Custom:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;PART 1: &lt;a href='http://www.sharepointblogs.com/helloitsliam/archive/2006/12/11/16842.aspx'&gt;http://www.sharepointblogs.com/helloitsliam/archive/2006/12/11/16842.aspx&lt;/a&gt;&lt;br /&gt;    &lt;br&gt;&lt;/br&gt;PART 2: &lt;a target='_new' href='http://www.sharepointblogs.com/helloitsliam/archive/2006/12/12/16887.aspx'&gt;http://www.sharepointblogs.com/helloitsliam/archive/2006/12/12/16887.aspx&lt;/a&gt;&lt;br /&gt;    &lt;br&gt;&lt;/br&gt;PART 3: &lt;a target='_new' href='http://www.sharepointblogs.com/helloitsliam/archive/2006/12/14/16973.aspx'&gt;http://www.sharepointblogs.com/helloitsliam/archive/2006/12/14/16973.aspx&lt;/a&gt;&lt;br /&gt;    &lt;br&gt;&lt;/br&gt;PART 4: &lt;a target='_new' href='http://www.sharepointblogs.com/helloitsliam/archive/2006/12/15/17010.aspx'&gt;http://www.sharepointblogs.com/helloitsliam/archive/2006/12/15/17010.aspx&lt;/a&gt;&lt;br /&gt;   &lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-6096738810868231787?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/6096738810868231787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=6096738810868231787' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/6096738810868231787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/6096738810868231787'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/05/moss-authentication-links.html' title='MOSS Authentication Links'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-7728513227739851451</id><published>2007-05-09T13:12:00.001-07:00</published><updated>2007-05-09T13:12:01.608-07:00</updated><title type='text'>Master Page/Page Layout Article</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;If you don't know about Heather, let me tell you that she has been an invaluable resource to me in MOSS Customization.  The following article is a great read; however, she is probably best noted for taking the time and stress of decoding the entire CSS class structure for MOSS.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://heathersolomon.com/blog/articles/5929.aspx'&gt;http://heathersolomon.com/blog/articles/5929.aspx&lt;/a&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;If you are just starting in MOSS customization, take a look at her site.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-7728513227739851451?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/7728513227739851451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=7728513227739851451' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/7728513227739851451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/7728513227739851451'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/05/master-pagepage-layout-article.html' title='Master Page/Page Layout Article'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-8201956874529761739</id><published>2007-05-08T20:10:00.001-07:00</published><updated>2007-05-15T13:58:36.721-07:00</updated><title type='text'>Creating New Site Definition Using CAML</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;This post is going to center around creating a new site definition.   This is the first in a series of posts centered around Site Definition CAML Modification&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Let's begin:&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt; We are first going to Copy the existing Definition following the instructions outlined in:  &lt;a href='http://msdn2.microsoft.com/en-us/library/ms454677.aspx'&gt;http://msdn2.microsoft.com/en-us/library/ms454677.aspx&lt;/a&gt;&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;Copy the existing site definition folder located in the &lt;em&gt;Local_Drive&lt;/em&gt;:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\sts directory.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;For example, to create a custom site definition that derives from the site definition for Microsoft Windows SharePoint Services, copy the &lt;strong&gt;sts&lt;/strong&gt; folder. You can give the folder any name that contains no spaces.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;Make a copy of the &lt;a href='http://msdn2.microsoft.com/en-us/library/ms447717.aspx'&gt;WebTemp.xml&lt;/a&gt; file that is located in &lt;em&gt;Local_Drive&lt;/em&gt;:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;Give the file a unique name by appending a string to the name of the original file; for example, WebTempAction.xml. At run time, the compiler merges information contained in this file with the information contained in the original file to specify which site templates are available for creating new sites.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;Customize the contents of the new WebTemp file.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;Each &lt;a href='http://msdn2.microsoft.com/en-us/library/ms447717.aspx'&gt;WebTemp.xml&lt;/a&gt; file contains a collection of &lt;a href='http://msdn2.microsoft.com/en-us/library/ms428612.aspx'&gt;Template&lt;/a&gt; elements and &lt;a href='http://msdn2.microsoft.com/en-us/library/ms476942.aspx'&gt;Configuration&lt;/a&gt; subelements, which identify to the compiler all the site definitions that can be instantiated. The &lt;strong&gt;Configuration&lt;/strong&gt; element defines, for example, a title, a description, the URL for the image displayed in the user interface (UI), and a display category that specifies the tab on which to display the template in the Template Selection section of the &lt;strong&gt;New SharePoint Site&lt;/strong&gt; page. These properties are common to each Web site created through the site definition.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style='margin-left: 30pt'&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:634px'&gt;&lt;/col&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr style='background: #cccccc'&gt;&lt;td style='padding-top: 5px; padding-left: 5px; padding-bottom: 5px; padding-right: 5px; border-top:  solid #dddddd 0.75pt; border-left:  solid #dddddd 0.75pt; border-bottom:  solid #dddddd 0.75pt; border-right:  solid #dddddd 0.75pt' vAlign='bottom'&gt;&lt;p&gt;&lt;span style='font-size:8pt'&gt;&lt;strong&gt;Important: &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style='background: white'&gt;&lt;td style='padding-top: 5px; padding-left: 5px; padding-bottom: 5px; padding-right: 5px; border-top:  none; border-left:  solid #dddddd 0.75pt; border-bottom:  solid #dddddd 0.75pt; border-right:  solid #dddddd 0.75pt'&gt;&lt;p&gt;&lt;span style='font-size:8pt'&gt;In each &lt;strong&gt;Template&lt;/strong&gt; element defined in the WebTemp file, the &lt;strong&gt;Name&lt;/strong&gt; attribute must contain the same name that is assigned to the new folder. Also, to avoid conflict with IDs already used in Windows SharePoint Services, use unique values greater than 10,000 for the ID attribute.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;h1&gt;&lt;span style='font-size:9pt'&gt;Example&lt;span style='font-family:Verdana'&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;The following example defines a single site definition. The example assumes the existence of an ActionCommittee directory that has been created as previously described.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style='background: #dddddd'&gt;&lt;a href='javascript:CopyCode(&amp;apos;ctl00_LibFrame_ctl12other&amp;apos;);'&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;Copy Code&lt;/span&gt;&lt;/a&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;&lt;br /&gt;    &lt;/span&gt;&lt;/p&gt;&lt;p style='background: #dddddd'&gt;&lt;span style='font-family:Lucida Console; font-size:10pt'&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt; &amp;lt;Templates xmlns:ows="Microsoft SharePoint"&amp;gt; &amp;lt;Template Name=" ActionCommittee " ID="10001"&amp;gt; &amp;lt;Configuration ID="0" Title="Action Committee Team Site" Hidden="FALSE" ImageUrl="images/stsprev.jpg" Description="This template provides a forum for the team to create, organize, and share information quickly and easily. It includes a Document Library, and basic lists such as Announcements, Events, Contacts, and Quick Links." DisplayCategory="Collaboration"&amp;gt; &amp;lt;/Configuration&amp;gt; &amp;lt;/Template&amp;gt; &amp;lt;/Templates&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Verdana; font-size:8pt'&gt;You may need to reset Internet Information Services (IIS) to cause the new template to appear as an option in the UI.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The next post on this topic will focus on adding the publishing features to the site and creating custom web pages on site creation.  The one following that will center around user permissions on lists and how to modify within the CAML.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-8201956874529761739?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/8201956874529761739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=8201956874529761739' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/8201956874529761739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/8201956874529761739'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/05/creating-new-site-definition-using-caml.html' title='Creating New Site Definition Using CAML'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-1802262395266489123</id><published>2007-05-08T18:47:00.001-07:00</published><updated>2007-05-08T19:58:08.684-07:00</updated><title type='text'>Create Multi-Level Tree View Navigation in MOSS 2007</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;The purpose of this article is to outline the details necessary to modify the quick launch to use a multi-level ASP.NET 2.0 Tree View control. This will be extremely useful in publishing site applications.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Let's go ahead and begin modifying the master page necessary. What, you don't know about the master page, that's ok, I will post another blog entry outlining this but for now, open your sharepoint designer and browse to the top-level site in question. Remember it is my opinion that it is always good to create your own master page and css styles. The location of the master page is likely to be in _catalogs\masterpage&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://photobucket.com" target="_blank"&gt;&lt;img src="http://i195.photobucket.com/albums/z302/jakrupin/BlogPictures/BlogScreenShotMulti.gif" border="0" alt="Photo Sharing and Video Hosting at Photobucket"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;You can replace the &lt;strong&gt;AspMenu&lt;/strong&gt; control with a &lt;strong&gt;TreeView&lt;/strong&gt; control to display a familiar tree view with nodes that collapse and expand.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;&lt;strong&gt;To replace the Menu control with the TreeView control&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol style="MARGIN-LEFT: 45pt"&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;Open the master page you are using and find the &lt;strong&gt;ContentPlaceHolder&lt;/strong&gt; container control whose ID is &lt;strong&gt;PlaceHolderLeftNavBar&lt;/strong&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;In the &lt;strong&gt;AspMenu&lt;/strong&gt; control, find the &lt;strong&gt;PlaceHolderLeftNavBar&lt;/strong&gt; control whose ID is &lt;strong&gt;QuickLaunchMenu&lt;/strong&gt;, and replace &lt;strong&gt;SharePoint:AspMenu&lt;/strong&gt; with &lt;strong&gt;ASP:TreeView&lt;/strong&gt; in both the opening and closing tags.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;Remove the following &lt;strong&gt;LevelMenuItemStyles&lt;/strong&gt; element and its contents from the new &lt;strong&gt;TreeView&lt;/strong&gt; element.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style="BACKGROUND: #dddddd"&gt;&lt;a href="javascript:CopyCode(&amp;apos;ctl00_LibFrame_ctl15other&amp;apos;);"&gt;&lt;span style="TEXT-DECORATION: underline;font-family:Verdana;font-size:8;color:blue;"   &gt;Copy Code&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #dddddd"&gt;&lt;span style="font-family:Lucida Console;font-size:10;"&gt;&amp;lt;LevelMenuItemStyles&amp;gt; &amp;lt;asp:MenuItemStyle CssClass="ms-navheader"/&amp;gt; &amp;lt;asp:MenuItemStyle CssClass="ms-navitem"/&amp;gt; &amp;lt;/LevelMenuItemStyles&amp;gt; &amp;lt;LevelSubMenuStyles&amp;gt; &amp;lt;asp:SubMenuStyle CssClass="ms-navSubMenu1"/&amp;gt; &amp;lt;asp:SubMenuStyle CssClass="ms-navSubMenu2"/&amp;gt; &amp;lt;/LevelSubMenuStyles&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;Edit the web.config&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;Edit the web.config, look for a named provider definition: "CurrentNavSiteMapProviderNoEncode", add a single property attribute: RequireUniqueKeysForNodes="true"The &lt;strong&gt;TreeView&lt;/strong&gt; control provides properties that allow you to easily customize the control. For more information about Windows SharePoint Services master pages and site customization, see &lt;a href="http://msdn2.microsoft.com/en-us/library/ms443795.aspx"&gt;&lt;span style="TEXT-DECORATION: underline;color:blue;" &gt;Master Pages&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;Modify master page once more to change datasource&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;Modify the data source that the Menu/TreeView is hooked up to, it should be immediately beneath it. Change the SiteMapProvider="CurrentNavSiteMapProvider" to SiteMapProvider="CurrentNavSiteMapProviderNoEncode"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;Reset IIS for changes to take effect.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;The &lt;strong&gt;TreeView&lt;/strong&gt; control provides properties that allow you to easily customize the control. For more information about Windows SharePoint Services master pages and site customization, see &lt;a href="http://msdn2.microsoft.com/en-us/library/ms443795.aspx"&gt;&lt;span style="TEXT-DECORATION: underline;color:blue;" &gt;Master Pages&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:8;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-1802262395266489123?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/1802262395266489123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=1802262395266489123' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1802262395266489123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/1802262395266489123'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/05/create-multi-level-tree-view-navigation.html' title='Create Multi-Level Tree View Navigation in MOSS 2007'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://i195.photobucket.com/albums/z302/jakrupin/BlogPictures/th_BlogScreenShotMulti.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5908350786857321120.post-4202563793801608914</id><published>2007-05-08T18:33:00.000-07:00</published><updated>2007-05-08T18:36:54.941-07:00</updated><title type='text'>Welcome</title><content type='html'>Ok,  You would think that after 15 years of being in the industry I would already have a blog, but alas, I do not.  This is truely my first blog entry.  A little about myself:  My company Code Integrators is a consulting company which consults in Microsoft Technologies and Enterprise Architecture.  I am currently working as a Microsoft Consultant advising in WCM technologies including Microsoft Content Mangement Server and Microsoft Office Sharepoint Server.  My intention for this blog will be to center around MS technologies and solve random problems that should be easy but will of course have at least had me thinking.  My hope is that more junior programmers will learn and if nothing else, I have a blog!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5908350786857321120-4202563793801608914?l=codeintegrators.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeintegrators.blogspot.com/feeds/4202563793801608914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5908350786857321120&amp;postID=4202563793801608914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4202563793801608914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5908350786857321120/posts/default/4202563793801608914'/><link rel='alternate' type='text/html' href='http://codeintegrators.blogspot.com/2007/05/welcome.html' title='Welcome'/><author><name>Joseph Krupinski</name><uri>http://www.blogger.com/profile/07352699682003893190</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_ES8HbjSf0lU/Sp0rUm1mbeI/AAAAAAAAAAU/w2k94B0p5vE/S220/joekr_06080628102008.jpg'/></author><thr:total>0</thr:total></entry></feed>
