<?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-425245397857187894</id><updated>2011-11-27T19:26:48.819-06:00</updated><category term='Lookup'/><category term='SPGridView'/><category term='DataGrid'/><category term='Surveys'/><category term='Custom Action'/><category term='WebParts'/><category term='Receivers'/><category term='Custom Site Column'/><category term='Sharepoint'/><title type='text'>Rusty's SharePoint Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-4957763110199825533</id><published>2008-12-05T14:44:00.003-06:00</published><updated>2008-12-06T10:13:45.107-06:00</updated><title type='text'>Xsl Transformation Credentials</title><content type='html'>There is a frustrating deficiency in the &lt;strong&gt;XsltLoader&lt;/strong&gt; class with regards to permissions. This is the class called by the &lt;strong&gt;XslCompiledTransform&lt;/strong&gt; class that loads the xsl source file. The standard call would be as follows:&lt;br /&gt;&lt;br /&gt;StringWriter stringWriter = new StringWriter();&lt;br /&gt;HtmlTextWriter writer = new HtmlTextWriter(stringWriter);&lt;br /&gt;&lt;br /&gt;XmlUrlResolver resolver = new XmlUrlResolver();&lt;br /&gt;resolver.Credentials = CredentialCache.DefaultCredentials;&lt;br /&gt;&lt;br /&gt;XslCompiledTransform transformer = new XslCompiledTransform();&lt;br /&gt;transformer.Load(xslPath, XsltSettings.Default, resolver);&lt;br /&gt;transformer.Transform(sourceXmlDoc, null, writer);&lt;br /&gt;&lt;br /&gt;return stringWriter.ToString();&lt;br /&gt;&lt;br /&gt;This works fine if you are under standard NT security/permission setups for &lt;strong&gt;SharePoint/MOSS 2007&lt;/strong&gt;. However, if you do something like bring in Forms Based Authentication, you will get a strange xsl compile error.&lt;br /&gt;&lt;br /&gt;The problem is that although the XsltLoader.Load method accepts an &lt;strong&gt;XmlUrlResolver&lt;/strong&gt; object as a parameter, it does not actually use it when retrieving the xsl file. So, we cannot call the XslCompiledTransform.Load method by passing the xsl path as a string. Instead, we need to load the xsl into an &lt;strong&gt;XmlReader&lt;/strong&gt; object manually and pass the reader to the Load method instead. This allows us to pass the credentials to the XmlReader and it will do the work of retrieving the xsl file. The finally result would be as follows:&lt;br /&gt;&lt;br /&gt;StringWriter stringWriter = new StringWriter();&lt;br /&gt;HtmlTextWriter writer = new HtmlTextWriter(stringWriter);&lt;br /&gt;&lt;br /&gt;XmlUrlResolver resolver = new XmlUrlResolver();&lt;br /&gt;resolver.Credentials = CredentialCache.DefaultCredentials;&lt;br /&gt;&lt;br /&gt;XmlReaderSettings settings = new XmlReaderSettings();&lt;br /&gt;settings.XmlResolver = resolver;&lt;br /&gt;XmlReader reader = XmlReader.Create(xslPath, settings);&lt;br /&gt;&lt;br /&gt;XslCompiledTransform transformer = new XslCompiledTransform();&lt;br /&gt;transformer.Load(reader , XsltSettings.Default, resolver);&lt;br /&gt;transformer.Transform(sourceXmlDoc, null, writer);&lt;br /&gt;return stringWriter.ToString();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-4957763110199825533?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/4957763110199825533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=4957763110199825533' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/4957763110199825533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/4957763110199825533'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/12/xsl-transformation-credentials.html' title='Xsl Transformation Credentials'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-1731627212178620552</id><published>2008-10-08T09:06:00.006-05:00</published><updated>2008-10-21T20:27:52.202-05:00</updated><title type='text'>Filter Dropdown based on Audiences</title><content type='html'>I found this &lt;a href="http://www.sharepointusergroup.at/info/Dokumente/UserProfiles.pdf"&gt;presentation&lt;/a&gt; that gives a nice clean example of how to use the Sharepoint 2007 Audience functionality in code. So here is a quick model for creating a dropdown that is filtered based on the audience(s) set for each list item in an SPList.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;private void CreateAudienceFilteredSelect(SPListItemCollection listItems)&lt;br /&gt;{&lt;br /&gt;// define this object at the class level so that it can access on the postback&lt;br /&gt;newDropDown = new DropDownList();&lt;br /&gt;AudienceLoader audienceLoader = AudienceLoader.GetAudienceLoader();&lt;br /&gt;&lt;br /&gt;foreach (SPListItem listItem in listItems)&lt;br /&gt;{&lt;br /&gt;if (listItem ["Target Audiences"] != null)&lt;br /&gt;{&lt;br /&gt;string audienceValues = listItem ["Target Audiences"] .ToString();&lt;br /&gt;if (AudienceManager.IsCurrentUserInAudienceOf(audienceLoader, audienceValues, false))&lt;br /&gt;{&lt;br /&gt;newDropDown.Items.Add(new ListItem(listItem["Title"].ToString(), listItem ["ID"].ToString()));&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-1731627212178620552?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/1731627212178620552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=1731627212178620552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1731627212178620552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1731627212178620552'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/10/filter-dropdown-based-on-audiences.html' title='Filter Dropdown based on Audiences'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-2586136758718939088</id><published>2008-08-28T15:01:00.001-05:00</published><updated>2008-08-28T15:03:11.536-05:00</updated><title type='text'>To dispose or not to dispose</title><content type='html'>Helpful guide for determining when you should dispose your SPWeb and SPSite objects manually.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx"&gt;http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-2586136758718939088?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/2586136758718939088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=2586136758718939088' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2586136758718939088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2586136758718939088'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/08/to-dispose-or-not-to-dispose.html' title='To dispose or not to dispose'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-7928232525678757866</id><published>2008-08-26T10:12:00.002-05:00</published><updated>2008-08-26T10:15:24.856-05:00</updated><title type='text'>Where in the world is the Microsoft.SharePoint.ApplicationPages.dll located?</title><content type='html'>SharePoint 2007 location for the Microsoft.SharePoint.ApplicationPages.dll:&lt;br /&gt;&lt;br /&gt;C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\BIN&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-7928232525678757866?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/7928232525678757866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=7928232525678757866' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/7928232525678757866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/7928232525678757866'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/08/where-in-world-is-microsoftsharepointap.html' title='Where in the world is the Microsoft.SharePoint.ApplicationPages.dll located?'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-4594599452735849231</id><published>2008-08-21T08:59:00.001-05:00</published><updated>2008-08-27T21:08:28.899-05:00</updated><title type='text'>Custom Web Part Properties (ToolParts)</title><content type='html'>&lt;div&gt;SharePoint 2007 Web Parts have a nice built in property management. As long as your properties are straight forward strings, booleans, etc. However, if you need a more complicated property such as a list or a radio group, you will need to create a custom property. These are called Tool Parts.    &lt;br /&gt;    &lt;br /&gt;The ToolPart base class is laid out similarly to the WebPart base class. In essence, you will create your custom controls in the CreateChildControls method.     &lt;br /&gt;    &lt;br /&gt;This example will do a little more than just create the controls though. Here we will style the Tool Part so it looks just like the standard SharePoint properties as well. For the record, I totally stole the formatting stuff from &lt;a href="http://www.helloitsliam.com/archive/2007/11/26/moss2007-%E2%80%93-web-part-properties-part-2.aspx"&gt;Liam Cleary&lt;/a&gt;.     &lt;br /&gt;&lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div&gt;First off, create a new class that inherits from Microsoft.SharePoint.WebPartPages.ToolPart.    &lt;br /&gt;&lt;/div&gt;  &lt;blockquote&gt;   &lt;p&gt;public class SampleToolPart : ToolPart     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // First, override the CreateChildControls method. This is where we create the controls.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; protected override void CreateChildControls()      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create a panel that will hold all of our controls       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Panel toolPartPanel = new Panel();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartPanel.CssClass = &amp;quot;ms-ToolPartSpacing&amp;quot;; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create a table that will put our controls in rows      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Table toolPartTable = new Table();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartPanel.Controls.Add(toolPartTable);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartTable.CellPadding = 0;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartTable.CellSpacing = 0;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartTable.Style[&amp;quot;border-collapse&amp;quot;] = &amp;quot;collapse&amp;quot;;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartTable.Attributes.Add(&amp;quot;width&amp;quot;, &amp;quot;100%&amp;quot;); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the first row that will contain a control      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TableRow firstRow = new TableRow();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartTable.Rows.Add(firstRow);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TableCell firstRowCell = new TableCell();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; firstRow.Cells.Add(firstRowCell); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // add formatting to the cells      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; firstRowCell.Controls.Add(new LiteralControl(&amp;quot;&amp;lt;div class='UserSectionHead'&amp;gt;Sample Dropdown:&amp;lt;/div&amp;gt;&amp;quot;));      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; firstRowCell.Controls.Add(new LiteralControl(&amp;quot;&amp;lt;div class='UserSectionBody'&amp;gt;&amp;lt;div class='UserControlGroup'&amp;gt;&amp;lt;nobr&amp;gt;&amp;quot;)); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create the actual control      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DropDownList sampleDropDown1 = new DropDownList();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sampleDropDown1.ID = &amp;quot;sampleDropDown1&amp;quot;;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sampleDropDown1.Items.Add(&amp;quot;Item 1&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sampleDropDown1.Items.Add(&amp;quot;Item 2&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sampleDropDown1.Items.Add(&amp;quot;Item 3&amp;quot;); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // add the new control to the table      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; firstRowCell.Controls.Add(sampleDropDown1); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // add formatting closing tags to the cell      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; firstRowCell.Controls.Add(new LiteralControl(&amp;quot;&amp;lt;/nobr&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;quot;)); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // create a standard dotted line seperator      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TableRow seperatorRow = new TableRow();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolPartTable.Rows.Add(seperatorRow);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TableCell seperatorCell = new TableCell();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; firstRow.Cells.Add(seperatorCell);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; seperatorCell.Controls.Add(new LiteralControl(&amp;quot;&amp;lt;div style='width:100%' class='UserDottedLine' /&amp;gt;&amp;quot;)); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // lather, rinse, repeat for all the controls you need &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // finally add the panel to the controls collection of the tool part      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Controls.Add(toolPartPanel);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; base.CreateChildControls();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; // Next, override the ApplyChanges method.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // This method is where we will persist the values that the user selects.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public override void ApplyChanges()      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // get the parent webpart       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SampleWebPart parentWebPart = (SampleWebPart)this.ParentToolPane.SelectedWebPart; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // loop thru this control's controls until we find the ones that we need to persist.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; RetrievePropertyValues(this.Controls, parentWebPart);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; // Recursive function that tries to locate the values set in the toolpart      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; private void RetrievePropertyValues(ControlCollection controls, SampleWebPart parentWebPart)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; foreach (Control ctl in controls)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; RetrievePropertyValue(ctl, parentWebPart); &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (ctl.HasControls())     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; RetrievePropertyValues(ctl.Controls, parentWebPart);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; // Method for retrieving the values set by the user.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; private void RetrievePropertyValue(Control ctl, SampleWebPart parentWebPart)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (ctl is DropDownList)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (ctl.ID.Equals(&amp;quot;sampleDropDown1&amp;quot;))      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DropDownList drp = (DropDownList)ctl;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (drp.SelectedItem.Value != &amp;quot;&amp;quot;)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; parentWebPart.Property1 = drp.SelectedItem.Value;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;} &lt;/p&gt; &lt;/blockquote&gt;  &lt;div&gt;   &lt;br /&gt;Now, we need to wire up the tool part to the web part. To do this, we override the GetToolParts() method and place our new tool part in the ToolPart array.     &lt;br /&gt;&lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;blockquote&gt;   &lt;p&gt;public class SampleWebPart : Microsoft.SharePoint.WebPartPages.WebPart     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public SampleWebPart()      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; this.ExportMode = WebPartExportMode.All;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; // property that will be set thru our custom tool part     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // make sure to set the WebBrowsable attribute to false      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // so it will not show up outside of our custom tool part      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [Personalizable(PersonalizationScope.Shared)]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [WebBrowsable(false)]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [System.ComponentModel.Category(&amp;quot;My Group&amp;quot;)]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [WebDisplayName(&amp;quot;Property1&amp;quot;)]      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public string Property1      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; get      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return _property1;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; set      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _property1 = value;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; private string _property1 = &amp;quot;Default Value&amp;quot;; &lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; public override ToolPart[] GetToolParts()     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // resize the tool part array       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ToolPart[] toolparts = new ToolPart[3];      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // instantiate the standard SharePopint tool part       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; WebPartToolPart wptp = new WebPartToolPart();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // instantiate the custom property toolpart if needed.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // this object is what renders our regular properties.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CustomPropertyToolPart custom = new CustomPropertyToolPart();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // instantiate and add our tool part to the array.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // tool parts will render in the order they are added to this array.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolparts[0] = new SampleToolPart();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolparts[1] = custom;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; toolparts[2] = wptp;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return toolparts;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;} &lt;/p&gt; &lt;/blockquote&gt;  &lt;div&gt;   &lt;br /&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-4594599452735849231?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/4594599452735849231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=4594599452735849231' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/4594599452735849231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/4594599452735849231'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/08/custom-web-part-properties-toolparts.html' title='Custom Web Part Properties (ToolParts)'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-1070684992256316009</id><published>2008-07-21T09:21:00.003-05:00</published><updated>2008-07-26T16:10:58.226-05:00</updated><title type='text'>Setting Master Page For An Individual Page</title><content type='html'>Settings the master page for a SharePoint 2007 publishing website can be done out of the box using the UI or programmatically. For guidance on how to set the MasterPage programmatically, Mike Hodnick has a good &lt;a href="http://www.kindohm.com/archive/2008/05/19/setting-sharepoint-web-master-pages-programmatically.aspx"&gt;post&lt;/a&gt;.  &lt;br /&gt;  &lt;br /&gt;However, if you want to set the Master Page for an &lt;strong&gt;individual page or pages within a website&lt;/strong&gt;, things get tricky.   &lt;br /&gt;  &lt;br /&gt;The @Page directive exposes the &lt;strong&gt;MasterPageFile&lt;/strong&gt; property, but the value is immediately overwritten in the Pre-Init event of the publishing pages base class (PublishingLayoutPage).   &lt;br /&gt;  &lt;br /&gt;To resolve this, we will have to set the MasterPageFile through code. Andrew Connell provides a nice &lt;a href="http://msdn.microsoft.com/en-us/library/bb986729.aspx"&gt;tutorial&lt;/a&gt; on how to create a &lt;strong&gt;code-behind class&lt;/strong&gt; for a layout page.   &lt;br /&gt;  &lt;br /&gt;Once you have created the code-behind class, override the &lt;strong&gt;OnPreInit&lt;/strong&gt; event method and set the &lt;strong&gt;MasterPageFile&lt;/strong&gt; property immediately after the base.OnPreInit(e) call.  &lt;br /&gt;  &lt;br /&gt;  &lt;blockquote&gt;&lt;/blockquote&gt;  &lt;blockquote&gt;protected override void OnPreInit(EventArgs e)   &lt;br /&gt;{    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; base.OnPreInit(e);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // override the MasterPageFile which is set in the Pre-Init with our own.    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MasterPageFile = &amp;quot;mymaster.master&amp;quot;;    &lt;br /&gt;}    &lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-1070684992256316009?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/1070684992256316009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=1070684992256316009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1070684992256316009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1070684992256316009'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/07/setting-master-page-for-individual-page.html' title='Setting Master Page For An Individual Page'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-1703588894791208986</id><published>2008-07-18T10:47:00.002-05:00</published><updated>2008-07-18T12:25:17.876-05:00</updated><title type='text'>Content Type is still in use error</title><content type='html'>I spent an hour trying to &lt;strong&gt;delete&lt;/strong&gt; a &lt;strong&gt;content type&lt;/strong&gt; through the SharePoint 2007 UI with no success.  I kept getting an &lt;strong&gt;"Content Type is still in use"&lt;/strong&gt; exception even though I had deleted all layout pages that used that content type.  I even went as far as de-activating the feature that installs the layout pages in the first place. &lt;br /&gt;&lt;br /&gt;Finally I figured out that I have to remove the content type from any document library that contained any of the layout pages attached to the offending content type.&lt;br /&gt;&lt;br /&gt;In my case, I had a publishing web site.  So I clicked on &lt;strong&gt;"View All Site Content"&lt;/strong&gt; and selected the &lt;strong&gt;Pages&lt;/strong&gt; document library.  From there, I went to the &lt;strong&gt;Settings&lt;/strong&gt; page and, under the &lt;strong&gt;Content Types section&lt;/strong&gt;, clicked on the content type I wanted to remove and deleted it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-1703588894791208986?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/1703588894791208986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=1703588894791208986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1703588894791208986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1703588894791208986'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/07/content-type-is-still-in-use-error.html' title='Content Type is still in use error'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-4770715616432478342</id><published>2008-07-16T12:47:00.002-05:00</published><updated>2008-07-16T13:00:25.873-05:00</updated><title type='text'>Programmatically Creating a List from a ListTemplate</title><content type='html'>Adding a list to a website in SharePoint 2007 from a &lt;strong&gt;ListTemplate&lt;/strong&gt; is fairly straightforward.  But there is one quirk that you need to be aware of. &lt;br /&gt;&lt;br /&gt;The templates are located in &lt;strong&gt;SPWeb.ListTemplates&lt;/strong&gt;.  The indexer for the &lt;strong&gt;ListTemplateCollection&lt;/strong&gt; has two overloads.  The first one uses the index value of the &lt;strong&gt;ListTemplate&lt;/strong&gt;.  Since you will probably not know that value, the second overload comes into play.  This one uses the "Name" of the &lt;strong&gt;ListTemplate&lt;/strong&gt;. &lt;br /&gt;&lt;br /&gt;Here's the catch.  What Microsoft really means by &lt;strong&gt;"Name"&lt;/strong&gt; is &lt;strong&gt;"Display Name"&lt;/strong&gt;.  This seems like more than just bad naming conventions, but bad practice as well.  As the &lt;strong&gt;"Name"&lt;/strong&gt; of the &lt;strong&gt;ListTemplate&lt;/strong&gt; should be the key.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-4770715616432478342?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/4770715616432478342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=4770715616432478342' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/4770715616432478342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/4770715616432478342'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/07/programmatically-creating-list-from.html' title='Programmatically Creating a List from a ListTemplate'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-9711796450571877</id><published>2008-07-07T10:06:00.004-05:00</published><updated>2008-07-07T10:18:01.755-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Receivers'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Namespaces matter</title><content type='html'>Thanks to Paul's &lt;a href="http://sharepointers.blogspot.com/2008/05/error-failed-to-create-feature-receiver.html"&gt;post&lt;/a&gt;, I realized that SharePoint 2007 pays closer attention to namespaces than I realized. Your &lt;strong&gt;feature and it's feature receiver&lt;/strong&gt; must have the same root &lt;strong&gt;namespace&lt;/strong&gt; or the solution will &lt;strong&gt;not&lt;/strong&gt; deploy.&lt;br /&gt;&lt;br /&gt;I am still not sure what the difference is, because I could deploy to my local environment using WSPBuilder without issue. But when I tried to deploy to our test environment using the standard stsadm commands it failed with the following exception:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"Failed to create feature receiver object from assembly 'MyAssemblyInfo'... : System.ArgumentNullException: Value cannot be null."&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-9711796450571877?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/9711796450571877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=9711796450571877' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/9711796450571877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/9711796450571877'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/07/namespaces-matter.html' title='Namespaces matter'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-8311266561216403473</id><published>2008-07-03T22:26:00.001-05:00</published><updated>2008-07-05T12:39:52.767-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Surveys'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Create an Anonymous Access Survey Programmatically</title><content type='html'>&lt;p&gt;Their are several good &lt;a href="http://www.teuntostring.net/blog/2007/07/using-surveys-on-anonymous-access.html" target="_blank"&gt;examples&lt;/a&gt; on how to use the UI to make a SharePoint 2007 survey work for &lt;strong&gt;anonymous users&lt;/strong&gt;.&amp;nbsp; So I took what I learned from them and came up with this method for doing the same thing &lt;strong&gt;programmatically&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;The main catch was the &lt;strong&gt;AnonymousPermMask64&lt;/strong&gt; flags.&amp;nbsp; The only ones that you see in the UI are the &lt;strong&gt;AddListItems&lt;/strong&gt; and &lt;strong&gt;ViewListItems&lt;/strong&gt;.&amp;nbsp; But there are several others that are set behind the scenes.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; AddNewSurvey(SPWeb web, SPListTemplate surveyTemplate)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;{&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    web.Lists.Add(&lt;span style="color: #006080"&gt;"Survey Title"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"Survey Description"&lt;/span&gt;, surveyTemplate);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #008000"&gt;// once we have created the survey, find it again so we can set the permissions&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    SPList surveyList = web.Lists[&lt;span style="color: #006080"&gt;"Survey Title"&lt;/span&gt;];&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    web.AllowUnsafeUpdates = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #008000"&gt;// break the role inheritance so we can set our own permissons&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!surveyList.HasUniqueRoleAssignments)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        surveyList.BreakRoleInheritance(&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    surveyList.ReadSecurity = 2; &lt;span style="color: #008000"&gt;// can read their own&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    surveyList.WriteSecurity = 2; &lt;span style="color: #008000"&gt;// can edit their own&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #008000"&gt;// set the permission flags for Add and View plus some internal flags&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    surveyList.AnonymousPermMask64 =&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        (SPBasePermissions.Open |&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        SPBasePermissions.OpenItems |&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        SPBasePermissions.ViewFormPages |&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        SPBasePermissions.UseClientIntegration |&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #008000"&gt;//SPBasePermissions.UseRemoteAPIs |&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        SPBasePermissions.ViewListItems |&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        SPBasePermissions.AddListItems);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    surveyList.Update();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-8311266561216403473?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/8311266561216403473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=8311266561216403473' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8311266561216403473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8311266561216403473'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/07/create-anonymous-access-survey.html' title='Create an Anonymous Access Survey Programmatically'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-9089951218611817702</id><published>2008-06-27T21:03:00.001-05:00</published><updated>2008-06-28T14:48:51.331-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WebParts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Adding Web Part to Page Layout</title><content type='html'>&lt;div&gt;It seems the standard method for adding a SharePoint 2007 Web Part to a page layout is by using the &lt;strong&gt;&amp;lt;AllUsersWebPart&amp;gt;&lt;/strong&gt; tag in the &lt;strong&gt;&amp;lt;Module&amp;gt;&lt;/strong&gt; tag of the page layout feature.&amp;nbsp; However when I tried this method, I would receive an "No parameterless constructor defined for this object" exception that I could not resolve.&amp;nbsp; So I came up with a different way of doing it that I actually like better.&amp;nbsp; I can go directly to the page layout aspx file and add the Web Part there.&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;First, I need to register the Web Part assembly just as if I were adding a custom control to a standard asp.net page.&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;&amp;lt;%@ Register tagprefix="MyTag" namespace="My.NameSpace" assembly="My.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f300fd2d8ae223d7" %&amp;gt;&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;Then, I can declare the Web Part control in the Web Part Zone of my choosing.&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;WebPartPages:WebPartZone&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PartChromeType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="None"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Zone1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Zone1"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ZoneTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;MyTag:MyWebPart&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PartOrder&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="1"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;MyTag:MyWebPart&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ZoneTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;WebPartPages:WebPartZone&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;What's nice about this approach is that if I want to remove this Web part or add another, I can simple copy the aspx file to the proper 12 hive location and its ready to go.&amp;nbsp; Instead of having to uninstall and re-install the feature.&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-9089951218611817702?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/9089951218611817702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=9089951218611817702' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/9089951218611817702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/9089951218611817702'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/adding-web-part-to-page-layout.html' title='Adding Web Part to Page Layout'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-584112764473737752</id><published>2008-06-27T15:27:00.003-05:00</published><updated>2008-06-27T21:10:31.913-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Running with Elevated Privileges</title><content type='html'>&lt;p&gt;SharePoint 2007 offers a nice and easy way for elevating your permissions using delegates. &lt;/p&gt; &lt;p&gt;The main catch is to remember that you cannot use any of the Context objects such as SPContext to directly retrieve your objects.&amp;nbsp; But this can be easily overcome by using the ID attribute of the Site object in the Context to retrieve a copy of the site.&lt;!--&lt;br /&gt;{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;\red0\green128\blue0;}??\fs20         \cf3 protected\cf0  \cf3 void\cf0  MyMethod()\par ??        \{\par ??            \cf4 SPSecurity\cf0 .CodeToRunElevated elevatedMethod = \cf3 new\cf0  \cf4 SPSecurity\cf0 .CodeToRunElevated(MyElevatedMethod);\par ??            \cf4 SPSecurity\cf0 .RunWithElevatedPrivileges(elevatedMethod);\par ??        \}\par ??\par ??        \cf3 private\cf0  \cf3 void\cf0  MyElevatedMethod()\par ??        \{\par ??            \cf5 // do not use the Context object directly since it uses the logged in credentials\par ??\cf0             \cf5 // instead create a new object using the site id retrieved from the Context\par ??\cf0             \cf3 using\cf0  (\cf4 SPSite\cf0  site = \cf3 new\cf0  \cf4 SPSite\cf0 (SPContext.Current.Site.ID))\par ??            \{\par ??                \cf5 // do your stuff here\par ??\cf0             \}\par ??        \}\par ??}&lt;br /&gt;--&gt;&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; MyMethod()&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;SPSecurity&lt;/span&gt;.CodeToRunElevated elevatedMethod = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SPSecurity&lt;/span&gt;.CodeToRunElevated(MyElevatedMethod);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;SPSecurity&lt;/span&gt;.RunWithElevatedPrivileges(elevatedMethod);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; MyElevatedMethod()&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green"&gt;// do not use the Context object directly since it uses the logged in credentials&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green"&gt;// instead create a new object using the site id retrieved from the Context&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SPSite&lt;/span&gt; site = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SPSite&lt;/span&gt;(&lt;font color="#2b91af"&gt;SPContext&lt;/font&gt;.Current.Site.ID))&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green"&gt;// do your stuff here&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-584112764473737752?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/584112764473737752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=584112764473737752' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/584112764473737752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/584112764473737752'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/running-with-elevated-privileges.html' title='Running with Elevated Privileges'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-2814476447767415766</id><published>2008-06-20T17:29:00.001-05:00</published><updated>2008-06-20T17:29:30.473-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Receivers'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Modifying the SharePoint Web.config</title><content type='html'>&lt;p&gt;Modifying the web.config file for &lt;strong&gt;SharePoint 2007&lt;/strong&gt; is more complicated than a typical ASP.NET web application.&amp;nbsp; Although modifying the file by hand does work, if your production environment is a large farm, or if you need your solution to be easily re-deployable, manual modification is not the answer.&amp;nbsp; So SharePoint provides us with an &lt;strong&gt;SPWebConfigModification&lt;/strong&gt; object to handle changes.  &lt;p&gt;My example deals with adding appSetting keys.&amp;nbsp; Typically, these keys should be added when your feature is installed or activated.&amp;nbsp; I chose the &lt;strong&gt;FeatureActivated&lt;/strong&gt; event for this example. &lt;div&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; FeatureActivated(SPFeatureReceiverProperties properties)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;{&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (SPSite site = properties.Feature.Parent &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; SPSite)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        SPWebApplication webApp = site.WebApplication;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        SPWebConfigModification configMod = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SPWebConfigModification();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        configMod.Name = &lt;span style="color: #006080"&gt;"add[@key='"&lt;/span&gt; + key + &lt;span style="color: #006080"&gt;"']"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        configMod.Path = &lt;span style="color: #006080"&gt;@"configuration/appSettings"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        configMod.Value = &lt;span style="color: #006080"&gt;@"&amp;lt;add key="&lt;/span&gt;&lt;span style="color: #006080"&gt;"MyKeyName"&lt;/span&gt;&lt;span style="color: #006080"&gt;" value="&lt;/span&gt;&lt;span style="color: #006080"&gt;"MyValue"&lt;/span&gt;&lt;span style="color: #006080"&gt;" /&amp;gt;"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &lt;span style="color: #008000"&gt;// you can put whatever you want for the owner, but using the feature id is a good standard&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        configMod.Owner = properties.Feature.DefinitionId.ToString();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        configMod.Sequence = 0;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        configMod.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (webApp.WebConfigModifications.Contains(configMod))&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;            webApp.WebConfigModifications.Remove(configMod);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        webApp.WebConfigModifications.Add(configMod);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &lt;span style="color: #008000"&gt;// I have seen several examples that only call ApplyWebConfigModifications&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #008000"&gt;// or that make the Update call after calling ApplyWebConfigModifications.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &lt;span style="color: #008000"&gt;// But the only way it works for me is to call Update first.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        webApp.Update();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        webApp.WebService.ApplyWebConfigModifications();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp; &lt;p&gt;The &lt;strong&gt;ApplyWebConfigModifications&lt;/strong&gt; works through a timer job, so there may be a slight delay in the update.&lt;br /&gt;&lt;p&gt;I stole this removal routine from &lt;a href="http://blog.thekid.me.uk/archive/2007/03/20/removing-web-config-entries-from-sharepoint-using-spwebconfigmodification.aspx" target="_blank"&gt;Vincent Rothwell&lt;/a&gt;.&amp;nbsp; I like it because it keys off the &lt;strong&gt;owner&lt;/strong&gt; and since I use the feature id as the owner, it knows exactly which entries to remove.&amp;nbsp; It also helps to clean up any goofs I may have made in the file earlier. &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; FeatureDeactivating(SPFeatureReceiverProperties properties)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;{&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (SPSite site = properties.Feature.Parent &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; SPSite)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        RemoveAppSettingsByOwner(site, properties.Feature.DefinitionId.ToString());&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;} &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RemoveAppSettingsByOwner(SPSite site, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; owner)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;{&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    SPWebApplication webApp = site.WebApplication;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    Collection&amp;lt;SPWebConfigModification&amp;gt; modifications = webApp.WebConfigModifications; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; modCount = modifications.Count; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; c = modCount - 1; c &amp;gt;= 0; c--)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        SPWebConfigModification modification = modifications[c]; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (modification.Owner == owner)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;            modifications.Remove(modification); &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    } &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (modCount &amp;gt; modifications.Count)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        webApp.Update();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        webApp.WebService.ApplyWebConfigModifications();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;} &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-2814476447767415766?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/2814476447767415766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=2814476447767415766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2814476447767415766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2814476447767415766'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/modifying-sharepoint-webconfig.html' title='Modifying the SharePoint Web.config'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-480465272922646562</id><published>2008-06-19T13:08:00.006-05:00</published><updated>2009-04-12T16:35:02.923-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Receivers'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Programmatically Create Workspace Linked to an Event (LinkWithEvent)</title><content type='html'>&lt;p&gt;In my SharePoint 2007 project, I created a workspace template that I wanted the customers to always use when they created their meeting workspace. So I needed to bypass the standard site creation page and programmatically add the sub site with the desired template. &lt;/p&gt;  &lt;p&gt;Step 1 was to create my own custom list template based on the Calendar list. I need to do this so I could hide the Workspace column from the user. But more importantly, so I could add an event receiver that would do the work of creating the workspace site. &lt;/p&gt;  &lt;p&gt;Step 2 was to create the event receiver for the ItemAdded event via a feature. &lt;/p&gt;  &lt;p&gt;The feature.xml file is standard. Being sure to set the scope to &amp;quot;Web&amp;quot; as receivers cannot be scoped at the Site Collection level. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div&gt;   &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt;?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Feature&lt;/span&gt;  &lt;span style="color: #ff0000"&gt;Id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;YOURGUIDHERE&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;          &lt;span style="color: #ff0000"&gt;Title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;CalendarEventListEventReceiver&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;          &lt;span style="color: #ff0000"&gt;Description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Description for CalendarEventListEventReceiver&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;          &lt;span style="color: #ff0000"&gt;Version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;12.0.0.0&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;          &lt;span style="color: #ff0000"&gt;Hidden&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;FALSE&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;          &lt;span style="color: #ff0000"&gt;Scope&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Web&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;          &lt;span style="color: #ff0000"&gt;DefaultResourceFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;core&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;          &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/sharepoint/&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ElementManifests&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ElementManifest&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Location&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;elements.xml&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ElementManifests&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Feature&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &lt;br /&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;For the elements.xml ensure that the ListTemplateId attribute references the type of your list template. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Elements&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/sharepoint/&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Receivers&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ListTemplateId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;10002&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Receiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;ItemAdded&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;ItemAdded&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;10000&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;SequenceNumber&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Assembly&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;Events.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=747f099a9bd1475c&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Assembly&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;Events.Web.EventListEventReceiver&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Data&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Data&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Filter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Filter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Receiver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Receivers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: white; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Elements&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now create the receiver and override the ItemAdded method. Remember that the ItemAdded event is an asynchronous event, so you might not see your new site right away. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160; &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="white" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;using System;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="white" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;&lt;span style="color: #0000ff"&gt;using System.Collections.Generic;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;using System.Text;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="white" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;&lt;span style="color: #0000ff"&gt;using Microsoft.SharePoint;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;using Microsoft.SharePoint.Meetings;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="white" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;namespace MyNamespace&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="white" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;{&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class EventListEventReceiver : SPItemEventReceiver&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="white" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;    {&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void ItemAdded(SPItemEventProperties properties)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        {&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;&lt;span style="color: #0000ff"&gt;            CreateWorkSpace(properties);&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;            &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;.ItemAdded(properties);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void CreateWorkSpace(SPItemEventProperties properties)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        {&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;            &lt;span style="color: #0000ff"&gt;using (SPWeb web = properties.OpenWeb())&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;            {&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: #f4f4f4; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none"&gt;                &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                {&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="#f4f4f4" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;                    &lt;span style="color: #008000"&gt;//find the parent site&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                    &lt;span class="Apple-style-span" style="color: rgb(0,0,255); font-family: -webkit-monospace"&gt;using&lt;span class="Apple-style-span" style="color: rgb(0,0,0); font-family: consolas"&gt; (SPSite site = web.Site)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span class="Apple-tab-span" style="white-space: pre"&gt;  &lt;/span&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none" color="#f4f4f4" size="8pt" face="consolas, &amp;#39;Courier New&amp;#39;, courier, monospace"&gt;                    &lt;span style="color: #008000"&gt;// get a list of the custom templates so we can find our event template&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span class="Apple-tab-span" style="white-space: pre"&gt; &lt;/span&gt;               SPWebTemplateCollection templates = site.GetCustomWebTemplates(1033);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                       SPWebTemplate template = templates[&lt;span style="color: #006080"&gt;&amp;quot;EventWorkspaceTemplate.stp&amp;quot;&lt;/span&gt;];&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                       &lt;span style="color: #008000"&gt;// create the new web site&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                       SPWeb newWeb = web.Webs.Add(properties.ListItemId.ToString(), properties.ListItem[&lt;span style="color: #006080"&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;].ToString(), properties.ListItem[&lt;span style="color: #006080"&gt;&amp;quot;Location&amp;quot;&lt;/span&gt;].ToString(), 1033, template, &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                       &lt;span style="color: #008000"&gt;// cast the web as a meeting so we can link it back to the event item&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                       SPMeeting meeting = SPMeeting.GetMeetingInformation(newWeb);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                       meeting.LinkWithEvent(web, properties.ListId.ToString(), properties.ListItemId, &lt;span style="color: #006080"&gt;&amp;quot;WorkspaceLink&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Workspace&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span class="Apple-tab-span" style="white-space: pre"&gt;  &lt;/span&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                {&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                    properties.Cancel = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                    properties.ErrorMessage = ex.Message;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;            }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;After installing the feature, be sure it is activated in the web site that your custom list exists.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-480465272922646562?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/480465272922646562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=480465272922646562' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/480465272922646562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/480465272922646562'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/programmatically-create-workspace.html' title='Programmatically Create Workspace Linked to an Event (LinkWithEvent)'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-8223323181861086182</id><published>2008-06-14T17:39:00.002-05:00</published><updated>2008-06-19T18:26:27.944-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Action'/><category scheme='http://www.blogger.com/atom/ns#' term='WebParts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>CustomAction token bug</title><content type='html'>&lt;p&gt;&lt;a href="http://office12.blogspot.com/2008/03/customaction-and-listid-token-bug.html" target="_blank"&gt;Sheetal Jain&lt;/a&gt; again comes to my rescue by providing a very quick and easy workaround to an apparent SharePoint 2007 bug regarding tokens in custom actions.&amp;nbsp; If you use the {ListId} token, it works fine if you are viewing the actual list.&amp;nbsp; But if you view the list through a WebPart, it does not work.&amp;nbsp; I found some other posts that came up with workarounds that were quite complicated.&amp;nbsp; So I was very excited to find his solution.&lt;/p&gt; &lt;p&gt;To sum up, MOSS adds a context object (ctx) to the javascript side of each page.&amp;nbsp; The object has a property called ListName which is actually the Guid for the list.&amp;nbsp; So instead of using {ListId}, just concatenate "+ctx.ListName" to your url instead. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;This does NOT work if you are in a meeting workspace.&amp;nbsp; I'll try to post my workaround later.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-8223323181861086182?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/8223323181861086182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=8223323181861086182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8223323181861086182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8223323181861086182'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/customaction-token-bug.html' title='CustomAction token bug'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-133628492470205834</id><published>2008-06-12T13:32:00.002-05:00</published><updated>2008-06-19T20:50:45.996-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPGridView'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Adding a Checkbox to SPGridView in SharePoint 2007</title><content type='html'>&lt;p&gt;This example creates a very simple grid that as a checkbox on each row. Allowing you to select multiple rows at a time.&lt;/p&gt; &lt;p&gt;Note: You can do it in Html for simple controls, but if you need to add features such as grouping, you will probably have to build your grid programmatically. (see Oscar Medina's &lt;a href="http://www.sharepointace.com/Blog/?year=2007&amp;amp;month=11" target="_blank"&gt;post&lt;/a&gt; for tips on how to do that)&lt;/p&gt;&lt;br&gt; &lt;p&gt;1. Register the SharePoint web controls on the aspx page&lt;/p&gt; &lt;div&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;lt;%@ Register TagPrefix=&lt;span style="color: #006080"&gt;"SharePoint"&lt;/span&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    Namespace=&lt;span style="color: #006080"&gt;"Microsoft.SharePoint.WebControls"&lt;/span&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    Assembly=&lt;span style="color: #006080"&gt;"Microsoft.SharePoint, &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    Version=11.0.0.0, &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    Culture=neutral, &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    PublicKeyToken=71e9bce111e9429c"&lt;/span&gt; %&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;div&gt;2. Declare your SPGridView control in the Html with the first column being a TemplateField control holding your checkbox.&amp;nbsp; You can also add a hidden field to hold the ID of the ListItem. &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;lt;SharePoint:SPGridView id=&lt;span style="color: #006080"&gt;"grid"&lt;/span&gt; allowsorting=&lt;span style="color: #006080"&gt;"true"&lt;/span&gt; autogeneratecolumns=&lt;span style="color: #006080"&gt;"false"&lt;/span&gt; runat=&lt;span style="color: #006080"&gt;"server"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &amp;lt;Columns&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &amp;lt;asp:TemplateField headertext=&lt;span style="color: #006080"&gt;"Select"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;            &amp;lt;ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                &amp;lt;input id=&lt;span style="color: #006080"&gt;"select"&lt;/span&gt; type=&lt;span style="color: #006080"&gt;"checkbox"&lt;/span&gt; runat=&lt;span style="color: #006080"&gt;"server"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                &amp;lt;input id=&lt;span style="color: #006080"&gt;"itemID"&lt;/span&gt; type=&lt;span style="color: #006080"&gt;"hidden"&lt;/span&gt; runat=&lt;span style="color: #006080"&gt;"server"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;            &amp;lt;/ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &amp;lt;/asp:TemplateField&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &amp;lt;/Columns&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;lt;/SharePoint:SPGridView&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;3. If you know the data columns, you can declare them here too. Or you can build them dynamically at step 5 (see my previous &lt;a href="http://rustyc72.blogspot.com/2008/06/build-spgridview-columns-dynamically.html" target="_blank"&gt;post&lt;/a&gt;)&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;4. In your code-behind page, add a reference to your grid&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; height: 65px; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none; background-: none" color="#f4f4f4" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; MycodeBehind : System.Web.UI.Page &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;{&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; border-right-style: none; border-left-style: none; background-: none" color="#f4f4f4" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;    &lt;font color="#0000ff"&gt;protected&lt;/font&gt; SPGridView grid;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;5. Create a method to build the data fields dynamically (see my previous &lt;a href="http://rustyc72.blogspot.com/2008/06/build-spgridview-columns-dynamically.html" target="_blank"&gt;post&lt;/a&gt;)&lt;/p&gt;&lt;br /&gt;&lt;p&gt;6. Wire up an event handler for the RowDataBound event.&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; height: 37px; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;grid.RowDataBound += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; GridViewRowEventHandler(grid_RowDataBound);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;7. Create your Event Handler method.&amp;nbsp; This method will set the itemID field value to the ID of the ListItem.&amp;nbsp; You can use this field on the post back to identify the ListItem.&lt;/p&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; grid_RowDataBound(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, GridViewRowEventArgs e)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;{ &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.Row.RowType == DataControlRowType.DataRow)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        HtmlInputHidden itemID = (HtmlInputHidden)e.Row.FindControl(&lt;span style="color: #006080"&gt;"itemID"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (itemID != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;            DataRowView data = (DataRowView)e.Row.DataItem;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;            itemID.Value = data[&lt;span style="color: #006080"&gt;"ID"&lt;/span&gt;].ToString();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;8. Add this code to the post back event (OnClick most likely).&amp;nbsp; This will loop through your grid and find all the rows that are checked.&amp;nbsp; Once you have a checked row, you can use the itemID value to quickly find the corresponding ListItem.&lt;/p&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; grid.Rows.Count; i++)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;{ &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    HtmlInputCheckBox selectCtl = (HtmlInputCheckBox)grid.Rows[i].FindControl(&lt;span style="color: #006080"&gt;"select"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    HtmlInputHidden itemIDCtl = (HtmlInputHidden)grid.Rows[i].FindControl(&lt;span style="color: #006080"&gt;"itemID"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (selectCtl.Checked &amp;amp;&amp;amp; itemIDCtl.Value != &lt;span style="color: #006080"&gt;""&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    { &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &lt;span style="color: #008000"&gt;// find the row so we can retrieve the values &lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        SPListItem myListItem = myList.Items.GetItemById(Convert.ToInt32(itemIDCtl.Value));&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #008000"&gt;// do whatever you need to do&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    } &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-133628492470205834?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/133628492470205834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=133628492470205834' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/133628492470205834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/133628492470205834'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/adding-checkbox-to-spgridview-in.html' title='Adding a Checkbox to SPGridView in SharePoint 2007'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-1418807925095671407</id><published>2008-06-11T15:22:00.003-05:00</published><updated>2011-05-09T09:11:20.653-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Action'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>SharePoint 2007: Custom Action That Opens A Popup Window</title><content type='html'>&lt;p&gt;&lt;a href="http://office12.blogspot.com/2007/11/and-opening-link-in-new-window.html"&gt;Sheetal Jain&lt;/a&gt; points out something that no one else seems to mention when trying to create a custom action that pops up a new window in SharePoint 2007.&lt;br /&gt;&lt;br /&gt;The standard method that all the samples show looks something like this:&lt;br /&gt;&lt;br /&gt;&lt;urlaction url="javaScript:window.open('/_layouts/someForm.aspx?list={ListId}', 'win1', 'menubar=no, width=430, height=360, toolbar=no');"&gt;&amp;lt;UrlAction Url="javascript:window.open('/_layouts/someForm.aspx')" /&amp;gt;&lt;br /&gt;&lt;br /&gt;However, this does not work. The new form does indeed popup, but the original window will then display just "[Object]". The solution is to add the keyword "&lt;strong&gt;void&lt;/strong&gt;" in front of the window.open call:&lt;br /&gt;&lt;/p&gt;&amp;lt;UrlAction Url="javascript:&lt;strong&gt;void&lt;/strong&gt; window.open('/_layouts/someForm.aspx');" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Updated: fixed typos mentioned in comments&lt;br /&gt;&lt;urlaction url="javaScript:void window.open('/_layouts/someForm.aspx?list={ListId}', 'win1', 'menubar=no, width=430, height=360, toolbar=no');"&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-1418807925095671407?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/1418807925095671407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=1418807925095671407' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1418807925095671407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1418807925095671407'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/sharepoint-2007-custom-action-that.html' title='SharePoint 2007: Custom Action That Opens A Popup Window'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-8036033052038560585</id><published>2008-06-10T08:50:00.003-05:00</published><updated>2008-06-14T07:36:14.323-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPGridView'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Build SPGridView Columns Dynamically From A View(SPView)</title><content type='html'>Since the SharePoint 2007 SPGridView controls do not support autogeneration of columns, they typically have to be manually constructed by looping through the datasource and building a column for each field. This is straightforward enough if the datasource is an SPList. For an SPList, you can simple iterate through the Fields collection and add BoundField objects to the grid using the Title and InternalName properties for the HeaderText and DataField respectively. &lt;br&gt;&lt;br&gt;In the case of an SPView, this is not so straightforward. The challenge is that the view object does not contain the display names of the fields it represents.&lt;br&gt;&lt;br&gt;So here is how I have worked it out. The SPView object does have a ViewFields property which gives us a collection of the internal names for the fields. So we can use this collection to point to the fields in the parent list to find the other attributes such as the display name (or Title).&lt;br&gt;&lt;br&gt; &lt;div&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; BuildColumns(SPView myView, SPGridView grid)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;{&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    SPViewFieldCollection viewFields = myView.ViewFields;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; viewFields.Count; i++)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (SPField field &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; myView.ParentList.Fields)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (field.InternalName == viewFields[i])&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;            {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!field.Hidden)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                    BoundField col = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; BoundField();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                    col.HeaderText = field.Title;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                    col.DataField = field.InternalName;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                    grid.Columns.Add(col);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;            }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;        }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-8036033052038560585?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/8036033052038560585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=8036033052038560585' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8036033052038560585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8036033052038560585'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/build-spgridview-columns-dynamically.html' title='Build SPGridView Columns Dynamically From A View(SPView)'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-8092669807820355795</id><published>2008-06-09T12:55:00.002-05:00</published><updated>2008-06-14T07:36:49.162-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DataGrid'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Bind SPList to DataGrid</title><content type='html'>&lt;p&gt;Simple enough, but I thought it would be good to document how to bind an SharePoint 2007 SPList object to an ASP.NET 2.0 DataGrid control. &lt;br&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;SPList customerList = currentweb.Lists["Customers"];&lt;/p&gt; &lt;p&gt;DataGrid dg = new DataGrid(); &lt;/p&gt; &lt;p&gt;dg.DataSource = customerList.Items.GetDataTable();&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-8092669807820355795?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/8092669807820355795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=8092669807820355795' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8092669807820355795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/8092669807820355795'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/bind-splist-to-datagrid.html' title='Bind SPList to DataGrid'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-2155823941008368986</id><published>2008-06-09T08:47:00.001-05:00</published><updated>2008-06-11T22:36:18.427-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>How To Set Url Field Value</title><content type='html'>&lt;p&gt;The standard way of setting a field value for an SPListItem in SharePoint 2007 falls a little short for Url fields. Url fields actually have two parts, the url itself and the text to display. The SharePoint 207 object model provides an SPFieldUrlValue object that resolves this issue. &lt;br&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;SPFieldUrlValue redirectUrl = new SPFieldUrlValue(); &lt;br&gt;redirectUrl.Url = "www.microsoft.com"; &lt;br&gt;redirectUrl.Description = "Click here!"; &lt;br&gt;data.ListItem["Redirect URL"] = redirectUrl; &lt;br&gt;data.Update();&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-2155823941008368986?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/2155823941008368986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=2155823941008368986' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2155823941008368986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2155823941008368986'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/how-to-set-url-field-value.html' title='How To Set Url Field Value'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-5325554879855076077</id><published>2008-06-07T14:39:00.002-05:00</published><updated>2008-06-20T08:49:43.202-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>A Nice Little Trick For Your Local web.config</title><content type='html'>&lt;p&gt;Here is a easy way to include the web.config file from your MOSS site into your Visual Studio feature project.&lt;br /&gt;&lt;br /&gt;I learned this a while back but never really had a use for it until now. For me, this makes it easier to access the config file to add AppSetting keys and what not. &lt;/p&gt;&lt;ol&gt;&lt;li&gt;Right-click on your feature project file and select Add Existing Item. &lt;li&gt;Navigate to your website folder (Typically C:\Inetpub\wwwroot\wss\VirtualDirectories\80) &lt;li&gt;Select the web.config file. &lt;li&gt;Before clicking "Add", click on the arrow at the right of the button and select "Add as Link"&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;This method creates a link to the web.config and not a copy. So any changes you make will be made in the actual config file of the server.  &lt;/p&gt;&lt;p&gt;Remember that this is only for fiddling around in your development environment.  When its time to actually make permanent changes, use SPWebConfigModification so that changes are propagated throughout your farm (see this &lt;a href="http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32"&gt;post&lt;/a&gt; by Mark Wagner).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-5325554879855076077?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/5325554879855076077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=5325554879855076077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/5325554879855076077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/5325554879855076077'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/nice-little-trick-for-your-local.html' title='A Nice Little Trick For Your Local web.config'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-1104209557976302974</id><published>2008-06-04T15:12:00.013-05:00</published><updated>2010-06-18T15:22:46.817-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Lookup'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Site Column'/><title type='text'>Creating Lookup Columns Using Features in SharePoint 2007</title><content type='html'>&lt;a href="http://www.sharepointnutsandbolts.com/2007/04/creating-list-based-site-columns-as.html"&gt;Chris O'Brien&lt;/a&gt; does an excellent job of explaining the difficulties in creating custom lists that contain Lookup columns. His &lt;a href="http://www.sharepointnutsandbolts.com/2007/04/sample-code-creating-list-based-site.html"&gt;solution&lt;/a&gt;, although more flexible since it relies on defining the column in CAML, leaves me a little uneasy since it relies on reading a file to retrieve the xml.  I tend to want my deployment packages to be as simple as possible so there is little chance that the deployment team will run into complications.&lt;br /&gt;&lt;br /&gt;So I created a hybrid between his approach and Waldek Mastykarz's &lt;a href="http://www.sharepointblogs.com/tmt/archive/2007/09/06/sharepoint-programmatically-provisioning-lookup-fields.aspx"&gt;walk-thru&lt;/a&gt; for programmatically provisioning lookup fields&lt;br /&gt;&lt;br /&gt;There are three elements that are needed for this functionality&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The existing source list that is the base of the lookup column. &lt;li&gt;A custom site column pointing to the source list (this is what we are creating). &lt;li&gt;A list that needs the lookup site column (this can be added later at you leisure)&lt;/li&gt;&lt;/ol&gt;First, the feature.xml: (&lt;strong&gt;Notice that no ElementManifest node exists&lt;/strong&gt;) &lt;div style="FONT-FAMILY: courier new; BACKGROUND: white; COLOR: black; FONT-SIZE: 10pt"&gt; &lt;/div&gt;&lt;div style="BORDER-BOTTOM: gray 1px solid; BORDER-LEFT: gray 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; MAX-HEIGHT: 200px; OVERFLOW: auto; BORDER-TOP: gray 1px solid; CURSOR: text; BORDER-RIGHT: gray 1px solid; PADDING-TOP: 4px; BACKGROUND-: 20px 0px 10pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:#f4f4f4;"   &gt;&lt;div style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&amp;lt;?xml version=&lt;span style="color:#006080;"&gt;"1.0"&lt;/span&gt; encoding=&lt;span style="color:#006080;"&gt;"utf-8"&lt;/span&gt;?&amp;gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&amp;lt;Feature Id=&lt;span style="color:#006080;"&gt;"YOURGUIDGOESHERE"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        Title=&lt;span style="color:#006080;"&gt;"LookupColumnFeature"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        Description=&lt;span style="color:#006080;"&gt;"Description for LookupColumnFeature"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        Version=&lt;span style="color:#006080;"&gt;"12.0.0.0"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        Hidden=&lt;span style="color:#006080;"&gt;"FALSE"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        Scope=&lt;span style="color:#006080;"&gt;"Site"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        DefaultResourceFile=&lt;span style="color:#006080;"&gt;"core"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        ReceiverAssembly=&lt;span style="color:#006080;"&gt;"LookupColumnFeatureAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=614c3beb89d35e6b"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        ReceiverClass=&lt;span style="color:#006080;"&gt;"LookupColumnFeatureAssembly.LookupColumnFeature"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        xmlns=&lt;span style="color:#006080;"&gt;"http://schemas.microsoft.com/sharepoint/"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;  &lt;strong&gt;&amp;lt;ElementManifests&amp;gt;&lt;/strong&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;  &lt;strong&gt;&amp;lt;/ElementManifests&amp;gt;&lt;/strong&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&amp;lt;/Feature&amp;gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt; &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Second, I created a feature receiver with the same name as referenced in the ReceiverClass node of the feature.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;The first step in the FeatureActivated method is to find the subweb in which I want to add the column (If your column will be in the root site then this step is not needed).&lt;br /&gt;&lt;li&gt;Next, create a field object using the Sharepoint Object Model (see method CreateLookupColumn).&lt;br /&gt;&lt;li&gt;Finally, added logic in the FeatureDeactivating method to delete the site column as cleanup.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="BORDER-BOTTOM: gray 1px solid; BORDER-LEFT: gray 1px solid; PADDING-BOTTOM: 4px; LINE-HEIGHT: 12pt; PADDING-LEFT: 4px; WIDTH: 97.5%; PADDING-RIGHT: 4px; HEIGHT: 247px; MAX-HEIGHT: 600px; OVERFLOW: auto; BORDER-TOP: gray 1px solid; CURSOR: text; BORDER-RIGHT: gray 1px solid; PADDING-TOP: 4px; BACKGROUND-: 20px 0px 10pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:#f4f4f4;"   &gt;&lt;br /&gt;&lt;div style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.SharePoint;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Configuration;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;&lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; LookupColumnFeatureAssembly&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;{&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;    &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; LookupColumnFeature : SPFeatureReceiver&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;    {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FeatureActivated(SPFeatureReceiverProperties properties)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;            &lt;span style="color:#008000;"&gt;// feature is scoped at Site, so the parent is type SPSite rather than SPWeb&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;            &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; (SPSite site = properties.Feature.Parent &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; SPSite)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;            {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;                SPWeb currentWeb = FindCurrentWeb(properties);&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;                &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; (currentWeb)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;                {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    &lt;span style="color:#008000;"&gt;// find the subweb to add the column&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0pxfont-family:consolas, 'Courier New', courier, monospace;font-size:8pt;color:black;"   &gt;                    SPWeb mySubWeb = currentWeb.Webs[&lt;span style="color:#006080;"&gt;"SubWebUrl"&lt;/span&gt;];&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    &lt;span style="color:#008000;"&gt;// find the source list&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    SPList sourceList = mySubWeb.Lists[&lt;span style="color:#006080;"&gt;"SourceListName"&lt;/span&gt;];&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    &lt;span style="color:#008000;"&gt;// build the lookup column&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    CreateLookupColumn(&lt;span style="color:#006080;"&gt;"MyLookupColumnName"&lt;/span&gt;, &lt;span style="color:#006080;"&gt;"My Custom Group"&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;, mySubWeb, sourceList, &lt;span style="color:#006080;"&gt;"ColumnName"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;            }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FeatureDeactivating(SPFeatureReceiverProperties properties)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;            &lt;span style="color:#008000;"&gt;// feature is scoped at Site, so the parent is type SPSite rather than SPWeb&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;            &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; (SPSite site = properties.Feature.Parent &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; SPSite)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;            {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                SPWeb currentWeb = FindCurrentWeb(properties);&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; (currentWeb)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    SPFieldLookup lookupColumn = &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    &lt;span style="color:#008000;"&gt;// find the subweb to add the column&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    SPWeb mySubWeb = currentWeb.Webs[&lt;span style="color:#006080;"&gt;"SubWebUrl"&lt;/span&gt;];&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    &lt;span style="color:#008000;"&gt;// we don't care if there was an exception retrieving the field from the collection,&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    &lt;span style="color:#008000;"&gt;// since if it's not there we can't delete it anyway..&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; BORDER-TOP-STYLE: none; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px" color="black" size="8pt" face="consolas, 'Courier New', courier, monospace"&gt;                    &lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                        lookupColumn = mySubWeb.Fields[&lt;span style="color:#006080;"&gt;"MyLookupColumnName"&lt;/span&gt;] &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; PFieldLookup;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    &lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (ArgumentException argExc)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (lookupColumn != &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                        &lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                            lookupColumn.Delete();&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                        &lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (SPException SpExc)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                            &lt;span style="color:#0000ff;"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                    }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FeatureInstalled(SPFeatureReceiverProperties properties)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FeatureUninstalling(SPFeatureReceiverProperties properties)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; SPFieldLookup CreateLookupColumn(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; fieldName, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; group, &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; required,&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; allowMultipleValues, SPWeb thisWeb, SPList sourceList, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; lookupField)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            thisWeb.Fields.AddLookup(fieldName, sourceList.ID, sourceList.ParentWeb.ID, required);&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            SPFieldLookup lookup = thisWeb.Fields[fieldName] &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; SPFieldLookup;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            lookup.AllowMultipleValues = allowMultipleValues;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            lookup.LookupField = lookupField;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            lookup.Group = group;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            lookup.Update(&lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; lookup;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; SPWeb FindCurrentWeb(SPFeatureReceiverProperties properties)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            SPSite site = properties.Feature.Parent &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; SPSite;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            SPWeb currentWeb = &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            Guid rootWebId = Guid.Empty;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (site != &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                currentWeb = site.RootWeb;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                rootWebId = currentWeb.ID;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            {&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                currentWeb = properties.Feature.Parent &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; SPWeb;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;                rootWebId = currentWeb.Site.RootWeb.ID;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;            &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; currentWeb;&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt; &lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;        }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;    }&lt;/pre&gt;&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, 'Courier New', courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;p.s. &lt;a href="http://blogs.msdn.com/joshuag/archive/2008/03/14/add-sharepoint-lookup-column-declaratively-through-caml-xml.aspx"&gt;Josh Gaffey&lt;/a&gt; has a method that uses only CAML but only seems to work if the list is scoped at the root level. However, I could not duplicate it at all. And several other bloggers were unable to duplicate it as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-1104209557976302974?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/1104209557976302974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=1104209557976302974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1104209557976302974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/1104209557976302974'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/creating-lookup-columns-using-features.html' title='Creating Lookup Columns Using Features in SharePoint 2007'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-316409457563375225</id><published>2008-06-04T15:08:00.006-05:00</published><updated>2008-10-07T18:52:18.770-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Action'/><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Custom Actions for Specific Lists in SharePoint 2007</title><content type='html'>&lt;span style="font-family:arial;"&gt;Most of the posts I have seen regarding custom actions have been too simple for practical use. They will walk you thru the process of creating a "CustomAction" feature, but that action will then show up on all of your lists (example &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb418728.aspx"&gt;&lt;span style="font-family:arial;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;). &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/40076dc2-8be6-4019-bf1e-54067880e8a8/"&gt;This&lt;/a&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt; post was the first I found that points you in the right direction for creating custom actions that will only show up for the specific list(s) you want the action to be performed on.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The main catch is that you will need a custom List type with a unique type number and you can then hook the custom action to this list type via the RegistrationId.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-316409457563375225?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/316409457563375225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=316409457563375225' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/316409457563375225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/316409457563375225'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/most-of-posts-i-have-seen-regarding.html' title='Custom Actions for Specific Lists in SharePoint 2007'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-425245397857187894.post-2047587427902882057</id><published>2008-06-03T14:52:00.000-05:00</published><updated>2008-06-07T14:52:46.184-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><title type='text'>Content Type IDs</title><content type='html'>When the time comes for you to make a custom content type using features, this &lt;a href="http://msdn.microsoft.com/en-us/library/aa543822.aspx" target="_blank"&gt;link&lt;/a&gt; explains how to create a proper ID.   &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/425245397857187894-2047587427902882057?l=sharepoint.coultress.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sharepoint.coultress.com/feeds/2047587427902882057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=425245397857187894&amp;postID=2047587427902882057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2047587427902882057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/425245397857187894/posts/default/2047587427902882057'/><link rel='alternate' type='text/html' href='http://sharepoint.coultress.com/2008/06/content-type-ids.html' title='Content Type IDs'/><author><name>RustyC</name><uri>http://www.blogger.com/profile/13067282614795526059</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
