<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DkAGQXs9cSp7ImA9WhRUFUw.&quot;"><id>tag:blogger.com,1999:blog-20371103</id><updated>2012-01-25T10:05:20.569-08:00</updated><category term="Live SharePoint Sites" /><category term="Windows 2008 Server" /><category term="SharePoint Conference 2011 South East Asia" /><category term="My Sites" /><category term="Blog Recommendations" /><category term="General SharePoint (All Versions)" /><category term="javascript" /><category term="alerts" /><category term="SharePoint 2010 Installation" /><category term="debugging" /><category term="Accessibility" /><category term="BDC" /><category term="Tech Ed 2007" /><category term="Speaking engagements" /><category term="Service Pack" /><category term="PowerPivot" /><category term="events" /><category term="Personal Junk" /><category term="Enhanced Content Query Web Part" /><category term="SharePoint Foundation" /><category term="Content Query Web Part" /><category term="I found a bug" /><category term="Visual Studio 2010" /><category term="Training Courses" /><category term="Administration" /><category term="troubleshooting" /><category term="SharePoint User Groups" /><category term="Excel Services" /><category term="internet sites" /><category term="SharePoint Summit Toronto" /><category term="Audiences" /><category term="Event Handlers" /><category term="infrastructure update" /><category term="Thesaurus" /><category term="Begginer Guide" /><category term="Links" /><category term="Macro" /><category term="WTF" /><category term="Visual Studio 2010 Beta" /><category term="Video" /><category term="sharepoint 2010 book" /><category term="hardware" /><category term="Search Customization" /><category term="XSLT Data Views" /><category term="SharePoint Hierarchical Tasks" /><category term="Office 365" /><category term="Canberra User Group" /><category term="Nested Tasks Project" /><category term="Recommended SharePoint Products" /><category term="SharePoint 2007" /><category term="jQuery" /><category term="XSLT" /><category term="SharePoint How To Book" /><category term="Certification" /><category term="silverlight" /><category term="MVP Summit 2008" /><category term="Office" /><category term="SharePoint 2010 Beta" /><category term="SharePoint 2003" /><category term="Workflow" /><category term="CAML" /><category term="April Fools" /><category term="web services" /><category term="Web Part Development" /><category term="Search" /><category term="Windows 2008 R2 Server" /><category term="Office 2010" /><category term="Best Practices" /><category term="SharePoint Conference 2010 South East Asia" /><category term="SharePoint Product recommendation of the week" /><category term="Error Messages" /><category term="Open Source" /><category term="SharePoint Conference 2010 Australia" /><category term="Development" /><category term="site definitions" /><category term="sandboxed solutions" /><category term="Assembly" /><category term="Upgrade" /><category term="Features" /><category term="User Profiles" /><category term="Tech Ed 2008" /><category term="SharePoint Designer" /><category term="Free Web Parts" /><category term="Free Downloads" /><category term="Code Sample" /><category term="Datasheet View" /><category term="Databases" /><category term="Site Columns" /><category term="Custom fields" /><category term="Extelligent Design" /><category term="InfoPath" /><title>Sharepoint Tips And Tricks</title><subtitle type="html">Sharepoint Tips And Tricks is Ishai Sagi's sharepoint information blog. It specializes in Microsoft SharePoint technologies, including web parts, development, configuration, customization, and best practices for the use of Microsoft SharePoint Server and Windows SharePoint Services.
It also provides some related Office Information, including VSTO and VSTA and other office application development tips.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.sharepoint-tips.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>368</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/sharepoint-tips/ToIC" /><feedburner:info uri="sharepoint-tips/toic" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;Dk4ERH8yfyp7ImA9WhRVFkU.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-3694707852978026793</id><published>2012-01-15T19:35:00.000-08:00</published><updated>2012-01-15T19:35:05.197-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-15T19:35:05.197-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Event Handlers" /><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><category scheme="http://www.blogger.com/atom/ns#" term="events" /><title>The importance of synchronous event handlers</title><content type="html">&lt;p&gt;
In SharePoint, we can create list item event handlers (or receivers). I have written about this in the past, and even posted some code for setting the security automatically on a list item as it is created.&lt;br/&gt;Now, there is one thing I wanted to write about this topic. Event handlers can be defined as either Synchronous or Asynchronous - regardless of the event type. By default, events were always asynchronous if they had the "ed" suffix (ItemAdd&lt;b&gt;ed&lt;/b&gt;, ItemUpdat&lt;b&gt;ed&lt;/b&gt;), and synchronous if they had the "ing" suffix (ItemAdd&lt;b&gt;ing&lt;/b&gt;, ItemUpdat&lt;b&gt;ing&lt;/b&gt;). However, sometimes we want to run our code in an "ed" event, but have it synchronous (notice that the opposite is impossible have the "ing" properties to run asynchronously)- for example, when we want to modify item properties when its added, but before the user has been redirected to a new page. &lt;br/&gt;
A classic example is the upload of a document to a document library. The user gets prompted to browse for a file and clicks upload. The next page would be the properties page for the file that was uploaded. If we want to set some of the properties to be pre-filled for the user, we have to do that after the file has been uploaded - but we cannot do that in ItemAdding, as at that point we don't have access to the item - it wasn't created yet. In ItemAdded we can set values to the item - but by default this event is asynchronous - and sharepoint will show the user the properties dialog while the event is still happening in the background. The result is disastrous : the user sees the properties screen, clicks "Save" and gets an error telling him or her that the item has been modified by another process or user.&lt;/p&gt;&lt;p&gt;
To resolve this we use the "Synchronization" XML tag in the receiver's registration XML with the value set to "Synchronous" or, if the receiver is registered using server object model code, we set the "Synchronization" property of the receiver class to SPEventReceiverSynchronization.Synchronous. To quote MSDN: "Synchronous processing provides the ability to run the event in the same thread before sending the Web response back to the browser."
&lt;/p&gt;
&lt;p&gt;
As an example, lets create an event receiver that sets the title of a file to the file name, as the file is being uploaded. The code is simple:


&lt;!-- HTML generated using hilite.me --&gt;&lt;div style="background: #ffffff; overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"&gt;&lt;pre style="margin: 0; line-height: 125%"&gt;&lt;span style="color: #008000; font-weight: bold"&gt;public&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;override&lt;/span&gt; &lt;span style="color: #008000; font-weight: bold"&gt;void&lt;/span&gt; &lt;span style="color: #0060B0; font-weight: bold"&gt;ItemAdded&lt;/span&gt;(SPItemEventProperties properties)
       {
           &lt;span style="color: #008000; font-weight: bold"&gt;base&lt;/span&gt;.ItemAdded(properties);
           &lt;span style="color: #008000; font-weight: bold"&gt;if&lt;/span&gt; (properties.ListItem[&lt;span style="background-color: #fff0f0"&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;] == &lt;span style="color: #008000; font-weight: bold"&gt;null&lt;/span&gt;)
           {
               &lt;span style="color: #303090; font-weight: bold"&gt;int&lt;/span&gt; startingPoint = properties.AfterUrl.LastIndexOf(&lt;span style="background-color: #fff0f0"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;);
               properties.ListItem[&lt;span style="background-color: #fff0f0"&gt;&amp;quot;Title&amp;quot;&lt;/span&gt;] = properties.AfterUrl.Substring(startingPoint + &lt;span style="color: #6000E0; font-weight: bold"&gt;1&lt;/span&gt;);
               properties.ListItem.Update();
           }
       }
&lt;/pre&gt;&lt;/div&gt;
&lt;br/&gt;
Now, the XML that registers the receiver is :
&lt;!-- HTML generated using hilite.me --&gt;&lt;div style="background: #ffffff; overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"&gt;&lt;pre style="margin: 0; line-height: 125%"&gt;&lt;span style="color: #007000"&gt;&amp;lt;Receivers&lt;/span&gt; &lt;span style="color: #0000C0"&gt;ListTemplateId=&lt;/span&gt;&lt;span style="background-color: #fff0f0"&gt;&amp;quot;101&amp;quot;&lt;/span&gt;&lt;span style="color: #007000"&gt;&amp;gt;&lt;/span&gt;
      &lt;span style="color: #007000"&gt;&amp;lt;Receiver&amp;gt;&lt;/span&gt;
        &lt;span style="color: #007000"&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;SetTitleFromFileNameItemAdding&lt;span style="color: #007000"&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
        &lt;span style="color: #007000"&gt;&amp;lt;Type&amp;gt;&lt;/span&gt;ItemAdded&lt;span style="color: #007000"&gt;&amp;lt;/Type&amp;gt;&lt;/span&gt;
        &lt;span style="color: #007000"&gt;&amp;lt;Assembly&amp;gt;&lt;/span&gt;$SharePoint.Project.AssemblyFullName$&lt;span style="color: #007000"&gt;&amp;lt;/Assembly&amp;gt;&lt;/span&gt;
        &lt;span style="color: #007000"&gt;&amp;lt;Class&amp;gt;&lt;/span&gt;DocumentTitleSetter.SetTitleFromFileName.SetTitleFromFileName&lt;span style="color: #007000"&gt;&amp;lt;/Class&amp;gt;&lt;/span&gt;
        &lt;span style="color: #007000"&gt;&amp;lt;SequenceNumber&amp;gt;&lt;/span&gt;10000&lt;span style="color: #007000"&gt;&amp;lt;/SequenceNumber&amp;gt;&lt;/span&gt;
        &lt;span style="color: #007000"&gt;&amp;lt;Synchronization&amp;gt;&lt;/span&gt;Synchronous&lt;span style="color: #007000"&gt;&amp;lt;/Synchronization&amp;gt;&lt;/span&gt;
      &lt;span style="color: #007000"&gt;&amp;lt;/Receiver&amp;gt;&lt;/span&gt;

  &lt;span style="color: #007000"&gt;&amp;lt;/Receivers&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
Now, when uploading a file, the users are first asked for the file:&lt;br/&gt;

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-t9o8_zVA7ws/TxOXncKVi0I/AAAAAAAAEjo/cdyhLMgXKr4/s1600/uploading-before.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="237" width="400" src="http://4.bp.blogspot.com/-t9o8_zVA7ws/TxOXncKVi0I/AAAAAAAAEjo/cdyhLMgXKr4/s400/uploading-before.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;


And when they upload, they see the dialog allowing them to change the file's name, and by magic the title is already filled for them!&lt;br/&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-bAhFh2wXdik/TxOXnZUn7hI/AAAAAAAAEjw/SY_C_-UnnNs/s1600/uploading-after.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="243" width="400" src="http://2.bp.blogspot.com/-bAhFh2wXdik/TxOXnZUn7hI/AAAAAAAAEjw/SY_C_-UnnNs/s400/uploading-after.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/p&gt;
&lt;p&gt;
Where can this be useful? I can think of a very real world example: assigning a number to a document as it is being uploaded. The title setting event can be critical in some scenarios where we have lists with lookup columns to a document library - since the lookup column cannot show the file name column we need to show the title, which means we cannot have an empty title (in which scenario you will also want to set the title to unique, and add extra code to make sure the title you are setting is not unique - dont assume that because it is a copy of the file name there wont be duplicates - remember that users may edit both file names and titles!).
&lt;/p&gt;
&lt;p&gt;Just in case someone finds this useful, I am uploading the code, and the compiled solution package to my company's web site as a free, open source solution for anyone to use on their own risk. I have tested this to work with Office365 (SharePoint online) and as a farm solution - so enjoy!. You can find all my company's free code samples and solutions in our &lt;a href="http://www.extelligentdesign.com/Code%20Sample%20Downloads" target="_blank" title="Extelligent Design - Canberra Based SharePoint Consulting"&gt;document library on our web site&lt;/a&gt;. The specific files are: &lt;a title="Source code for event receiver by Extelligent Design - SharePoint experts in Canberra" href="http://www.extelligentdesign.com/Code%20Sample%20Downloads/DocumentTitleSetter.zip"&gt;[Source Code]&lt;/a&gt; and &lt;a title="Packaged free solution for event receiver by Extelligent Design - SharePoint experts in Canberra" href="http://www.extelligentdesign.com/Code%20Sample%20Downloads/DocumentTitleSetter.wsp"&gt;[Sandbox Ready Package]&lt;/a&gt;.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-3694707852978026793?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LnnbkkpEAQjiVlOH9C_Zf28aJZA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LnnbkkpEAQjiVlOH9C_Zf28aJZA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LnnbkkpEAQjiVlOH9C_Zf28aJZA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LnnbkkpEAQjiVlOH9C_Zf28aJZA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/81BLlNwGoTQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/3694707852978026793/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=3694707852978026793" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/3694707852978026793?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/3694707852978026793?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/81BLlNwGoTQ/importance-of-synchronous-event.html" title="The importance of synchronous event handlers" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-t9o8_zVA7ws/TxOXncKVi0I/AAAAAAAAEjo/cdyhLMgXKr4/s72-c/uploading-before.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2012/01/importance-of-synchronous-event.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YBRHs8eip7ImA9WhRSFEQ.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-7207639494308595056</id><published>2011-11-16T00:12:00.000-08:00</published><updated>2011-11-16T16:52:35.572-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-16T16:52:35.572-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Event Handlers" /><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><title>Event handler to archive items when deleted</title><content type="html">&lt;p&gt;A person just asked this on a mailing list I am on, so I thought I'd share this code. The requirement - copy a list item that is deleted to an archive list. The solution - event receiver that copies the item. The code below does the job, but again is only a sample - you still need to implement error handling, and there are hard coded variables there you will want to change. &lt;br/&gt;
Note: this code is specifically for list items, not for documents in document libraries. You can easily change the code to support documents as well (see the CopyAttachments function for an example on how to copy files).
&lt;/p&gt;
&lt;p&gt;

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ItemDeleting(SPItemEventProperties properties)
       {
           &lt;span class="rem"&gt;//note: may require permission elevation.&lt;/span&gt;
           &lt;span class="rem"&gt;//TODO: add error handling&lt;/span&gt;

           &lt;span class="rem"&gt;//get the item being deleted&lt;/span&gt;
           SPListItem item = properties.ListItem;
           &lt;span class="rem"&gt;//get the target list&lt;/span&gt;
           SPList targetList = properties.Web.Lists[&lt;span class="str"&gt;"Announcements Archive"&lt;/span&gt;];
           &lt;span class="rem"&gt;//create the new item&lt;/span&gt;
           SPListItem newItem = targetList.Items.Add();
           &lt;span class="rem"&gt;//copy the list item to the target&lt;/span&gt;
           &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (SPField f &lt;span class="kwrd"&gt;in&lt;/span&gt; item.Fields)
           {
                &lt;span class="kwrd"&gt;if&lt;/span&gt; (!f.ReadOnlyField &amp;amp;&amp;amp; newItem.Fields.ContainsField(f.InternalName))
                    newItem[newItem.Fields.GetFieldByInternalName(f.InternalName).Id] = item[f.Id];   
           }
           &lt;span class="rem"&gt;//copy "special" read only fields that can be written to&lt;/span&gt;
           newItem[&lt;span class="str"&gt;"Created By"&lt;/span&gt;] = item[&lt;span class="str"&gt;"Created By"&lt;/span&gt;];
           newItem[&lt;span class="str"&gt;"Modified By"&lt;/span&gt;] = item[&lt;span class="str"&gt;"Modified By"&lt;/span&gt;];
           newItem[&lt;span class="str"&gt;"Modified"&lt;/span&gt;] = item[&lt;span class="str"&gt;"Modified"&lt;/span&gt;];
           newItem[&lt;span class="str"&gt;"Created"&lt;/span&gt;] = item[&lt;span class="str"&gt;"Created"&lt;/span&gt;];
           newItem.SystemUpdate(&lt;span class="kwrd"&gt;false&lt;/span&gt;);
           CopyAttachments(item, newItem);
           &lt;span class="kwrd"&gt;base&lt;/span&gt;.ItemDeleting(properties);
       }&lt;/pre&gt;
&lt;br/&gt;
Note - for the "CopyAttachments" I used code that I published in the past: &lt;a href="http://www.sharepoint-tips.com/2008/11/how-to-copy-attachments-from-one-list.html"&gt;http://www.sharepoint-tips.com/2008/11/how-to-copy-attachments-from-one-list.html&lt;/a&gt;

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-7207639494308595056?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kikkzAkN9EiMxPHFiK89CSSCXH0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kikkzAkN9EiMxPHFiK89CSSCXH0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kikkzAkN9EiMxPHFiK89CSSCXH0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kikkzAkN9EiMxPHFiK89CSSCXH0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/cWV_s4H_oE0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/7207639494308595056/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=7207639494308595056" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7207639494308595056?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7207639494308595056?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/cWV_s4H_oE0/event-handler-to-archive-items-when.html" title="Event handler to archive items when deleted" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/11/event-handler-to-archive-items-when.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UAQ3k9eSp7ImA9WhRSFE8.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-4298855651651155099</id><published>2011-11-15T23:28:00.000-08:00</published><updated>2011-11-15T23:40:42.761-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-15T23:40:42.761-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Event Handlers" /><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><title>Setting item permissions for new items</title><content type="html">&lt;p&gt;A common question that I recently answered in a sharepoint conference is how to make a sharepoint list only show items to the users who wrote the items, and users specified in the item's properties.&lt;br/&gt;A good example of this is a task list where only the original creator of the task and the assignee can see and change the task. This is impossible to do in sharepoint out of the box, and that is where we, as developers, come in.
&lt;br/&gt;The way to do it is by developing a simple event handler and attaching it to the list. I prefer to attach to ItemAdded and ItemUpdated - put the exact same code in both events (so that people can reassign the task). The code sample below is a good starting point for you to figure out how to do this. The code sample assumes you know how to use visual studio to create a new event handler, and is meant only as a sample - it doesn't have error handling and it does have some hard coded values for a task list that you may want to change.&lt;br/&gt;

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ItemAdded(SPItemEventProperties properties)
        {
            &lt;span class="rem"&gt;//get the list item that was created&lt;/span&gt;
            SPListItem item = properties.ListItem;
            &lt;span class="rem"&gt;//get the author user who created the task&lt;/span&gt;
            SPFieldUserValue valAuthor = &lt;span class="kwrd"&gt;new&lt;/span&gt; SPFieldUserValue(properties.Web, item[&lt;span class="str"&gt;"Created By"&lt;/span&gt;].ToString());
            &lt;span class="rem"&gt;//get the "assigned to" user. Note - this will throw an error if the task is not assigned to anyone - implement error handling!&lt;/span&gt;
            SPFieldUserValue valAssignedTo = &lt;span class="kwrd"&gt;new&lt;/span&gt; SPFieldUserValue(properties.Web, item[&lt;span class="str"&gt;"Assigned To"&lt;/span&gt;].ToString());
            &lt;span class="rem"&gt;//disconnect the security from the list, and delete all permissions&lt;/span&gt;
            item.BreakRoleInheritance(&lt;span class="kwrd"&gt;false&lt;/span&gt;);
            &lt;span class="rem"&gt;//create the object that will hold the roles for the author user&lt;/span&gt;
            SPRoleAssignment authorRole = &lt;span class="kwrd"&gt;new&lt;/span&gt; SPRoleAssignment(valAuthor.User);
            &lt;span class="rem"&gt;//create the object that will hold the roles for the assigned to user&lt;/span&gt;
            SPRoleAssignment assignedToRoles = &lt;span class="kwrd"&gt;new&lt;/span&gt; SPRoleAssignment(valAssignedTo.User);

            &lt;span class="rem"&gt;//get the contribute role from the web. Alternatively use code to create a new role definition with custom permissions.&lt;/span&gt;
            SPWeb oWebsite = properties.Web;
            SPRoleDefinitionCollection collRoles = oWebsite.RoleDefinitions;
            SPRoleDefinition oRoleDefinition = collRoles[&lt;span class="str"&gt;"Contribute"&lt;/span&gt;];

            &lt;span class="rem"&gt;//assign permissions to task author&lt;/span&gt;
            authorRole.RoleDefinitionBindings.Add(oRoleDefinition);
            item.RoleAssignments.Add(authorRole);
            &lt;span class="rem"&gt;//assign permissions to task assignee&lt;/span&gt;
            assignedToRoles.RoleDefinitionBindings.Add(oRoleDefinition);
            item.RoleAssignments.Add(assignedToRoles);
            &lt;span class="rem"&gt;//update the item&lt;/span&gt;
            item.Update();
            &lt;span class="kwrd"&gt;base&lt;/span&gt;.ItemAdded(properties);
        }&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;
You can download the entire code sample as a visual studio project from my company's site's code samples document library at &lt;a href="http://www.extelligentdesign.com/Code%20Sample%20Downloads/Forms/AllItems.aspx" target="_blank" title="Extelligent Design SharePoint Code Samples"&gt;http://www.extelligentdesign.com/Code%20Sample%20Downloads/Forms/AllItems.aspx&lt;/a&gt;. You will want to change the project's properties to point to your local development site before debugging.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-4298855651651155099?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4gIz-_WqvrR75DHe8pfFtRLt21Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4gIz-_WqvrR75DHe8pfFtRLt21Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4gIz-_WqvrR75DHe8pfFtRLt21Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4gIz-_WqvrR75DHe8pfFtRLt21Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/InKYyvLT9iE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/4298855651651155099/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=4298855651651155099" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/4298855651651155099?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/4298855651651155099?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/InKYyvLT9iE/setting-item-permissions-for-new-items.html" title="Setting item permissions for new items" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/11/setting-item-permissions-for-new-items.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MNSXo-eip7ImA9WhdbF0k.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-7453884894561668592</id><published>2011-10-15T22:25:00.000-07:00</published><updated>2011-10-15T23:11:38.452-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-15T23:11:38.452-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Conference 2011 South East Asia" /><title>Speaking in the upcoming Asia conferences</title><content type="html">&lt;p&gt;
Next month I will be in both Singapore and Hong Kong for the Asian sharepoint conferences. If you are coming, why not jump in my session to learn about sharepoint development? Who knows, there may be prizes...
&lt;br/&gt;
&lt;a href="http://www.sharepointconference.asia/hk/2011/"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 400px;" src="http://3.bp.blogspot.com/-cyIubM05Cg8/Tpp1OF2KBVI/AAAAAAAAEY4/jJn1ijHkADk/s400/HKImSpeakingBadge.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5663968366319764818" /&gt;&lt;/a&gt;


&lt;br/&gt;

&lt;a href="http://www.sharepointconference.asia/SEA/2011"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 400px;" src="http://3.bp.blogspot.com/--iXW0bR6AeY/Tpp1N1YXdgI/AAAAAAAAEYs/CufKf4gnvnk/s400/SEAImSpeakingBadge.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5663968361899849218" /&gt;&lt;/a&gt;
&lt;br/&gt;

&lt;a href="http://www.sharepointconference.asia"&gt;http://www.sharepointconference.asia&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-7453884894561668592?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/F6XhoGvHrPBeQwFrPESwjD-2tLU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/F6XhoGvHrPBeQwFrPESwjD-2tLU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/F6XhoGvHrPBeQwFrPESwjD-2tLU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/F6XhoGvHrPBeQwFrPESwjD-2tLU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/0qgWM5Z41W8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/7453884894561668592/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=7453884894561668592" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7453884894561668592?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7453884894561668592?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/0qgWM5Z41W8/speaking-in-upcoming-asia-conferences.html" title="Speaking in the upcoming Asia conferences" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-cyIubM05Cg8/Tpp1OF2KBVI/AAAAAAAAEY4/jJn1ijHkADk/s72-c/HKImSpeakingBadge.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/10/speaking-in-upcoming-asia-conferences.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIHR3Yyfip7ImA9WhdbFk4.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-5389461743519577983</id><published>2011-10-14T00:08:00.000-07:00</published><updated>2011-10-14T16:22:16.896-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-14T16:22:16.896-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><category scheme="http://www.blogger.com/atom/ns#" term="Features" /><title>Setting the images for a publishing page from a module</title><content type="html">&lt;p&gt;Here is a small tip for developers (about time I wrote one again). What do you do if you want to provision a publishing page to a sharepoint site, and set the page's image (or rollup image) during the provisioning?
&lt;br/&gt;Well, step one should be obvious - make sure you upload the image you want to display. This can be done in the same feature or a seperate one. I will assume that you already know how do do that (if not, then the MSDN article "&lt;a href="http://msdn.microsoft.com/en-us/library/ms441170.aspx"&gt;how to provision a file&lt;/a&gt;" is your friend). The same goes for actually how to build the feature and module that uploads your publishing page (again, refer to the MSDN article, or better yet, see my friend Waldek's &lt;a href="http://blog.mastykarz.nl/provisioning-publishing-pages-features-declarative-markup/"&gt;article discussing just this&lt;/a&gt;).
&lt;br/&gt;
So what am I talking about? I want to focus on how to set two specific properties on the page - the page's image and the page's rollup image. These two are not regular properties, since they are publishing properties. They do not expect the same kind of value that regular image properties expect (which is the same as a hyperlink - first part is the link to the image, than a space and a comma and then the description of the image). With publishing fields you need to supply the actual HTML that will be shown as the image.
&lt;br/&gt;
Since this is done in the module, you will have to create a "Property" element in your "File" element in the module. The value of that property should be the HTML, but encoded so that the XML doesnt become invalid. The value (when not encoded) should look like this:
&lt;br/&gt;
&lt;br/&gt;&lt;font color='red'&gt;
&amp;lt;img alt='This is a picture of a chicken' src='/PublishingImages/chicken.jpg' style='border:0px solid;'&amp;gt;&lt;/font&gt;
&lt;br/&gt;
&lt;br/&gt;
And the entire property (with the value encoded) should look like this:
&lt;br/&gt;
&lt;br/&gt;&lt;font color='red'&gt;
&amp;lt;Property Name="PublishingRollupImage" Value="&amp;amp;lt;img alt='AFL peace Team at Whitten Oval' src='/newsandblog/PublishingImages/22-gal-tn.jpg' style='border:0px solid;'&amp;amp;gt;" /&amp;gt;&lt;/font&gt;
&lt;br/&gt;
&lt;br/&gt;
Hope that helps someone!


&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-5389461743519577983?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/WnomIkg8Fl58E_zpA8Whqnqyn4g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WnomIkg8Fl58E_zpA8Whqnqyn4g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/WnomIkg8Fl58E_zpA8Whqnqyn4g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WnomIkg8Fl58E_zpA8Whqnqyn4g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/FZFZ8YENIt8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/5389461743519577983/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=5389461743519577983" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/5389461743519577983?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/5389461743519577983?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/FZFZ8YENIt8/setting-images-for-publishing-page-from.html" title="Setting the images for a publishing page from a module" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/10/setting-images-for-publishing-page-from.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08ARH46cCp7ImA9WhdQEkU.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8329056260336027915</id><published>2011-08-13T19:26:00.000-07:00</published><updated>2011-08-13T19:44:05.018-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-13T19:44:05.018-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Office 365" /><title>Office 365 development</title><content type="html">&lt;p&gt;I am a bit excited about office 365. &lt;/p&gt;
&lt;p&gt;My company (&lt;a href="http://www.exd.com.au/" target="_blank"&gt;Extelligent Design&lt;/a&gt;) is now a 365 partner, and we aim to support clients implementing it. We want to help people set it up, understand how to use it (my book may come in handy, seeing as the end user interface to the sharepoint online is the same as regular sharepoint) and customise it.&lt;/p&gt;
&lt;p&gt;Customising is where the real challange begins. As you probably know, to develop for office 365, you can only use the sandbox - which limits what you can achieve in your customisations. I find that not being able to install application pages (pages that go to the _layouts folder) especially frustrating, and, like a fish out of the water for the first time in its life, I suddenly realise how much I tend to rely on having that resource.&lt;/p&gt;
&lt;p&gt;Ok, maybe the fish analogy is a bit much. I can still write web parts, and features with event receivers - not to mention list and library event receivers as well! But this is when I hit another wall - a lot of code I wrote in the past relied on me being able to run sections of the code with elevated privilages. This is gone if you develop a sandbox solution, and is very frustrating. Some obvious things that people will want to do in their hosted sharepoint site rely on code being able to run as other users. Workflows are a great example - having a user with permissions on list A enter data into that list, and then the workflow enters data into another list to which the user does not have permissions. Oh, wait, workflows are also not allowed in hosted sharepoint, so replace the word "workflow" with "event receiver" in the sentance above and you still get the same functionality, and you still hit a wall with not being able to write code that implements that requirement.&lt;/p&gt;
&lt;p&gt;PS - the security limitation is blocked for both usual methods of running in elevated privilages mode - you cannot use the security namespace (preveting you from using SPSecurity.RunWithElevatedPrivilages) and you cannot use the SPSite constructore - preventing you from loading a new SPSite object with the system user's token.&lt;/p&gt;
&lt;p&gt;So where does this leave us? Not all is doom and gloom - we can still write web parts and event handlers and features - as long as they are not too complex. This is great for deploying look and feel, features that implement site templates and more. I see a lot of developers now focusing on creating turn-key solutions that implement industry-specific templates for sites. Small businesses have a lot in common, and they are the real target of office 365 - so anyone who comes up with a feature that creates lists and libraries that solve a common problem for a small business may hit a jackpot similar to the mobile phone app developers.&lt;/p&gt;
&lt;p&gt;Finally, hosting companies that host office 365 may let you deploy code to the servers directly, allowing non-sandbox development to take place. I think this will be hardest to do, since those companies will be very afraid to change their environment from the microsoft default, but a strong partnership with such a company may be a great thing for a sharepoint developer. Come to think of it- if you ARE a hosting company that office 365 hosting and you want some value add to your clients - talk to me!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8329056260336027915?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RCDwslFuk02nTZGqc5gWeFhZm7Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RCDwslFuk02nTZGqc5gWeFhZm7Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RCDwslFuk02nTZGqc5gWeFhZm7Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RCDwslFuk02nTZGqc5gWeFhZm7Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/avSfwT2iRh4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8329056260336027915/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8329056260336027915" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8329056260336027915?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8329056260336027915?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/avSfwT2iRh4/office-365-development.html" title="Office 365 development" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/08/office-365-development.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkABSHc-fCp7ImA9WhdQEkU.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-2281890039634102114</id><published>2011-08-13T19:20:00.000-07:00</published><updated>2011-08-13T19:25:59.954-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-13T19:25:59.954-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Service Pack" /><category scheme="http://www.blogger.com/atom/ns#" term="Office 2010" /><title>Office 2010 SP1</title><content type="html">&lt;p&gt;Ok, this may not be a sharepoint post, but...&lt;/p&gt;
&lt;p&gt;If you are like me, you have "Virtual Clone Drive" installed, allowing you to mount ISO files as virtual CDs (other virutal CD software is available).&lt;/p&gt;
&lt;p&gt;If you are like me, you do not have a physical CD drive in your laptop (having pulled it out and put a second SSD in instead).&lt;/p&gt;
&lt;p&gt;If you are like me, you are running office 2010.&lt;/p&gt;
&lt;p&gt;If you are like me, you always install whatever Windows Update tells you to install.&lt;/p&gt;
&lt;p&gt;So...if you are like me, then you have been unable to install service pack 1 of Office 2010, failing (of all things) on installing a sharepoint client component.&lt;/p&gt;
&lt;p&gt;The solution turns out to be simple - disable the virtual CD drive and then do the update. Some recommendations from Microsoft also suggests to put a DVD or CD in your physical CD drive while patching. Seems to be a bug in SP1. &lt;/p&gt;
&lt;p&gt;Lucky for us sharepoint people that the SharePoint SP1 doesnt have all these annoying installation bugs. Oh, wait...

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-2281890039634102114?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/quY8x0R16GK7QjukMVJpISpHt5A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/quY8x0R16GK7QjukMVJpISpHt5A/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/quY8x0R16GK7QjukMVJpISpHt5A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/quY8x0R16GK7QjukMVJpISpHt5A/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/39yd6iB6sqg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/2281890039634102114/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=2281890039634102114" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/2281890039634102114?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/2281890039634102114?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/39yd6iB6sqg/office-2010-sp1.html" title="Office 2010 SP1" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/08/office-2010-sp1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUDSXk9eCp7ImA9WhZSFk4.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8206419588126391480</id><published>2011-03-31T21:20:00.000-07:00</published><updated>2011-03-31T21:47:58.760-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-31T21:47:58.760-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="April Fools" /><title>A new methology for planning SharePoint Projects - how to win a tender</title><content type="html">&lt;p&gt;Today I want to discuss a methodology I have been working on for a while now.&lt;br/&gt;For the last ten years, when developing a solution architecture for clients, I have always stuck to the KISS principle. If you are unfamiliar with that one, it means "&lt;strong&gt;K&lt;/strong&gt;eep &lt;strong&gt;I&lt;/strong&gt;t &lt;strong&gt;S&lt;/strong&gt;imple, &lt;strong&gt;S&lt;/strong&gt;tupid!" - which is a good advice when you submit your solution to the review of your peers - other technical specialists and assorted IT professionals. A simple design usually wins through simplicity - it is easy to grasp, easy to implement and easy to maintain and expand on. By KISSing other technical people, you usually get the design you want approved. If you want to read more about KISS, see the wikipedia article about it: &lt;a href="http://en.wikipedia.org/wiki/KISS_principle"&gt;http://en.wikipedia.org/wiki/KISS_principle&lt;/a&gt;.

&lt;/p&gt;
&lt;p&gt;The problem I found with KISS is that when you pitch your design to other types of audience, for example upper management, it tends not to be accepted. Initially I thought it may be that management are less prone to like being called "stupid" (which is why I always phrased it "Keep it simple, silly!" - but that never improved things much), but the more I thought about it, I realised that those audiences just expect more out of a solution design than just simplicity.
&lt;br/&gt;&lt;strong&gt;In other words - KISSing the upper management is not enough.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This is why I decided to come up with my own new principle that extends KISS and adds the things that upper management really wants from a solution architect:
&lt;br/&gt;&lt;strong&gt;K&lt;/strong&gt;eep &lt;strong&gt;I&lt;/strong&gt;t &lt;strong&gt;S&lt;/strong&gt;imple, &lt;strong&gt;S&lt;/strong&gt;table, &lt;strong&gt;A&lt;/strong&gt;vailable, &lt;strong&gt;S&lt;/strong&gt;calable and &lt;strong&gt;S&lt;/strong&gt;ecure.
&lt;br/&gt;
By &lt;strong&gt;KISSASS&lt;/strong&gt;ing upper management, you are almost assured to get the project you are tendering for, or get your solution approved. I think KISSASS should be practiced - do not think you are ready to &lt;strong&gt;KISSASS &lt;/strong&gt;today - it does require a lot of experience - which is why more experienced professionals may get projects over others - they are much better &lt;strong&gt;KISSASS&lt;/strong&gt;ers.
&lt;/p&gt;
&lt;p&gt;
I intend to come up with some &lt;strong&gt;KISSASS &lt;/strong&gt;best practices, KISSASS guidelines and perhaps some flow charts explaining how you should practice KISSASS in other aspects of life. If you have some ideas - please share them with me in the comments for this post.&lt;br/&gt;
But in the meanwhile - &lt;strong&gt;have a great April&lt;/strong&gt;!
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8206419588126391480?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7qVn7E3qJskYI5JWbIppt0klfJU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7qVn7E3qJskYI5JWbIppt0klfJU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7qVn7E3qJskYI5JWbIppt0klfJU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7qVn7E3qJskYI5JWbIppt0klfJU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/acc9HwEHmQ4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8206419588126391480/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8206419588126391480" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8206419588126391480?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8206419588126391480?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/acc9HwEHmQ4/new-methology-for-planning-sharepoint.html" title="A new methology for planning SharePoint Projects - how to win a tender" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/03/new-methology-for-planning-sharepoint.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0EFQ3oyfCp7ImA9WhZTF0s.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-225467228916041868</id><published>2011-03-21T19:04:00.000-07:00</published><updated>2011-03-21T19:40:12.494-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-21T19:40:12.494-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Training Courses" /><title>SharePoint 2010 developer training - thoughts</title><content type="html">&lt;p&gt;
I spent the entire last week in Perth (Australia) delivering developer training to 5 students - and it was great. We covered the basic skills that every sharepoint developer must have, and we talked about what skills they should still learn after the course to enhance their skills. I feel this course (written by MVPs from all around the world, guided by my friend and fellow MVP Randy Williams from &lt;a href="http://www.synergyonline.com"&gt;www.synergyonline.com&lt;/a&gt;, is the best course material available to train SharePoint developers.
&lt;/p&gt;&lt;p&gt;Why? first, the labs are excellent - we only had one or two cases where the text in the lab (instructing the students) were slightly off. Synergy Online's quick reaction to fix and modify the labs to correct those typos is one of the reasons I love working with them.

&lt;br/&gt;
Next, there is the chapters themselves. In 2006, a SharePoint development course could be completed in 3 days or so. Today, it is impossible to teach all aspects of SharePoint development in a five day course. Since students are working people, and cannot spend two weeks learning everything, prioritization is most important, and Synergy Online did a great job figuring out what most developers need to know, and then balancing it so that even within a specific topic, if the topic is too long to teach in 2-3 hours, the class teaches enough for the students to know how to begin and to know they should look into more details when they are back at work before starting a project using those skills.
&lt;/p&gt;
&lt;p&gt;
The only recommendations that I have made to Synergy Online was to drop the Business Intelligence chapter, as while it is important for solution architects, it is less developer oriented, and a much more important chapter that should replace it would be custom field types. I also suggested that we include EditorParts in the web part chapter - at least one code sample so that students can carry on after the course knowing that this functionality is there.
&lt;/p&gt;
&lt;p&gt;
My very favorite thing about training is to tell students about real life scenarios that I had with the technology. For example, in the chapter about querying sharepoint data (comparing SPQuery, SPLinq, and more), I can tell about projects that I had where I built web parts that aggregated sharepoint data, and even open the source code for a web part I have developed in the past and run through the code. This way the students get to see more complex examples of what they see in the lab, and I can even give "best practice" advice about things like error logging and error handling in web parts - as a side note. &lt;br/&gt;I feel this adds so much value to the course...maybe I should be asking for tips at the end of the week?
&lt;/p&gt;
&lt;p&gt;
Next month I am delivering the same course again, this time in Canberra (my home town). If you are seeking developer training and can take a week to be tought by myself - register now at the &lt;a href="http://www.ddls.com.au/VendCourseDet/MS/117/SYG10DEV.htm"&gt;Dimension Data&lt;/a&gt; web site (make sure you choose "Canberra" as location - the other locations are not courses that I am teaching. If you cannot make it to Canberra, by all means register to one of the other ones - the other Syngery trainers are highly professional and knowlegeable - for example, Eric Cheng is a fantastic trainer and I enjoyed teaching with him in the past).
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-225467228916041868?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vCL2QjHls_OqvmJjI0sCTyxBsA0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vCL2QjHls_OqvmJjI0sCTyxBsA0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vCL2QjHls_OqvmJjI0sCTyxBsA0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vCL2QjHls_OqvmJjI0sCTyxBsA0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/Dx2EhjY5gO4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/225467228916041868/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=225467228916041868" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/225467228916041868?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/225467228916041868?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/Dx2EhjY5gO4/sharepoint-2010-developer-training.html" title="SharePoint 2010 developer training - thoughts" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/03/sharepoint-2010-developer-training.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEMNQnk9fyp7ImA9Wx9WGEk.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8234372856291573845</id><published>2011-01-23T20:44:00.001-08:00</published><updated>2011-01-23T21:21:33.767-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-23T21:21:33.767-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><category scheme="http://www.blogger.com/atom/ns#" term="Audiences" /><title>Setting Target Audiences with code</title><content type="html">&lt;p&gt;
If you search the web you will find many articles explaining how to set audiences on web parts (also on list items). Most are curious - explaining that you need to specify the IDs of the audiences, separated by colons, and then four semi colons to finish it.
&lt;/p&gt;
&lt;p&gt;
Really? four semi colons at the end without any explanation why? I just had to investigate.
&lt;br/&gt;
It turns out that the four semi colons have a use. The syntax of the "target to" audience field type is as follows:
&lt;br/&gt;
    &lt;span style="background-color: #FFAA99;"&gt;[Guid Ids separated by comma]&lt;/span&gt;&lt;strong&gt;;;&lt;/strong&gt;&lt;span style="background-color: #FFBB50;"&gt;[Active directory groups' LDAP paths separated by line breaks]&lt;/span&gt;&lt;strong&gt;;;&lt;/strong&gt;&lt;span style="background-color: #FFFF10;"&gt;[SharePoint security group names separated by commas]&lt;/span&gt;
&lt;br/&gt;
&lt;br/&gt;
For example:&lt;br/&gt;&lt;span style="background-color: #FFAA99;"&gt;decd0c08-4649-4e61-a8d6-8fdf5e4017ad,decd0c08-4649-4e61-a8d6-8fdf5e4017ad&lt;/span&gt;&lt;strong&gt;;;&lt;/strong&gt;&lt;span style="background-color: #FFBB50;"&gt;CN=SecGroup,CN=Users,DC=Development,DC=Local&lt;br/&gt;
CN=samplegroup1,CN=Users,DC=Development,DC=Local&lt;/span&gt;&lt;strong&gt;;;&lt;/strong&gt;&lt;span style="background-color: #FFFF10;"&gt;Admin Office, Authors&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
So
    if you only have global (user profile) audiences, the value will be guids 
    followed by four semi colons (because the values of the other type of audiences 
    are blank). If you only choose security\distribution lists then you will have 
    two semi colons before them, and two after. If you chose only sharepoint groups 
    you will get 4 semi colons before the group names.&lt;/p&gt;

    &lt;p&gt;
        To make things simpler for me, I wrote a small class to create a value for me, or to parse it out for me. Here is the code:&lt;/p&gt;


        &lt;p&gt;
        
        &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; AudienceFieldValue
    {
        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// A list of the IDs of the sharepoint global audiences (the one defined in the user profile database, accessible with  Microsoft.Office.Server.Audience.AudienceManager&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Guid&amp;gt; GlobalAudienceIds;
        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// A list of sharepoint security groups&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; SharePointSecurityGroupNames;
        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// A list of active directory LDAP paths (CN=SecGroup,CN=Users,DC=Development,DC=Local) pointing to security groups or distribution lists&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; DirectoryGroupsOrDistListLDAPPaths;

        &lt;span class="kwrd"&gt;public&lt;/span&gt; AudienceFieldValue()
        {
            GlobalAudienceIds = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Guid&amp;gt;();
            SharePointSecurityGroupNames = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();
            DirectoryGroupsOrDistListLDAPPaths = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();
        }
        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// Use this constructor if you have a value from an existing item and you want to parse it. &lt;/span&gt;
        &lt;span class="rem"&gt;/// You can even join values from more than one item seperated by semi colons. &lt;/span&gt;
        &lt;span class="rem"&gt;/// For example: AudienceFieldValue val = new AudienceFieldValue(item1["Target Audiences"].toString() +;"+ item1["Target Audiences"].toString())&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;param name="value"&amp;gt;The value of a "audience target to" column from a SPListItem (or more than one, seperated by semi colons)&amp;lt;/param&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; AudienceFieldValue(&lt;span class="kwrd"&gt;string&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;) 
        {
            GlobalAudienceIds = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Guid&amp;gt;();
            SharePointSecurityGroupNames = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();
            DirectoryGroupsOrDistListLDAPPaths = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();
            &lt;span class="kwrd"&gt;string&lt;/span&gt;[] arrTargets = &lt;span class="kwrd"&gt;value&lt;/span&gt;.Split(&lt;span class="str"&gt;";"&lt;/span&gt;.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; audienceGroup &lt;span class="kwrd"&gt;in&lt;/span&gt; arrTargets)
            {
                &lt;span class="kwrd"&gt;if&lt;/span&gt; (audienceGroup.Contains(&lt;span class="str"&gt;"CN="&lt;/span&gt;))
                {
                    &lt;span class="rem"&gt;//it is one or more AD groups (CN) split by line breaks&lt;/span&gt;
                    &lt;span class="kwrd"&gt;string&lt;/span&gt;[] adgroups = audienceGroup.Split(&lt;span class="str"&gt;'\n'&lt;/span&gt;);
                    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; audienceCN &lt;span class="kwrd"&gt;in&lt;/span&gt; adgroups)
                    {
                        DirectoryGroupsOrDistListLDAPPaths.Add(audienceCN);
                    }
                }
                &lt;span class="kwrd"&gt;else&lt;/span&gt;
                {
                    &lt;span class="kwrd"&gt;string&lt;/span&gt;[] arrAudiences = audienceGroup.Split(&lt;span class="str"&gt;','&lt;/span&gt;);
                    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; audienceName &lt;span class="kwrd"&gt;in&lt;/span&gt; arrAudiences)
                    {
                        &lt;span class="kwrd"&gt;try&lt;/span&gt;
                        {
                            Guid g = &lt;span class="kwrd"&gt;new&lt;/span&gt; Guid(audienceName);
                            GlobalAudienceIds.Add(g);
                        }
                        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)
                        {
                            &lt;span class="rem"&gt;//its not a guid - so it is a local sharepoint security group&lt;/span&gt;
                            SharePointSecurityGroupNames.Add(audienceName);
                        }
                    }
                }
            }
        }


        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// Get the value that you can set to a list item's target audience field&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;A string value containing all the IDs specified in a format that sharepoint understands&amp;lt;/returns&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ToString()
        {
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (GlobalAudienceIds.Count == 0 &amp;amp;&amp;amp; SharePointSecurityGroupNames.Count == 0 &amp;amp;&amp;amp; DirectoryGroupsOrDistListLDAPPaths.Count == 0)
            {
                &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;""&lt;/span&gt;;
            }
            &lt;span class="kwrd"&gt;else&lt;/span&gt;
            {
                StringBuilder result = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder();
                &lt;span class="rem"&gt;//first add any global audiences&lt;/span&gt;
                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Guid id &lt;span class="kwrd"&gt;in&lt;/span&gt; GlobalAudienceIds)
                {
                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (result.Length &amp;gt; 0)
                        result.Append(&lt;span class="str"&gt;","&lt;/span&gt;);
                    result.Append(id.ToString());
                }
                &lt;span class="rem"&gt;//must add two semi colons to seperate even if there is nothing after&lt;/span&gt;
                result.Append(&lt;span class="str"&gt;";;"&lt;/span&gt;);
                &lt;span class="rem"&gt;//add any directory group path, seperated by a line break&lt;/span&gt;
                &lt;span class="kwrd"&gt;bool&lt;/span&gt; addedDirGroup = &lt;span class="kwrd"&gt;false&lt;/span&gt;;
                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; directoryGroupPath &lt;span class="kwrd"&gt;in&lt;/span&gt; DirectoryGroupsOrDistListLDAPPaths)
                {
                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (addedDirGroup)
                        result.Append(&lt;span class="str"&gt;"\n"&lt;/span&gt;);
                    result.Append(directoryGroupPath);
                    addedDirGroup = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
                }
                &lt;span class="rem"&gt;//must add two semi colons to seperate even if there is nothing after&lt;/span&gt;
                result.Append(&lt;span class="str"&gt;";;"&lt;/span&gt;);
                &lt;span class="rem"&gt;//add any sharepoint group names seperated by commas&lt;/span&gt;
                &lt;span class="kwrd"&gt;bool&lt;/span&gt; addedSPGroup = &lt;span class="kwrd"&gt;false&lt;/span&gt;;
                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; spGroupName &lt;span class="kwrd"&gt;in&lt;/span&gt; SharePointSecurityGroupNames)
                {
                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (addedSPGroup)
                        result.Append(&lt;span class="str"&gt;","&lt;/span&gt;);
                    result.Append(spGroupName);
                    addedSPGroup = &lt;span class="kwrd"&gt;true&lt;/span&gt;;
                }

                &lt;span class="kwrd"&gt;return&lt;/span&gt; result.ToString();
            }
        }
    }&lt;/pre&gt;
        &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8234372856291573845?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zWNndsR0ZW3wtRVYWgM7WgZ7Lyk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zWNndsR0ZW3wtRVYWgM7WgZ7Lyk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zWNndsR0ZW3wtRVYWgM7WgZ7Lyk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zWNndsR0ZW3wtRVYWgM7WgZ7Lyk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/q_MukSaPDAI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8234372856291573845/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8234372856291573845" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8234372856291573845?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8234372856291573845?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/q_MukSaPDAI/setting-target-audiences-with-code.html" title="Setting Target Audiences with code" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/01/setting-target-audiences-with-code.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEADQno9eCp7ImA9Wx9WFEw.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8063050090463685751</id><published>2011-01-18T20:50:00.000-08:00</published><updated>2011-01-18T20:52:53.460-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-18T20:52:53.460-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><title>Creating static and dynamin menus in the Site Actions menu</title><content type="html">&lt;p&gt;I am presenting tonight in the Canberra SharePoint User Group (and will show the code again in the upcoming Australian SharePoint Conference) about adding actions to the site actions menu. Instead of writing all I have to say, I will just share the source code with your - trusting that you will understand the difference between the two methods I am showing (static and dynamic). Enjoy!&lt;br/&gt;
Source code can be downloaded from:&lt;br/&gt;
&lt;a title="MenuActions.zip" href="http://www.extelligentdesign.com/Code%20Sample%20Downloads/MenuActions.zip" target="_blank"&gt;MenuActions.zip&lt;/a&gt;

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8063050090463685751?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/bhquHW7H_uwBF-jHRDfWKeKTNWU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bhquHW7H_uwBF-jHRDfWKeKTNWU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/bhquHW7H_uwBF-jHRDfWKeKTNWU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bhquHW7H_uwBF-jHRDfWKeKTNWU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/lONXGDqHTdQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8063050090463685751/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8063050090463685751" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8063050090463685751?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8063050090463685751?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/lONXGDqHTdQ/creating-static-and-dynamin-menus-in.html" title="Creating static and dynamin menus in the Site Actions menu" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/01/creating-static-and-dynamin-menus-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EARno8cCp7ImA9Wx9XFEs.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8430680843968490757</id><published>2011-01-07T21:42:00.001-08:00</published><updated>2011-01-07T21:47:27.478-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-07T21:47:27.478-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio 2010" /><title>Adding Modules or Elements to a VS2010 SharePoint project</title><content type="html">&lt;p&gt;If you encounter the error "The Project Item "[Item Name]" cannot be deployed through a Feature with Farm scope." when you are deploying a Visual Studio 2010 SharePoint project, the problem may be that you have done what I have just done - try to force the wrong item type to deploy...
&lt;br/&gt;Let me explain: Lets say you want to add a custom action - something that can be deployed as a farm feature. But by mistake you added a project item of type "Module" instead of "Empty Element". You think to yourself - I can just clear the module, and add the custom action instead in the XML. The intellisense definitly supports it.&lt;br/&gt;
Well, it turns out that Visual Studio remembers that you added the XML as a module, and even if you edit out the module instructions, it will not let you deploy the feature as a farm feature, since modules are not supported at the farm scope.&lt;br/&gt;
The solution? delete your module, and add an empty element. 

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8430680843968490757?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/yTikKdkbO641cyR3xGHgmWAeNHA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yTikKdkbO641cyR3xGHgmWAeNHA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/yTikKdkbO641cyR3xGHgmWAeNHA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yTikKdkbO641cyR3xGHgmWAeNHA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/ZHPkh9VdCpg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8430680843968490757/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8430680843968490757" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8430680843968490757?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8430680843968490757?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/ZHPkh9VdCpg/adding-modules-or-elements-to-vs2010.html" title="Adding Modules or Elements to a VS2010 SharePoint project" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2011/01/adding-modules-or-elements-to-vs2010.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8MR38-fSp7ImA9Wx9QEEU.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-3661273187570962963</id><published>2010-12-22T21:00:00.000-08:00</published><updated>2010-12-22T21:08:06.155-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-22T21:08:06.155-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><category scheme="http://www.blogger.com/atom/ns#" term="Best Practices" /><title>Controls not showing the value you choose after submitting</title><content type="html">&lt;p&gt;A quick one before I forget to post about it - common issue when developing a web control (mostly EditorParts these days, or web parts that do not have an ASCX) is that the user chooses values for the text boxes and dropdownd and other controls, click the submit button, but the value in the function that deals with the button click (or the ApplyChanges function in an editorpart) doesnt get the value the user chose. Instead, the value is the old value.&lt;br/&gt;
There are several possible things that can cause this (I covered some in a previous article about common mistakes) but one that is so obviously simple that I forget to make sure of is this:&lt;br/&gt;
Make sure "&lt;em&gt;base.CreateChildControls();&lt;/em&gt;" is the first thing called in the "&lt;em&gt;CreateChildControls&lt;/em&gt;" function.
&lt;br/&gt;If that doesnt work, read my &lt;a href="http://www.sharepoint-tips.com/2007/03/server-side-controls-and-data-binding.html"&gt;previous article about the web part life cycle&lt;/a&gt;.

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-3661273187570962963?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/V1yV8Jw7sre4nnNDIDwdAo9sOZg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V1yV8Jw7sre4nnNDIDwdAo9sOZg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/V1yV8Jw7sre4nnNDIDwdAo9sOZg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V1yV8Jw7sre4nnNDIDwdAo9sOZg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/DpSKdxS6m38" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/3661273187570962963/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=3661273187570962963" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/3661273187570962963?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/3661273187570962963?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/DpSKdxS6m38/controls-not-showing-value-you-choose.html" title="Controls not showing the value you choose after submitting" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/12/controls-not-showing-value-you-choose.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEHQns5eCp7ImA9Wx9QEEo.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8473228678388281432</id><published>2010-12-22T18:39:00.000-08:00</published><updated>2010-12-22T19:23:53.520-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-22T19:23:53.520-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><category scheme="http://www.blogger.com/atom/ns#" term="sandboxed solutions" /><title>Sandbox solutions and the publishing image field type</title><content type="html">&lt;p&gt;I recently found out (to my horror) that sandbox solutions do not support (among many other things) the publishing field types. For example, if you want to use the "LinkFieldValue" class from the Microsoft.SharePoint.Publishing.Fields namespace in a sandbox solution, then you are out of luck.

So far, fair enough - annoying, but fair. I figured that I can overcome this by not using that class to parse the details of the image from publishing pages, and I will write my own function that will tease out the image URL from the string that the field returns.&lt;/p&gt;&lt;p&gt;How naive am I!&lt;/p&gt;&lt;p&gt;When I tried running this:
&lt;em&gt;imageUrl = item[field.Internalname);&lt;/em&gt;&lt;/p&gt;&lt;p&gt;The code would time out, and not return anything. The entire page would just hang. No exception thrown or any reason given.&lt;/p&gt;&lt;p&gt;My solution was to use:
&lt;em&gt;imageUrl = item.GetFormattedValue(field.InternalName);&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Apparently this gets the string value without trying to go through anything that is not supported in sandboxed solutions.

Update: after a bit of more trial and error I found that the exception thrown (sometimes) is that the assembly (the publishing one) is not serialiazble:&lt;br/&gt;
'item[this.ImgFieldName]' threw an exception of type 'System.Runtime.Serialization.SerializationException'
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8473228678388281432?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wgpWEMjSW4nk0yn8LQUKsZJQhDc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wgpWEMjSW4nk0yn8LQUKsZJQhDc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wgpWEMjSW4nk0yn8LQUKsZJQhDc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wgpWEMjSW4nk0yn8LQUKsZJQhDc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/BYPYbNA-nBo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8473228678388281432/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8473228678388281432" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8473228678388281432?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8473228678388281432?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/BYPYbNA-nBo/sandbox-solutions-and-publishing-image.html" title="Sandbox solutions and the publishing image field type" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/12/sandbox-solutions-and-publishing-image.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcNRXc6eip7ImA9Wx9REk0.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-2378390346702937432</id><published>2010-12-12T16:52:00.000-08:00</published><updated>2010-12-12T17:01:34.912-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-12T17:01:34.912-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><category scheme="http://www.blogger.com/atom/ns#" term="I found a bug" /><category scheme="http://www.blogger.com/atom/ns#" term="Error Messages" /><title>"Cannot complete this action." error when adding a field to a list (or a content type)</title><content type="html">&lt;p&gt;If you are trying to add a site column to a list, or a content type that has a site column to a list, and get the dreaded "Cannot complete this action.", then have a read below. Note - this is valid for both sharepoint 2007 and 2010.
&lt;/p&gt;
&lt;p&gt;
To troubleshoot this, I turned off the custom errors to see the entire stack trace of the error. The error was thrown by the Microsoft.SharePoint.Library.SPRequest.AddField function. This lead me to read &lt;a href="http://www.entwicklungsgedanken.de/2008/07/20/cannot-complete-this-action-error-when-adding-a-contenttype-to-a-list/"&gt;Eric's blog post about the error&lt;/a&gt; and he pointed me in the right direction.
&lt;/p&gt;
&lt;p&gt;It turns out that a lookup column that allows multiple selection is not supported as an indexed column. You'd expect SharePoint to validate that, and indeed you do not get that option when configuring such a column using the user interface. &lt;br/&gt;
&lt;b&gt;However&lt;/b&gt; - sharepoint does not validate that when you create the site column using CAML (which is what Eric did) or using code (which is what I did).

&lt;/p&gt;
&lt;p&gt;Eric's blog post shows how you can recreate and resolve the problem if you are creating the column using XML. So just in case you are making the same mistake I was doing, this is how I resolved my issue - I just make sure none of my code-created lookup columns is both multi select AND indexed, as you can see in the code below.
&lt;pre&gt;
SPFieldLookup newField = web.Fields.GetFieldByInternalName(newColumnInternalName) as SPFieldLookup;
newField.Title = "My Lookup";
newField.AllowMultipleValues = isMultiSelect;
newField.Group = "My Site Columns";
&lt;div style="background:yellow"&gt;
if (!isMultiSelect)
     newField.Indexed = true;
else
     newField.Indexed = false;
&lt;/div&gt;
newField.LookupField = myList.Fields["Title"].InternalName;
newField.Update();
&lt;/pre&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-2378390346702937432?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/W6RpjbbFoNJKNK44BbM9v3E87VU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W6RpjbbFoNJKNK44BbM9v3E87VU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/W6RpjbbFoNJKNK44BbM9v3E87VU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W6RpjbbFoNJKNK44BbM9v3E87VU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/FqGhBU-n2rA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/2378390346702937432/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=2378390346702937432" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/2378390346702937432?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/2378390346702937432?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/FqGhBU-n2rA/cannot-complete-this-action-error-when.html" title="&quot;Cannot complete this action.&quot; error when adding a field to a list (or a content type)" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/12/cannot-complete-this-action-error-when.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYNRX49cCp7ImA9Wx9TE0U.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-76587553119830945</id><published>2010-11-21T16:28:00.000-08:00</published><updated>2010-11-21T16:36:34.068-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-21T16:36:34.068-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Development" /><category scheme="http://www.blogger.com/atom/ns#" term="Error Messages" /><title>The Web application at ... could not be found when creating a new SPSite object</title><content type="html">&lt;p&gt;A quick hint for anyone hitting this issue - you are trying to open a SPSite object using a URL and hitting the following error: "&lt;i&gt;The Web application at [...] could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.&lt;/i&gt;" is common, and can have several causes.

&lt;/p&gt;
&lt;p&gt;
&lt;ol&gt;
&lt;li&gt;The obvious: The URL does not exist on the farm. Solution: change the URL you are loading to the correct one.&lt;/li&gt;
&lt;li&gt;The not so obvious: the code is in a console or windows application which you are now running with an account that does not have permissions to connect to the SQL server. Solution: either run the application as a different user or grant the user permissions on the SQL database.&lt;/li&gt;
&lt;li&gt;The one hiding behind the sofa: the code is in a console or windows application that is compiled with platform target x86, while your SharePoint server is x64. Solution: set the platform target to "Any CPU".
&lt;/li&gt;

&lt;/ol&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-76587553119830945?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rauM-6tlZUPJ4xIs7dP5qkvzr4w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rauM-6tlZUPJ4xIs7dP5qkvzr4w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rauM-6tlZUPJ4xIs7dP5qkvzr4w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rauM-6tlZUPJ4xIs7dP5qkvzr4w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/4wZazC-WD0k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/76587553119830945/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=76587553119830945" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/76587553119830945?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/76587553119830945?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/4wZazC-WD0k/web-application-at-could-not-be-found.html" title="The Web application at ... could not be found when creating a new SPSite object" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/11/web-application-at-could-not-be-found.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08ERn4ycSp7ImA9Wx5UFU4.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8937570958235696598</id><published>2010-10-19T17:42:00.000-07:00</published><updated>2010-10-19T17:50:07.099-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-19T17:50:07.099-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Summit Toronto" /><category scheme="http://www.blogger.com/atom/ns#" term="Speaking engagements" /><title>Coming to Canada's SharePoint Summit</title><content type="html">&lt;p&gt;Hello to all my Canadian readers!

&lt;/p&gt;
&lt;p&gt;
I am excited to announce that I will be speaking in the upcoming &lt;a href="http://www.sharepointsummit2011.com/Toronto" target="_blank"&gt;Toronto SharePoint Summit&lt;/a&gt;!&lt;br/&gt;And not just speaking - from the looks of it I seem to be doing the most speaking of all the other speakers (I guess the organizers figured that the cost of a plane ticket from Australia needs to be covered by three sessions). Please come see me talk on:
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.sharepointsummit2011.com/Toronto/conference_day1.htm#session_1_2" target="_blank"&gt;Introduction to SharePoint Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.sharepointsummit2011.com/Toronto/conference_day2.htm#session_5_0"  target="_blank"&gt;Empower your users - lessons learned in the past 9 years of utilizing SharePoint&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.sharepointsummit2011.com/Toronto/conference_day2.htm#session_7_2" target="_blank"&gt;Developing Web Parts for SharePoint 2010&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

Oh - and if anyone has recommendations what to do the week before the conference (last week of January) - please comment here! Ski resorts recommendations would be most welcome.

&lt;img style="cursor:pointer; cursor:hand;width: 175px; height: 75px;" src="http://2.bp.blogspot.com/_ZLr3wvXiUTE/TL48ZVYQMsI/AAAAAAAAEJs/Va20Pi4NgjY/s400/IshaiSagi_toronto.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5529923798390813378" /&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8937570958235696598?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MQDKfMKWx5zKQFVyBaQ1vMpw2TA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MQDKfMKWx5zKQFVyBaQ1vMpw2TA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MQDKfMKWx5zKQFVyBaQ1vMpw2TA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MQDKfMKWx5zKQFVyBaQ1vMpw2TA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/XKqtLhpGNaY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8937570958235696598/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8937570958235696598" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8937570958235696598?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8937570958235696598?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/XKqtLhpGNaY/coming-to-canadas-sharepoint-summit.html" title="Coming to Canada's SharePoint Summit" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_ZLr3wvXiUTE/TL48ZVYQMsI/AAAAAAAAEJs/Va20Pi4NgjY/s72-c/IshaiSagi_toronto.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/10/coming-to-canadas-sharepoint-summit.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUDQHs_cCp7ImA9Wx5UEkQ.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-878053115091141292</id><published>2010-10-16T21:56:00.000-07:00</published><updated>2010-10-16T22:27:51.548-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-16T22:27:51.548-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Canberra User Group" /><category scheme="http://www.blogger.com/atom/ns#" term="PowerPivot" /><title>PowerPivot For SharePoint</title><content type="html">&lt;p&gt;
Are you in Canberra this week? even if not, you may want to read this post. &lt;/p&gt;
&lt;p&gt;
This week I am presenting in the &lt;a href="http://www.sharepointusers.org.au/canberra" target="_blank"&gt;Canberra SharePoint User Group&lt;/a&gt; about PowerPivot for SharePoint. I have spent the weekend reading and testing this application - mostly trying to figure out how it is different from Excel Services. 
&lt;/p&gt;
&lt;p&gt;
Basically, powerpivot for excel is a powerfull database analysis add on to excel that creates connections to external databases, analyses the relationships for you and allows you to create great pivot tables and charts from this relational external data. This makes creating pivot tables from complex databases very simple. 
&lt;/p&gt;
&lt;p&gt;PowerPivot for SharePoint is a service application that you install from SQL2008R2 features. This adds the ability to open the workbooks that were created by powerpivot on the browser, &lt;strong&gt;while still remaining connected to the external database&lt;/strong&gt;. It also adds a "powerpivot gallery" list template that creates a special document library with a nice and smooth interface to allow the users to look for the pivot sheet they want to open, and it has the default "open in browser" behaviour. The data gets refreshed and accessed on the server, so even users with weak desktops can analyse huge databases (up to 100 million rows - depending on the amount of RAM the server has). A good high level overview can be found on &lt;a href="http://blogs.msdn.com/b/powerpivot/archive/2009/11/20/sharing-workbooks-using-powerpivot-gallery.aspx" target="_blank"&gt;the powerpivot blog on MSDN&lt;/a&gt;, installation instructions &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/ee210682.aspx"&gt;on MSDN&lt;/a&gt; and a demo and a lot of marketing information on &lt;a target="_blank" href="http://www.powerpivot.com/demo.aspx"&gt;the official powerpivot site&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Two thing you should know:&lt;br/&gt;to allow the web application to authenticate to the database the pivot is connected to, you will probably need to activate the "Claims to Windows Token Service" service (which is by default off if you used the configuration wizard to configure for you). Otherwise, the power pivot will keep giving you authentication errors.
&lt;br/&gt;The last thing is a problem with the way the powerpivot application is deployed. Don't ask me why, but there is a problem with how it is deployed, as described in this &lt;a href="http://powerpivotgeek.com/2010/01/20/could-not-load-type-microsoft-analysisservices-sharepoint-integration-reportgalleryview/" target="_blank"&gt;powerpivotgeek's blog post&lt;/a&gt;. If you get an error when opening a powerpivot gallery list, check out the geek's post for the solution (simply deploy the solution to the web application...).

&lt;/p&gt;
&lt;p&gt;
So, if you are in town, come say hello and watch me install, set up, and run powerpivot in the Canberra user group. If not, you have a chance to see me next week in the South East Asia SharePoint Conference in singapore.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-878053115091141292?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-GEBPkOPTmvjlAsLaEVvXyA7pvQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-GEBPkOPTmvjlAsLaEVvXyA7pvQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-GEBPkOPTmvjlAsLaEVvXyA7pvQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-GEBPkOPTmvjlAsLaEVvXyA7pvQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/OY3E1lbIRFs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/878053115091141292/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=878053115091141292" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/878053115091141292?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/878053115091141292?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/OY3E1lbIRFs/powerpivot-for-sharepoint.html" title="PowerPivot For SharePoint" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/10/powerpivot-for-sharepoint.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMNSHczcCp7ImA9Wx5RFk8.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-7166145278151726632</id><published>2010-08-23T21:27:00.000-07:00</published><updated>2010-08-23T21:34:59.988-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-23T21:34:59.988-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WTF" /><title>What do you get when you google "Visual studio 2010"?</title><content type="html">&lt;p&gt;I don't know about you, but my search engine of choice just gave me a big surprise as the first result. It only happens when you use google Australia (.com.au), not in google.com:&lt;br/&gt; 

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_ZLr3wvXiUTE/THNKyAnKsYI/AAAAAAAAEBI/2vbNlibae5g/s1600/vs2010googleresults.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 205px;" src="http://4.bp.blogspot.com/_ZLr3wvXiUTE/THNKyAnKsYI/AAAAAAAAEBI/2vbNlibae5g/s400/vs2010googleresults.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5508828992222441858" /&gt;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;
Am I imagining things, or is the first result a spam site? Microsoft - you may want to do something about this...
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-7166145278151726632?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IUKpWJL2Dmn_rU0aJeOvL8Oexns/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IUKpWJL2Dmn_rU0aJeOvL8Oexns/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IUKpWJL2Dmn_rU0aJeOvL8Oexns/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IUKpWJL2Dmn_rU0aJeOvL8Oexns/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/A9AcMlAPDjM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/7166145278151726632/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=7166145278151726632" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7166145278151726632?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7166145278151726632?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/A9AcMlAPDjM/what-do-you-get-when-you-google-visual.html" title="What do you get when you google &quot;Visual studio 2010&quot;?" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_ZLr3wvXiUTE/THNKyAnKsYI/AAAAAAAAEBI/2vbNlibae5g/s72-c/vs2010googleresults.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/08/what-do-you-get-when-you-google-visual.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIMR38ycCp7ImA9Wx5RFU8.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-6245466662488171851</id><published>2010-08-22T17:08:00.000-07:00</published><updated>2010-08-22T17:49:46.198-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-22T17:49:46.198-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="sharepoint 2010 book" /><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint How To Book" /><title>My SharePoint 2010 How To book is now available in print</title><content type="html">&lt;p&gt;
My second book is now officially published and I can stop fretting about revisions for a while. If you like, take a look at it in Amazon, where you can take a look inside!&lt;br/&gt;
&lt;a href="http://tinyurl.com/SP2010HowTo"&gt;SharePoint 2010 How To (Amazon)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
If you want to buy either of my books, (paper or digital copy), you can use the following links:

&lt;iframe src="http://rcm.amazon.com/e/cm?t=extelldesign-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=067233335X&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;
&lt;iframe src="http://rcm.amazon.com/e/cm?t=extelldesign-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=0672330504&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"&gt;&lt;/iframe&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-6245466662488171851?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wftZy3pyjJ6_2vIWvSB0EZ_TTWo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wftZy3pyjJ6_2vIWvSB0EZ_TTWo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wftZy3pyjJ6_2vIWvSB0EZ_TTWo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wftZy3pyjJ6_2vIWvSB0EZ_TTWo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/thGYnsFXhWU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/6245466662488171851/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=6245466662488171851" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/6245466662488171851?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/6245466662488171851?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/thGYnsFXhWU/my-sharepoint-2010-how-to-book-is-now.html" title="My SharePoint 2010 How To book is now available in print" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/08/my-sharepoint-2010-how-to-book-is-now.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkAERHk_fSp7ImA9Wx5SFks.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-8809784172871405157</id><published>2010-08-12T18:53:00.000-07:00</published><updated>2010-08-12T18:58:25.745-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-12T18:58:25.745-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Sample" /><category scheme="http://www.blogger.com/atom/ns#" term="Begginer Guide" /><title>How to set values for a checkbox choice list field? (SPFieldMultiChoice)</title><content type="html">&lt;p&gt;This is a question I just recieved through my "contact" form for this blog. The person (Chris) who asked the question gave a wrong email address, so I will post the answer publicly since I believe this can help other starting sharepoint developers - especially since I saw some wrong tips coming up in google when you search for it. So here is the right way to do it.
&lt;/p&gt;
&lt;p&gt;Question: "Hi, thanks a mil for those snippets!One question: I'm trying to programatically add selected items of a checkBoxList to a SPListItem, but am not sure in what format it wants it. i.e I've added all items as you suggested - newItem["Name"] = "blah" etc, but when it comes to the field that requires the selected checkboxlist values, I'm stuck."
&lt;/p&gt;
&lt;p&gt;
Answer: to set the value for a check box choice list (a field of type choice, with multiple choices allowed - showing checkboxes), you should use the SPFieldMultiChoiceValue class to set the value. This class allows you to construct the list of choices you want to set for the column by adding the string values to it. Here is an example on how to use it:
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
SPList sampleList =web.Lists["test"];
&lt;strong&gt;SPFieldMultiChoiceValue &lt;/strong&gt;val = new &lt;strong&gt;SPFieldMultiChoiceValue&lt;/strong&gt;();
val.Add("choice1");
val.Add("choice3");
SPListItem newItem = sampleList.Items.Add();
newItem["Title"] = "This is the new item";
newItem["test"] = val;
newItem.Update();
&lt;/pre&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-8809784172871405157?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/aG4SloXPtR5hYoVP-iFc-E2CiuI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aG4SloXPtR5hYoVP-iFc-E2CiuI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/aG4SloXPtR5hYoVP-iFc-E2CiuI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aG4SloXPtR5hYoVP-iFc-E2CiuI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/4ZIzzTgb-SI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/8809784172871405157/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=8809784172871405157" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8809784172871405157?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/8809784172871405157?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/4ZIzzTgb-SI/how-to-set-values-for-checkbox-choice.html" title="How to set values for a checkbox choice list field? (SPFieldMultiChoice)" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/08/how-to-set-values-for-checkbox-choice.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8AQX4-fyp7ImA9Wx5TGUU.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-7590386967625045476</id><published>2010-08-04T22:22:00.000-07:00</published><updated>2010-08-04T22:40:40.057-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-04T22:40:40.057-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Web Part Development" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery" /><title>Using jQuery validation in a sharepoint web part</title><content type="html">&lt;p&gt;
As we all know, a sharepoint page can only have one &amp;lt;form &amp;gt; tag in it. As anyone who wanted to use &lt;a href="http://docs.jquery.com/Plugins/Validation"&gt;jQuery validation&lt;/a&gt; knows, the validation script needs to run on a form tag.&lt;br/&gt;So how do I use the validation code in a sharepoint web part?
&lt;/p&gt;
&lt;p&gt;
The answer is to run the script against the form that already exists in the page. For example, I had to write a web part with an email address field, and wanted to help the users by validating the text they entered is a valid email address on the client side (I also validate on the server side - just in case someone is running a browser with no script). This is the "Render" override code that I used:
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
       txtEmailAddress1.CssClass = "required email";
       base.Render(writer);
       if (SPContext.Current.FormContext.FormMode != Microsoft.SharePoint.WebControls.SPControlMode.Edit)
       {
              writer.Write(@"&amp;lt;script&amp;gt;
$().ready(function() {
    $(""#" + this.Page.Form.ClientID + @""").validate();
});
&amp;lt;/script&amp;gt;
");
       }
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;As you can see, I am adding a css class of type "required email" for the text box, and then telling the form &lt;span style="font-weight:bold;"&gt;on the page&lt;/span&gt; to validate using the jquery validation plug in.  This of course assumes you added the references to the jquery scripts to the page...which you may want to do as part of the web part (override oninit, and registerclientscriptblock) or as part of the master page (if you expect a lot of web parts to use it).
&lt;/p&gt;
&lt;p&gt;As for the "if (SPContext.Current.FormContext.FormMode != Microsoft.SharePoint.WebControls.SPControlMode.Edit)" line - you have to be careful that your validation does not prevent you from editing the page. For example, if you remove that "if", you will not be able to change the properties of any web part on the page without first entering a valid email address in the textbox!
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-7590386967625045476?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/K4bXtw-V4LqEe2uCMaxLpFKqaUA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K4bXtw-V4LqEe2uCMaxLpFKqaUA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/K4bXtw-V4LqEe2uCMaxLpFKqaUA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K4bXtw-V4LqEe2uCMaxLpFKqaUA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/QO1ixUwAmdQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/7590386967625045476/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=7590386967625045476" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7590386967625045476?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/7590386967625045476?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/QO1ixUwAmdQ/using-jquery-validation-in-sharepoint.html" title="Using jQuery validation in a sharepoint web part" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/08/using-jquery-validation-in-sharepoint.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IAQXw5eyp7ImA9Wx5REE0.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-1872440751226971229</id><published>2010-08-04T16:16:00.000-07:00</published><updated>2010-08-16T17:39:00.223-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-16T17:39:00.223-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Conference 2010 South East Asia" /><title>I am speaking at the South East Asia SharePoint Conference!</title><content type="html">&lt;p&gt;Are you planning to be in Singapore on October 26-27 this year? You should! the speakers are being announced, and I for one will be there for at least one presentation - how to build web parts for 2010. And no, it is not going to be the regular "open visual studio, choose the web part project" presentation...get ready for big things!&lt;br/&gt;
See you there!
&lt;/p&gt;
&lt;p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.sharepointconference.asia" title="The South East Asia Conference Site"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 399px;" src="http://1.bp.blogspot.com/_ZLr3wvXiUTE/TFn1r7LCgZI/AAAAAAAAEAg/p-LJcKOiDuQ/s400/speaking+south+east+asia+spc.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5501698554776945042" /&gt;&lt;/a&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-1872440751226971229?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xhNV2Vj2pJGN5KNWxaOyDxX1L34/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xhNV2Vj2pJGN5KNWxaOyDxX1L34/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xhNV2Vj2pJGN5KNWxaOyDxX1L34/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xhNV2Vj2pJGN5KNWxaOyDxX1L34/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/RGe1soTFGNQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/1872440751226971229/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=1872440751226971229" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/1872440751226971229?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/1872440751226971229?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/RGe1soTFGNQ/i-am-speaking-at-south-east-asia.html" title="I am speaking at the South East Asia SharePoint Conference!" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_ZLr3wvXiUTE/TFn1r7LCgZI/AAAAAAAAEAg/p-LJcKOiDuQ/s72-c/speaking+south+east+asia+spc.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/08/i-am-speaking-at-south-east-asia.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08NRH07eSp7ImA9Wx5TFk8.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-4567788222047077304</id><published>2010-07-31T19:26:00.000-07:00</published><updated>2010-07-31T19:31:35.301-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-31T19:31:35.301-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Custom fields" /><title>A bit more about custom field types and XSL</title><content type="html">&lt;p&gt;The following are the attributes you can use in XSL to identify the field you want to change (or access the value of):
&lt;ul&gt;&lt;li&gt;Name (example: "First_x0020_Column" - the internal name of the column - not the field type!)&lt;/li&gt;&lt;li&gt;Type (example: "Text" - the base type of the field type)&lt;/li&gt;&lt;li&gt;FieldType (example: "MyCustomFieldType" - the type name of the custom field)&lt;/li&gt;&lt;li&gt;DisplayName (example: "First Column" - the title of the column&lt;/li&gt;&lt;li&gt;ID (example: "1b858cea-4306-4cf9-91e8-8bb8674dcdf4" - the GUID for the current column&lt;/li&gt;&lt;/ul&gt;

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-4567788222047077304?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7Pg9lDgzK4cdM9-9MOxfGdu2v7Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7Pg9lDgzK4cdM9-9MOxfGdu2v7Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7Pg9lDgzK4cdM9-9MOxfGdu2v7Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7Pg9lDgzK4cdM9-9MOxfGdu2v7Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/itQdN7RbDC4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/4567788222047077304/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=4567788222047077304" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/4567788222047077304?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/4567788222047077304?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/itQdN7RbDC4/bit-more-about-custom-field-types-and.html" title="A bit more about custom field types and XSL" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/07/bit-more-about-custom-field-types-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IESHY_eCp7ImA9Wx5TFk8.&quot;"><id>tag:blogger.com,1999:blog-20371103.post-2896983845705936335</id><published>2010-07-31T19:17:00.000-07:00</published><updated>2010-07-31T19:25:09.840-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-31T19:25:09.840-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Custom fields" /><title>Applying a XSL stylesheet to a custom field</title><content type="html">&lt;p&gt;
In the &lt;a href="http://msdn.microsoft.com/en-us/library/bb861799.aspx"&gt;MSDN walkthrough&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/ff606773.aspx"&gt;examples&lt;/a&gt; on using XSL to create a custom rendering style for a custom field type, the sample XSL all use the field's name as the reference. This is a bit silly - since it means the users need to create the new fields with the exact same name. 
&lt;/p&gt;&lt;p&gt;While the option to create a custom rendering based on the field name is welcome and will be very useful (if for example I am deploying a column to a farm and I want it to have a unique rendering template), the articles do not explain how to create a XSL rendering template for a field type - regardless of what the fields created from that type are called.
&lt;/p&gt;&lt;p&gt;
The solution is simple. Lets say your field type is "MyFieldType", then instead of the following line that uses the title of an instance of the field ("my field type"):
 &amp;lt;xsl:template match="FieldRef[@&lt;b&gt;Name&lt;/b&gt; = 'My Field Type']" mode="Text_body"&amp;gt;
use the following line instead, which uses the type name of the field:
 &amp;lt;xsl:template match="FieldRef[@&lt;b&gt;FieldType&lt;/b&gt; = 'MyFieldType']" mode="Text_body"&amp;gt;
  
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;p&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client="ca-pub-2727174828663024";
google_ad_width=468;
google_ad_height=60;
google_ad_format="468x60_as";
google_ad_type="text";
google_color_border="333333";
google_color_bg="940F04";
google_color_link="99C9FF";
google_color_url="99C9FF";
google_color_text="FFFFFF";
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;
&lt;/p&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/20371103-2896983845705936335?l=www.sharepoint-tips.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/EWja78I5bfzBkpFnoEXztGe3BfU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EWja78I5bfzBkpFnoEXztGe3BfU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/EWja78I5bfzBkpFnoEXztGe3BfU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EWja78I5bfzBkpFnoEXztGe3BfU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/sharepoint-tips/ToIC/~4/C4GNamt5SRk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.sharepoint-tips.com/feeds/2896983845705936335/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=20371103&amp;postID=2896983845705936335" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/2896983845705936335?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/20371103/posts/default/2896983845705936335?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/sharepoint-tips/ToIC/~3/C4GNamt5SRk/applying-xsl-stylesheet-to-custom-field.html" title="Applying a XSL stylesheet to a custom field" /><author><name>Ishai Sagi [SharePoint MVP]</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_ZLr3wvXiUTE/SkrVwRChguI/AAAAAAAAD0I/8anOhQDTJkw/S220/Ishai+-+hand+on+chin+normal.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.sharepoint-tips.com/2010/07/applying-xsl-stylesheet-to-custom-field.html</feedburner:origLink></entry></feed>

