<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5714440201609676844</id><updated>2012-01-27T12:23:22.765-08:00</updated><category term='WebServices'/><category term='Permissions'/><category term='CAML Query'/><category term='Search'/><category term='User Profiles'/><category term='SharePoint Customization'/><title type='text'>SharePoint Blog</title><subtitle type='html'>Few tips, tricks and how to on Microsoft SharePoint Server 2007 (MOSS). Sharing the new things i learnt while working on MOSS projects.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>40</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-1946578914756647879</id><published>2009-04-27T06:02:00.000-07:00</published><updated>2009-12-30T04:34:28.075-08:00</updated><title type='text'>Call SharePoint WebService using jQuery</title><content type='html'>jQuery is very popular JavaScript library,it is light, fast and makes javascript work lot lot easier. I was using this library for&lt;br /&gt;one of my ASP.Net project. Was just cusrious to know how this can be used to call SharePoint webservices. With jQuery you can call SharePoint webservice with couple of lines of code. Also jQuery makes XML utilization very easy. The sample code below shows how to traverse XML nodes which is returned by GetListItems method of Lists.asmx webservice. The XML returned by GetListItems method uses XML namespace, which cuases some problem while using jQuery. The technique used in sample below works fine on IE 6, i have not tried this on other browsers.&lt;br /&gt;&lt;br /&gt;In order to use jQuery APIs inside ShaerPoint page, you need to add the script file reference to your page. &lt;br /&gt;Following steps show you how to reference this library:&lt;br /&gt;1. Copy the jQuery javascript file to 12\Tempalte\Layout\1033 folder&lt;br /&gt;2. Edit your master page and add following script file reference&lt;br /&gt;&amp;lt;script type="text/javascript" language="javascript" src="/_layouts/1033/jquery-1.3.2.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;Following sample code reads document name from sharepoint document library (Shared Documents):&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript&amp;gt;&lt;br /&gt; $(document).ready(function() {&lt;br /&gt; var xmlData ="&amp;lt;soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/&lt;br /&gt;2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001&lt;br /&gt;/XMLSchema'&amp;gt;&amp;lt;soap:Body&amp;gt;&amp;lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&amp;gt;&amp;lt;listName&amp;gt;Shared Documents&amp;lt;/listName&amp;gt;&amp;lt;query&amp;gt;&amp;lt;Query &lt;br /&gt;  xmlns=''&amp;gt;&amp;lt;OrderBy&amp;gt;&amp;lt;FieldRef Name='Title' /&amp;gt;&amp;lt;/OrderBy&amp;gt;&amp;lt;/Query&amp;gt;&amp;lt;/query&amp;gt;&amp;lt;viewFields&amp;gt;&amp;lt;&lt;br /&gt;ViewFields xmlns=''  /&amp;gt;&amp;lt;/viewFields&amp;gt;&amp;lt;queryOptions&amp;gt;&amp;lt;QueryOptions xmlns='' /&amp;gt;&amp;lt;/queryOptions&amp;gt;&amp;lt;/GetListItems&amp;gt;&amp;lt;/soap:Body&amp;gt;&amp;lt;/soap:Envelope&amp;gt;";&lt;br /&gt;&lt;br /&gt; $.ajax({&lt;br /&gt;   url: "/_vti_bin/lists.asmx",&lt;br /&gt;   type: "POST",&lt;br /&gt;   dataType: "xml",&lt;br /&gt;   data: xmlData, &lt;br /&gt;   complete:SuccessFunc,&lt;br /&gt;   error: ErrorFunc,&lt;br /&gt;   contentType: "text/xml; charset=\"utf-8\""&lt;br /&gt;  });&lt;br /&gt;&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;function SuccessFunc(result) {&lt;br /&gt;//xml node with namespace need to be handled differently for jQuery&lt;br /&gt; $(result.responseXML).find("z\\:row").each(function() {&lt;br /&gt;    alert($(this).attr("ows_BaseName"));&lt;br /&gt;      });&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function ErrorFunc(result) {&lt;br /&gt;            alert(result.responseText);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: CodePlex has jQuery library for WSS Webservices. Refer this link: http://spservices.codeplex.com/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-1946578914756647879?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/1946578914756647879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=1946578914756647879' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1946578914756647879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1946578914756647879'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2009/04/call-sharepoint-webservice-using-jquery.html' title='Call SharePoint WebService using jQuery'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-2103442962292144732</id><published>2009-04-07T08:27:00.000-07:00</published><updated>2009-04-07T08:30:36.895-07:00</updated><title type='text'>Difference between SPWeb.Groups Vs SPWeb.SiteGroups</title><content type='html'>SPWeb has two sharepoint cross-site group collection, SPWeb.Groups and SPWeb.SiteGroups. SPWeb.Groups returns collection of cross-site groups which has some permission on the site. So if you add group from a site without any permission on the site, then this group wont appear in SPWeb.Groups collection, but it will appear in SPWeb.SiteGroups collection.&lt;br /&gt;You can not use SPWeb.Groups.Add method to add new cross-site group, you need to use SPWeb.SiteGroup.Add method for this purpose.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-2103442962292144732?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/2103442962292144732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=2103442962292144732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2103442962292144732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2103442962292144732'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2009/04/difference-between-spwebgroups-vs.html' title='Difference between SPWeb.Groups Vs SPWeb.SiteGroups'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-3934921858611286520</id><published>2009-03-29T02:48:00.000-07:00</published><updated>2009-03-29T03:07:11.049-07:00</updated><title type='text'>SharePoint Developer tools</title><content type='html'>If you are a serious SharePoint developer then you need to have set of tools which will assist you in increasing your productivity. SharePoint development needs understanding of various concepts like Features, Solutions, templates and site definitions etc. along with ASP.Net and WSS/MOSS SDKs. &lt;br /&gt;While working on various SharePoint projects i used several tools, these tools helped me lot in debugging and also reduced my coding time. I have listed set of tools that i used below:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;CAML Query builder&lt;/span&gt;&lt;br /&gt;I think this is one tool that all SharePoint developer will have. This tool helps you to build CAML queries, very handy tool for checking various CAML query elements&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Download Location: http://www.u2u.be/res/Tools/CamlQueryBuilder.aspx&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Visual Studio Extensions for WSS 3&lt;/span&gt;&lt;br /&gt;Tools for developing custom SharePoint applications: Visual Studio project templates for Web Parts, site definitions, and list definitions; and a stand-alone utility program, the SharePoint Solution Generator. This tool reduced lot of my packaging time. New VSeWSS 1.3 provides lot more features and also has support for x64.&lt;span style="font-style:italic;"&gt;&lt;br /&gt;Download Location (VSeWSS 1.3 for VS 2008): http://www.microsoft.com/downloads/details.aspx?FamilyID=B2C0B628-5CAB-48C1-8CAE-C34C1CCBDC0A&amp;displaylang=en&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Download Location (VSeWSS 1.5 for VS 2005, No support for x64):http://www.microsoft.com/downloads/details.aspx?familyid=7BF65B28-06E2-4E87-9BAD-086E32185E68&amp;displaylang=en&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Reflector&lt;/span&gt;&lt;br /&gt;No introduction required for this tool, very popular tool. .NET Reflector enables you to easily view, navigate, and search through, the class hierarchies of .NET assemblies. Use this tool to understand implementation of various SharePoint SDKs. &lt;br /&gt;&lt;span style="font-style:italic;"&gt;Download Location: http://www.red-gate.com/products/reflector/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Fiddler:&lt;/span&gt;&lt;br /&gt;This tool logs all http requests between client and web server. This saved lot of my time while resolving issues related to generating SSRS reports using SharePoint webservices. If you are consuming Webservice then this tool will be of great help.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Download Location: http://www.fiddler2.com/fiddler2/version.asp&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;IE Developer toolbar&lt;/span&gt;&lt;br /&gt;This is an add-on to IE 6 and 7, helps in debugging webpages. This is of great help when you are branding SharePoint site or developing custom webpart or controls. &lt;span style="font-style:italic;"&gt;Download Location: http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&amp;displaylang=en&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;MOSS Search Query Tool&lt;/span&gt;&lt;br /&gt;Tool to run MOSS search queries (Keyword or SQL)&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Download Location: http://www.wssdemo.com/Lists/Resources/DispForm.aspx?ID=893&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;WSP Builder&lt;/span&gt;&lt;br /&gt;A SharePoint Solution Package (WSP) creation tool for WSS 3.0 &amp; MOSS 2007&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Download Location: http://www.codeplex.com/wspbuilder&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-3934921858611286520?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/3934921858611286520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=3934921858611286520' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3934921858611286520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3934921858611286520'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2009/03/sharepoint-developer-tools.html' title='SharePoint Developer tools'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-7021134150241033060</id><published>2009-02-25T22:01:00.000-08:00</published><updated>2009-02-25T22:06:55.828-08:00</updated><title type='text'>SharePoint Document library size</title><content type='html'>SharePoint document library UI doesn't show the library size. SharePoint designer&lt;br /&gt;provides interface where you can view the document library size.&lt;br /&gt;To view doc library size:&lt;br /&gt;1) Open site from SharePoint designer&lt;br /&gt;2) Right click on document library tree node, and select&lt;br /&gt;properties menu item.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_b8vnd3hatKE/SaYwct7kF_I/AAAAAAAAAFU/6GIHBztTyHE/s1600-h/docsize1.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 272px; height: 267px;" src="http://3.bp.blogspot.com/_b8vnd3hatKE/SaYwct7kF_I/AAAAAAAAAFU/6GIHBztTyHE/s320/docsize1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5306982480826603506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This will open the properties window with document library size.&lt;br /&gt;&lt;br /&gt;You can also read the size programatically. StorageManagementInformation method of SPSite object can be used to read the library/list/document size of entire site collection.&lt;br /&gt;Following code shows how to read document library size:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;using (SPSite site = new SPSite("http://servername"))&lt;br /&gt;{&lt;br /&gt;       DataTable tbl;&lt;br /&gt;       tbl = site.StorageManagementInformation(&lt;br /&gt;       SPSite.StorageManagementInformationType.DocumentLibrary, &lt;br /&gt;       SPSite.StorageManagementSortOrder.Decreasing,&lt;br /&gt;       SPSite.StorageManagementSortedOn.Size, 100);&lt;br /&gt;       foreach (DataRow row in tbl.Rows)&lt;br /&gt;       {&lt;br /&gt;          foreach (DataColumn column in tbl.Columns)&lt;br /&gt;          MessageBox.Show("Doc Lib Name :" + row["Title"].ToString() + "  Size (bytes): " + row["Size"].ToString());&lt;br /&gt;       }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-7021134150241033060?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/7021134150241033060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=7021134150241033060' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7021134150241033060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7021134150241033060'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2009/02/sharepoint-document-library-size.html' title='SharePoint Document library size'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_b8vnd3hatKE/SaYwct7kF_I/AAAAAAAAAFU/6GIHBztTyHE/s72-c/docsize1.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-7843030162312199321</id><published>2009-01-20T21:26:00.000-08:00</published><updated>2009-02-09T20:33:51.880-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint Customization'/><title type='text'>Set Default date and time of  DateTime field</title><content type='html'>The built-in DateTime column allows you to set default date to current date. But this doesn't give an option to set time. By default time is set to 12:00AM.  &lt;br /&gt;Default time can be set to required time easily using calculated value. &lt;br /&gt;In the default value option select the "Calculated Value" and set the formula as :&lt;br /&gt;=Today+"09:00 AM"&lt;br /&gt;This will set the default date to current date and time to 9:00AM.&lt;br /&gt;Following diagram shows screen to configure this:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_b8vnd3hatKE/SXa0Zsg1PoI/AAAAAAAAAFM/wCB0mqI9dLA/s1600-h/datetimeset.GIF"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 260px;" src="http://4.bp.blogspot.com/_b8vnd3hatKE/SXa0Zsg1PoI/AAAAAAAAAFM/wCB0mqI9dLA/s320/datetimeset.GIF" border="0" alt=""id="BLOGGER_PHOTO_ID_5293616765559193218" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-7843030162312199321?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/7843030162312199321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=7843030162312199321' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7843030162312199321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7843030162312199321'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2009/01/set-default-date-time-to-datetime-field.html' title='Set Default date and time of  DateTime field'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_b8vnd3hatKE/SXa0Zsg1PoI/AAAAAAAAAFM/wCB0mqI9dLA/s72-c/datetimeset.GIF' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-4745808376324534365</id><published>2008-12-28T19:42:00.000-08:00</published><updated>2009-02-15T20:00:44.959-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Permissions'/><title type='text'>Assigning permission programatically</title><content type='html'>Windows SharePoint Services manages permissions through role definations. SPRoleDefinition and SPRoleDefinition classes provides methods to assign users to roles. Following code snippet shows how to assign the Contributor role to a custom SharePoint group programatically:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;using (SPSite site = new SPSite(siteCollection))&lt;br /&gt;{&lt;br /&gt;  using (SPWeb subWeb = site.OpenWeb(siteName))&lt;br /&gt;  {&lt;br /&gt;    //You need to break role inheritence if you want to assign unique permission to subsite&lt;br /&gt;    if (!subWeb.HasUniqueRoleAssignments)&lt;br /&gt;      subWeb.BreakRoleInheritance(true);&lt;br /&gt;    SPRoleDefinition roleDefination = parentWeb.RoleDefinitions["Contrubute"];&lt;br /&gt;    SPRoleAssignment roleAssignment = new SPRoleAssignment("MyCustomerGroup");&lt;br /&gt;    roleAssignment.RoleDefinitionBindings.Add(roleDefination);&lt;br /&gt;    subWeb.RoleAssignments.Add(roleAssignment);&lt;br /&gt;    subWeb.Update();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Users or Groups can be assigned permission to List or Document library or list item. Following code shows assigning permission on Folder of a document library for a custom sharepoint group:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;using (SPSite site = new SPSite(siteCollection))&lt;br /&gt;{&lt;br /&gt;  using (SPWeb web = site.OpenWeb(siteName))&lt;br /&gt;  {&lt;br /&gt;    SPDocumentLibrary docLib = (SPDocumentLibrary)web.Lists[libraryName];&lt;br /&gt;    //Get folder&lt;br /&gt;    SPListItem item = docLib.Folders[1];&lt;br /&gt;    if (!item.HasUniqueRoleAssignments)&lt;br /&gt;      item.BreakRoleInheritance(true);&lt;br /&gt;    SPRoleAssignment roleAssignment = new SPRoleAssignment(group);&lt;br /&gt;    SPRoleDefinition roleDefination = web.RoleDefinitions["Contribute"];&lt;br /&gt;    roleAssignment.RoleDefinitionBindings.Add(roleDefination);&lt;br /&gt;    item.RoleAssignments.Add(roleAssignment);&lt;br /&gt;    item.Update();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-4745808376324534365?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/4745808376324534365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=4745808376324534365' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4745808376324534365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4745808376324534365'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/12/sharepoint-assigning-permission.html' title='Assigning permission programatically'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-348971895046959372</id><published>2008-12-08T06:08:00.000-08:00</published><updated>2009-02-09T20:38:24.801-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint Customization'/><title type='text'>SharePoint Alert customization</title><content type='html'>Recently i was working on customizing SharePoint alerts. Sharing different things i learnt while working on this:&lt;br /&gt;You can create one or more alerts for a list or document library in a SharePoint site. When creating alerts you have option of what event and when to get notified. Alerts can be managed by Administrators or Users. SharePoint object model provides methods to manage Alerts programmatically.&lt;br /&gt;&lt;br /&gt;SPAlert class provides details on alert like alert frequency, alert type,user who created the alert. This class also provides a method to update alert details. Following code snippet shows &lt;span style="font-weight:bold;"&gt;how to create SharePoint Alert programmatically&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;     using (SPSite site = new SPSite("http://servername"))&lt;br /&gt;            {&lt;br /&gt;                using (SPWeb web = site.OpenWeb())&lt;br /&gt;                {&lt;br /&gt;                    SPUser user = web.SiteUsers["domain name\\username];&lt;br /&gt;                    SPAlert newAlert = user.Alerts.Add();&lt;br /&gt;                    newAlert.AlertType = SPAlertType.List;&lt;br /&gt;                    newAlert.List = web.Lists["List Name"];&lt;br /&gt;                    newAlert.EventType = SPEventType.All;&lt;br /&gt;                    newAlert.AlertFrequency = SPAlertFrequency.Immediate;&lt;br /&gt;                    //passing true to Update method will send alert confirmation mail&lt;br /&gt;                    newAlert.Update(false);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;SharePoint stores the alert information like web application URL and List URL in content database. Because of this, the links inside alert mail will break if web application URL or List URL is changed. To fix this user need to update the alert manually from alert manager or Administrator can run a script to update alerts. Refer &lt;a href="http://support.microsoft.com/default.aspx/kb/936760"&gt;this&lt;/a&gt; link for more details on this issue. &lt;br /&gt;&lt;br /&gt;Alert mails can be customized in two ways:&lt;br /&gt;Approach 1&lt;br /&gt;You can customize the Alert tempaltes of WSS. Alert tempaltes are located in &lt;br /&gt;"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\XML\AlertTemplates.xml"&lt;br /&gt;Following link has lot of details on this approach:&lt;br /&gt;http://blogs.msdn.com/sharepointdeveloperdocs/archive/2007/12/07/customizing-alert-notifications-and-alert-templates-in-windows-sharepoint-services-3-0.aspx&lt;br /&gt;&lt;br /&gt;Approach 2&lt;br /&gt;You can also customize alert mail format by implementing IAlertNotifyHandler interface. Following Microsoft KB article has details on this:&lt;br /&gt;http://support.microsoft.com/kb/948321/en-us&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;How to debug custom alert handlers&lt;/span&gt;&lt;br /&gt;Alerts are generated by WSS timer job. Time job reads the event log and sends the alert. So to debug custom alert handlers you need to attach timer process to debugger (OWSTIMER.exe). &lt;br /&gt;&lt;br /&gt;Though we can customize alert mail format, i dint find a way to customize the alert confirmation mail format.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-348971895046959372?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/348971895046959372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=348971895046959372' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/348971895046959372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/348971895046959372'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/12/sharepoint-alert-customization.html' title='SharePoint Alert customization'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-2839385774355549544</id><published>2008-10-13T03:25:00.000-07:00</published><updated>2010-05-26T00:23:57.455-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WebServices'/><title type='text'>Create/Delete Folders using Lists.asmx Web Service</title><content type='html'>Code snippet below creates or deletes folders from a document library using UpdateItems method of Lists web service. Sharing this so that someone will find this useful :)&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;//Create Folder name MyFolder inside a doc library MyLib&lt;br /&gt;//Reference to Lists.asmx proxy&lt;br /&gt;ListsWebService.Lists listWebService = new ListsWebService.Lists();&lt;br /&gt;string xmlCommand;&lt;br /&gt;XmlDocument doc = new XmlDocument();&lt;br /&gt;xmlCommand = "&amp;lt;Method ID='1' Cmd='New'&amp;gt;&amp;lt;Field Name='FSObjType'&amp;gt;1&amp;lt;/Field&amp;gt;&amp;lt;Field Name='BaseName'&amp;gt;MyFolder&amp;lt;/Field&amp;gt; &lt;br /&gt;&amp;lt;Field Name='ID'&amp;gt;New&amp;lt;/Field&amp;gt;&lt;br /&gt;&amp;lt;/Method&amp;gt;";&lt;br /&gt;XmlElement ele = doc.CreateElement("Batch");&lt;br /&gt;ele.SetAttribute("OnError", "Continue");&lt;br /&gt;ele.InnerXml = xmlCommand;&lt;br /&gt;listWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;&lt;br /&gt;XmlNode node1 = listWebService.UpdateListItems("MyLib", ele);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Delete MyFolder:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;ListsWebService.Lists listWebService = new ListsWebService.Lists();&lt;br /&gt;string xmlCommand;&lt;br /&gt;XmlDocument doc = new XmlDocument();&lt;br /&gt;&lt;br /&gt;//ID is the ID field value of MyFolder element&lt;br /&gt;xmlCommand = "&amp;lt;Method ID='1' Cmd='Delete' &amp;gt;&amp;lt;Field name='ID' &amp;gt;16&amp;lt;/Field&amp;gt;&amp;lt;Field name='FileRef' &amp;gt;MyLib/MyFolder&amp;lt;/Field&amp;gt;&amp;lt;/method&amp;gt;";&lt;br /&gt;XmlElement ele = doc.CreateElement("Batch");&lt;br /&gt;ele.SetAttribute("OnError", "Continue");&lt;br /&gt;ele.InnerXml = xmlCommand;&lt;br /&gt;listWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;&lt;br /&gt;XmlNode node1 = listWebService.UpdateListItems("MyLib", ele);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;UPDATE:&lt;br /&gt;If you want to create Folder using custom folder content type then you need to pass ContentType field to the xml batch. For example, if you have custom folder content type "SubFolder" is enabled for a document library, you can create folder based on this content type as follows:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;ListsWebService.Lists listWebService = new ListsWebService.Lists();&lt;br /&gt;string xmlCommand;&lt;br /&gt;XmlDocument doc = new XmlDocument();&lt;br /&gt;xmlCommand = "&amp;lt;Method ID='1' Cmd='New'&amp;gt;&amp;lt;Field Name='FSObjType'&amp;gt;1&amp;lt;/Field&amp;gt;&amp;lt;Field Name='ContentType'&amp;gt;SubFolder&amp;lt;/Field&amp;gt;&amp;lt;Field Name='BaseName'&amp;gt;MyFolder&amp;lt;/Field&amp;gt; &lt;br /&gt;&amp;lt;Field Name='ID'&amp;gt;New&amp;lt;/Field&amp;gt;&lt;br /&gt;&amp;lt;/Method&amp;gt;";&lt;br /&gt;XmlElement ele = doc.CreateElement("Batch");&lt;br /&gt;ele.SetAttribute("OnError", "Continue");&lt;br /&gt;ele.InnerXml = xmlCommand;&lt;br /&gt;listWebService.Credentials = System.Net.CredentialCache.DefaultCredentials;&lt;br /&gt;XmlNode node1 = listWebService.UpdateListItems("MyLib", ele);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-2839385774355549544?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/2839385774355549544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=2839385774355549544' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2839385774355549544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2839385774355549544'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/10/createdelete-folers-using-listsasmx-web.html' title='Create/Delete Folders using Lists.asmx Web Service'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-3734524371100135524</id><published>2008-09-23T06:34:00.000-07:00</published><updated>2009-02-09T20:35:06.594-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WebServices'/><title type='text'>How to Read/Update Items under List Folders using List WebService</title><content type='html'>To read list items under a folder of a list, you need to set the "Folder" query option. By setting this option you can read all items under a given folder. Following code shows how to read items under a folder:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;listService.Credentials= System.Net.CredentialCache.DefaultCredentials;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;XmlDocument xmlDoc = new System.Xml.XmlDocument();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;XmlNode nodeQueryOptions = &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    xmlDoc.CreateNode(XmlNodeType.Element,"QueryOptions","");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;nodeQueryOptions.InnerXml = "&amp;lt;Folder&amp;gt;/Lists/ListName/FolderName&amp;lt;/Folder&amp;gt;";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;XmlNode nodeResult = listService.GetListItems("ListName',null,null,null,null,nodeQueryOptions,null);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;MessageBox.Show(nodeResult.OuterXml);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To add new list item under a folder you need to set RootFolder attribute of batch statement. Following code shows how to add list item under a folder:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;listService.Credentials= System.Net.CredentialCache.DefaultCredentials;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;XmlDocument xmlDoc = new System.Xml.XmlDocument();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;XmlElement elementBatch = xmlDoc.CreateElement("Batch");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;elementBatch.SetAttribute("OnError","Continue");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;elementBatch.SetAttribute("RootFolder","/Lists/ListName/FolderName");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;elementBatch.InnerXml = "&lt;method id="'1'" cmd="'New'"&gt;&lt;field name="'Title'"&gt;Test Value&lt;/field&gt;&lt;/method&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;XmlNode nodeResult = listService.UpdateListItems("ListName",elementBatch);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-3734524371100135524?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/3734524371100135524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=3734524371100135524' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3734524371100135524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3734524371100135524'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/09/how-to-readupdate-items-under-list.html' title='How to Read/Update Items under List Folders using List WebService'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-5377829533690271072</id><published>2008-09-01T07:58:00.000-07:00</published><updated>2008-09-01T07:59:37.420-07:00</updated><title type='text'>UserContextFilterWebpart for filtering List items</title><content type='html'>UserContextFilterWebPart webpart comes handy when you have to filter your list items based on user profile properties. You can use any of the user profile properties to to filter list items. In one of our project we had to filter list items based on logged-in user's department. This can be done easaily usisng UserContextFilterWebpart.&lt;br /&gt;Add UserContextFilterWebpart to your webpart page, From webpart modify tool pane, select "SharePoint pfofile value for current user" option under Select Value to provide.&lt;br /&gt;Select Department property from the dropdownbox. Click ok.&lt;br /&gt;&lt;br /&gt;Now use the above filter in your listview webpart to filter items based on logged-in user department. Use the "Connection" menu to apply the filter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-5377829533690271072?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/5377829533690271072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=5377829533690271072' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/5377829533690271072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/5377829533690271072'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/09/usercontextfilterwebpart-for-filtering.html' title='UserContextFilterWebpart for filtering List items'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-2295761964859753715</id><published>2008-08-05T21:52:00.000-07:00</published><updated>2009-02-09T20:38:24.801-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint Customization'/><title type='text'>How to Hide List Column in Edit Mode</title><content type='html'>In some scenarios, you might want to avoid a list column update from Edit form. You can hide column appearing in Edit form by creating custom list defination for the list.&lt;br /&gt;For creating custom list defination you can refer following MSDN link:&lt;br /&gt;http://msdn.microsoft.com/en-us/library/ms466023.aspx&lt;br /&gt;&lt;br /&gt;Now to hide a column from Edit form, you need to update content types of your list schema. Following is steps to do this (Assuming you have created custom list defination, following the steps mentioned in above URL):&lt;br /&gt;1. Open schema.xml from your custom feature folder&lt;br /&gt;2. Locate ContentTypes XML node, under that locate the Field which you want to hide from Edit form, Set the ShowInEditForm value to FALSE.&lt;br /&gt;Following example hides thr Title column of custom list appearing in Edit form:&lt;br /&gt;&lt;br /&gt;&amp;lt;fieldref id="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" name="Title" required="TRUE" showinnewform="TRUE"&lt;span style="color: rgb(51, 51, 153); font-weight: bold;"&gt; showineditform="FALSE"&lt;/span&gt;/&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;fieldref id="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" name="Title" required="TRUE" showinnewform="TRUE" showineditform="FALSE"&gt;&lt;/fieldref&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-2295761964859753715?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/2295761964859753715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=2295761964859753715' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2295761964859753715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2295761964859753715'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/08/how-to-hide-list-column-in-edit-mode.html' title='How to Hide List Column in Edit Mode'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-94906377388600970</id><published>2008-07-24T08:13:00.000-07:00</published><updated>2008-07-24T08:14:21.490-07:00</updated><title type='text'>Redirecting to Access deined page</title><content type='html'>This post does reverse of my earlier post :). Sometimes you might want to redirect user to access deined page when your code attempts to access an object to which the user does not have access. SPUtility class provides method HandleAccessDenied, which redirects user to standard access denied page.&lt;br /&gt;Following code snippet shows how to use SPUtility.HandleAccessDened method:&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;  //your code&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;  SPUtility.HandleAccessDenied(ex);&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-94906377388600970?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/94906377388600970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=94906377388600970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/94906377388600970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/94906377388600970'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/07/redirecting-to-access-deined-page.html' title='Redirecting to Access deined page'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-267499675102262547</id><published>2008-07-23T04:36:00.000-07:00</published><updated>2008-07-23T04:38:05.805-07:00</updated><title type='text'>How to avoid Access denied page</title><content type='html'>Access deined exception is handled by sharepoint platform and user will be redirected to _layouts/AccessDenied.aspx page if user doesnt have permission to perform that task. This might casue usability problem in some cases. You can handle access denied exception in your code by setting CatchAccessDeniedException value to true.&lt;br /&gt;Following code snippet shows how to handle access denied exception:&lt;br /&gt;&lt;br /&gt;bool catchException = SPSecurity.CatchAccessDeniedException;&lt;br /&gt;SPSecurity.CatchAccessDeniedException = false;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;  //updating list item&lt;br /&gt;  SPList list = SPcontext.Current.Web.List["TestList"];&lt;br /&gt;  SPListItem item = list.Items[0];&lt;br /&gt;  item["title"] = "Some value";&lt;br /&gt;//If user doesnt have permission, exception will be thrown&lt;br /&gt;//If value of CatchAccessDeniedException is true, then user will be&lt;br /&gt;//redirected to AccessDenied.aspx page&lt;br /&gt;  item.Update();&lt;br /&gt;}&lt;br /&gt;cach(Exception ex)&lt;br /&gt;{&lt;br /&gt;  //Your custom error message can be shown here&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;   //reset the flag to original value&lt;br /&gt;   SPSecurity.CatchAccessDeniedException = catchException;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-267499675102262547?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/267499675102262547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=267499675102262547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/267499675102262547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/267499675102262547'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/07/how-to-avoid-access-denied-page.html' title='How to avoid Access denied page'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-4045801915681925786</id><published>2008-07-15T20:55:00.001-07:00</published><updated>2008-07-15T20:55:41.123-07:00</updated><title type='text'>Change Site Theme Programatically</title><content type='html'>A Theme is collection of styles that can be applied to a page, this provides consistent look across pages. SharePoint provides few out of the box themes. You can customize themes or create new theme. Following article has details on how to create new theme:&lt;br /&gt;&lt;br /&gt;A SharePoint site theme can be changed prograamatically using SPWeb object. Following code changes the site theme to "Citrus". The list of availabel theme names can be read from "SPTHEMES.XML" file, which is located in "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Open site collection object&lt;br /&gt;using (SPSite oSPSite = new SPSite("http://servaername"))&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;// Open site               &lt;br /&gt;    using (SPWeb oSPWeb = oSPSite.OpenWeb())&lt;br /&gt;    {&lt;br /&gt;       oSPWeb.ApplyTheme("Citrus");&lt;br /&gt;       oSPWeb.Update();&lt;br /&gt;     }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-4045801915681925786?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/4045801915681925786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=4045801915681925786' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4045801915681925786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4045801915681925786'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/07/change-site-theme-programatically.html' title='Change Site Theme Programatically'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-5536213176131775178</id><published>2008-06-29T21:41:00.000-07:00</published><updated>2008-06-29T21:44:40.462-07:00</updated><title type='text'>How to Read QuickLaunch menu items Programatically</title><content type='html'>PortalSiteMapProvider.CurrentNavSiteMapProvider property gets the SiteMap provider that contains the current navigation or QuickLaunch menu items.&lt;br /&gt;MOSS 2007 provides many instances of site map providers. Various navigation controls like Top navigation, Quick launch bar use these site map providers.&lt;br /&gt;Following code shows how to read current navigation elements using APIs:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Add Publishing namespace&lt;br /&gt;  using Microsoft.SharePoint.Publishing.Navigation;&lt;br /&gt;&lt;br /&gt;2. Declare PortalSiteMapDataSource object&lt;br /&gt;  PortalSiteMapDataSource     siteMapDataSource;&lt;br /&gt;  &lt;br /&gt;3. Create instance of portal sitemap data source:&lt;br /&gt;&lt;br /&gt;//Note: the StartingNodeUrl value sid:1002 indicates QuickLanuchBar , sid:1025 is used for TopNavigationBar&lt;br /&gt;   siteMapDataSource = new PortalSiteMapDataSource();&lt;br /&gt;   //CurrentNavSiteMapProvider is one of names instance, web.config has list of such instances&lt;br /&gt;   siteMapDataSource.SiteMapProvider = "CurrentNavSiteMapProvider";&lt;br /&gt;   siteMapDataSource.ShowStartingNode = false;&lt;br /&gt;   siteMapDataSource.StartFromCurrentNode = true;&lt;br /&gt;   siteMapDataSource.StartingNodeUrl = "sid:1002";&lt;br /&gt;   siteMapDataSource.ID = "QuickLaunchBar";&lt;br /&gt;&lt;br /&gt;4. Iterate through navigation nodes:&lt;br /&gt;&lt;br /&gt;     for (int i = 0; i &lt; siteMapDataSource.Provider.CurrentNode.ChildNodes.Count; i++)&lt;br /&gt;           {&lt;br /&gt;               SiteMapNode navNode = siteMapDataSource.Provider.CurrentNode.ChildNodes[i];&lt;br /&gt;               foreach (SiteMapNode childNode in navNode.ChildNodes)&lt;br /&gt;               {&lt;br /&gt;                   string urlDetails;&lt;br /&gt;                   //Title and Url properties can be used to build custom navigation menus&lt;br /&gt;                   urlDetails = childNode.Title + childNode.Url;&lt;br /&gt;               }&lt;br /&gt;           }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-5536213176131775178?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/5536213176131775178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=5536213176131775178' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/5536213176131775178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/5536213176131775178'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/06/how-to-read-quicklaunch-menu-items.html' title='How to Read QuickLaunch menu items Programatically'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-1343930758114195458</id><published>2008-05-14T06:37:00.000-07:00</published><updated>2008-05-14T06:41:16.563-07:00</updated><title type='text'>Content Query Webpart customization (Lookup field)</title><content type='html'>Content Query Webpart displays dynamic view of site content. This webpart can show data across lists and sites in your site collection.&lt;br /&gt;By default Content Query webpart renders fixed set of columns, you need to modify .webpart file to add your custom columns into the webpart view. Following link has details on how to customize Content Query Webpart:&lt;br /&gt;http://msdn.microsoft.com/en-us/library/ms497457.aspx&lt;br /&gt;&lt;br /&gt;Recently i was trying to add Lookup field to Content Query Webpart view. Had some issues with this. First you need to be very careful while providing the field name and types. If any of this field name or type is wrong, the webpart wont throw any error, you simply don't get any data.&lt;br /&gt;Another point to be noted while using content query webpart with Lookup or Choice fields is that, this webpart render data only if, multiple choice are not allowed. Webpart renders fields of type Lookup and Choice if multi-choice is not selected.&lt;br /&gt;In one of the MSDN blog comment, i found that, Content Query Webpart does not support lookup fields that have multi-choice enabled. Following is the link for reference:&lt;br /&gt;http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx&lt;br /&gt;Hope this helps someone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-1343930758114195458?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/1343930758114195458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=1343930758114195458' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1343930758114195458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1343930758114195458'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/05/content-query-webpart-customization.html' title='Content Query Webpart customization (Lookup field)'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-8427728906562757153</id><published>2008-05-08T02:10:00.000-07:00</published><updated>2009-02-09T20:39:48.340-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search'/><category scheme='http://www.blogger.com/atom/ns#' term='User Profiles'/><title type='text'>Add Colleague programatically</title><content type='html'>Colleague is one of the social networking feauture of MOSS 2007. MOSS 2007 provides an easy way to create and discover your network of friends and colleagues automatically. MOS 2007 automatically detects your friends from your Outlook and Windows IM contacts. It also detects your colleagues from Exchange distribution list and AD groups.&lt;br /&gt;UserProfile object provides interface to add new colleague to your profile programatically. Following code shows how to add Colleague:&lt;br /&gt;&lt;br /&gt;    //Open SPSite&lt;br /&gt;    using (SPSite site = new SPSite("http://ServerName/Sitename"))&lt;br /&gt;    {&lt;br /&gt;        //Get Server context&lt;br /&gt;        ServerContext context = ServerContext.GetContext(site);&lt;br /&gt;        //Get UserProfileManager for the site cocntext&lt;br /&gt;        UserProfileManager profileManager = new UserProfileManager(context);&lt;br /&gt;        UserProfile userProfile;&lt;br /&gt;        if (profileManager.UserExists("DomainName\\UserAccountName"))&lt;br /&gt;        {&lt;br /&gt;            userProfile = profileManager.GetUserProfile("DomainName\\UserAccountName");&lt;br /&gt;            //Check whether the colleague profile exists or not&lt;br /&gt;            if (profileManager.UserExists("DomainName\\ColleagueAccountName"))&lt;br /&gt;            {&lt;br /&gt;                ColleagueManager colleagueManager;&lt;br /&gt;                UserProfile colleagueProfile;&lt;br /&gt;                colleagueProfile = profileManager.GetUserProfile("DomainName\\ColleagueAccountName");&lt;br /&gt;                colleagueManager = userProfile.Colleagues;&lt;br /&gt;                //Adds collegue with group type peer. This property is marked as public&lt;br /&gt;                colleagueManager.Create(colleagueProfile, ColleagueGroupType.Peer, "", false, Privacy.Public);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-8427728906562757153?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/8427728906562757153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=8427728906562757153' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8427728906562757153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8427728906562757153'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/05/add-colleague-programatically.html' title='Add Colleague programatically'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-7315629742115198253</id><published>2008-04-30T03:14:00.000-07:00</published><updated>2008-04-30T03:15:19.838-07:00</updated><title type='text'>How to change DateTime format</title><content type='html'>Date format can be changed for entire site collection or it can be changed for a user profile.&lt;br /&gt;Site date format can be changed from Site Settings:&lt;br /&gt;From "Site Settings"&gt;"Modify All Site Settings"&lt;br /&gt;Click on Regional Settings under Site Administration&lt;br /&gt;Change the time zone.&lt;br /&gt;&lt;br /&gt;To change date format for a user profile&lt;br /&gt;Click on "My Settings"&lt;br /&gt;Click on My Regional Settings" and change the time zone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-7315629742115198253?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/7315629742115198253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=7315629742115198253' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7315629742115198253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7315629742115198253'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/04/how-to-change-datetime-format.html' title='How to change DateTime format'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-3541283507643601052</id><published>2008-04-09T22:52:00.000-07:00</published><updated>2008-04-09T22:55:14.684-07:00</updated><title type='text'>Read audience members programatically</title><content type='html'>Audience targeting feature of SharePoint server allows organizations to target content to users based on their job title or location. Content can be targetted based on users membership in a SharePoint group or exchange server group or based on user profile properties.&lt;br /&gt;Audience targeting just filters the users based on rule used while creating the audience targeting. &lt;br /&gt;We had a requirement of sending reminder mails to set of employees based on there job title. Following is code snippet which filters the employees based on job title. The code uses Audience targeting feature of MOSS 2007 to filter the employees.&lt;br /&gt;The code uses Audience of name "ContractEmployees".&lt;br /&gt;&lt;br /&gt;using (SPSite site = new SPSite("http://servername"))&lt;br /&gt;    {&lt;br /&gt;     AudienceManager audManager = new AudienceManager(ServerContext.GetContext(site));&lt;br /&gt;            Audience audience = audManager.Audiences["ContractEmployees"];&lt;br /&gt;            ArrayList userInfoCollection = audience.GetMembership();&lt;br /&gt;&lt;br /&gt;            foreach (UserInfo userInfo in userInfoCollection)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine(userInfo.Email);&lt;br /&gt;            }   &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-3541283507643601052?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/3541283507643601052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=3541283507643601052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3541283507643601052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3541283507643601052'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/04/read-audience-members-programatically.html' title='Read audience members programatically'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-6632499223402883446</id><published>2008-03-24T07:47:00.000-07:00</published><updated>2008-03-26T10:48:29.685-07:00</updated><title type='text'>How to Read,Update LookUp fields in SharePoint List</title><content type='html'>Lookup fields in SharePoint provides a great way to pickup dynamically changing values from a dropdown list.But programmatic access of this type of fields is not straightforward. The actual list item value is stored as ID:#Value. Where ID is reference to the id of referring list and value is the value selected. SharePoint SDK provides APIs to read and update lookup fiedls. SPFieldLookupValue object can be used to read and update/insert lookup fields.&lt;br /&gt;For example:&lt;br /&gt;Lets create a sample master list "Skills ", add following values:&lt;br /&gt;ASP.Net&lt;br /&gt;C#&lt;br /&gt;SQL&lt;br /&gt;&lt;br /&gt;Following is screen shot of the master list "Skills":&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_b8vnd3hatKE/R-e_VH44NcI/AAAAAAAAAEE/ClOGSk8qCe4/s1600-h/lookup.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_b8vnd3hatKE/R-e_VH44NcI/AAAAAAAAAEE/ClOGSk8qCe4/s320/lookup.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5181320265928816066" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;Now create another custom list "My Skills", with a lookup field which refers to Title column of "Skills" list, which is created earlier. &lt;br /&gt;&lt;br /&gt;Following code snippet, reads and updates the "TechSkills" field of "My Skills" list.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   using (SPSite site = new SPSite("http://servername"))&lt;br /&gt;    {&lt;br /&gt;        using(SPWeb web = site.OpenWeb())&lt;br /&gt;        {&lt;br /&gt;            SPList list = web.Lists["My Skills"]; //List which has lookupfield TechSkills&lt;br /&gt;            SPListItemCollection itemCollection;&lt;br /&gt;            itemCollection = list.Items;&lt;br /&gt;            foreach (SPListItem item in itemCollection)&lt;br /&gt;            {&lt;br /&gt;                SPFieldLookupValue lookupField = new SPFieldLookupValue(item["TechSkills"].ToString());&lt;br /&gt;                string lookUpValue = lookupField.LookupValue;&lt;br /&gt;                Console.WriteLine("List item actual value:" + item["TechSkills"].ToString());&lt;br /&gt;                Console.WriteLine("List item lookfield value:" + lookUpValue);&lt;br /&gt;            }&lt;br /&gt;            SPListItem listItem = itemCollection[0];&lt;br /&gt;            listItem["Skill Name"] = new SPFieldLookupValue(1, "ASP.Net"); //ID field of ASP.Net is 1&lt;br /&gt;            listItem.Update();&lt;br /&gt;        }&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-6632499223402883446?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/6632499223402883446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=6632499223402883446' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6632499223402883446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6632499223402883446'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/03/how-to-readupdate-lookup-fields-in.html' title='How to Read,Update LookUp fields in SharePoint List'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_b8vnd3hatKE/R-e_VH44NcI/AAAAAAAAAEE/ClOGSk8qCe4/s72-c/lookup.JPG' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-4392528540837097834</id><published>2008-03-20T04:37:00.000-07:00</published><updated>2009-02-09T20:36:08.195-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='User Profiles'/><title type='text'>How to create MySite Programmatically</title><content type='html'>SharePoint provides APIs to create MySite programmtically. UserProfile object provides a method to create personal site. Following console application creates MySite for a given account:&lt;br /&gt;&lt;br /&gt;using Microsoft.Office.Server;&lt;br /&gt;using Microsoft.Office.Server.Administration;&lt;br /&gt;using Microsoft.Office.Server.UserProfiles;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;using System.Web;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;namespace UserProfileCreate&lt;br /&gt;{&lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;using (SPSite site = new SPSite("http://servername"))&lt;br /&gt;{&lt;br /&gt;ServerContext context = ServerContext.GetContext(site);&lt;br /&gt;UserProfileManager profileManager = new UserProfileManager(context);&lt;br /&gt;&lt;br /&gt;string accountName = "domainname\\username";&lt;br /&gt;UserProfile userProfile;&lt;br /&gt;if (profileManager.UserExists(accountName))&lt;br /&gt;{&lt;br /&gt;    userProfile = profileManager.GetUserProfile(accountName);&lt;br /&gt;    &lt;br /&gt;        userProfile.CreatePersonalSite();    &lt;br /&gt;    &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-4392528540837097834?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/4392528540837097834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=4392528540837097834' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4392528540837097834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4392528540837097834'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/03/hot-to-create-mysite-programmatically.html' title='How to create MySite Programmatically'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-8598545207905919604</id><published>2008-03-19T01:27:00.000-07:00</published><updated>2009-02-09T20:36:08.196-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='User Profiles'/><title type='text'>Delete User Profile Programatically</title><content type='html'>User profiles in SharePoint can be removed either by the user interface provided in SSP adminstration site or the user profile object/web service apis provided by SharePoint SDK.&lt;br /&gt;UserProfileManager object can be used to create or remove user profiles from profile store.&lt;br /&gt;Following code Snippet shows how to remove user profile, this code only removes the user profile, but not the user from the user store (AD or any custom membership data base).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Reference to User profile and administration dlls&lt;br /&gt;using Microsoft.Office.Server;&lt;br /&gt;using Microsoft.Office.Server.Administration;&lt;br /&gt;using Microsoft.Office.Server.UserProfiles;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;using System.Web;&lt;br /&gt;&lt;br /&gt;2. Get site context, check whether profile exists, if exists remove the profile&lt;br /&gt;            using (SPSite site = new SPSite("http://servername/"))&lt;br /&gt;            {&lt;br /&gt;                ServerContext context = ServerContext.GetContext(site);&lt;br /&gt;                UserProfileManager profileManager = new UserProfileManager(context);&lt;br /&gt;                String accountName = "demomembershipprovider:shridhar";&lt;br /&gt;                UserProfile userProfile;&lt;br /&gt;                if (profileManager.UserExists(accountName))&lt;br /&gt;                {&lt;br /&gt;                    profileManager.RemoveUserProfile(accountName);&lt;br /&gt;                }&lt;br /&gt;                if (profileManager.UserExists(accountName))&lt;br /&gt;                {&lt;br /&gt;                    Console.WriteLine("User profile removed");&lt;br /&gt;                }&lt;br /&gt;                Console.ReadLine();&lt;br /&gt;             }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-8598545207905919604?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/8598545207905919604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=8598545207905919604' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8598545207905919604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8598545207905919604'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/03/delete-user-profile-programatically.html' title='Delete User Profile Programatically'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-5524988407205327554</id><published>2008-03-14T10:39:00.000-07:00</published><updated>2009-02-09T20:36:08.196-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='User Profiles'/><title type='text'>Create user profiles with Forms Authentication</title><content type='html'>The default SharePoint profile import works only with Active Directory. If site is configured with Forms authentication, then we need to create profile programmatically. There are tools available to import profiles (&lt;a href="http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=sptoolbox&amp;ReleaseId=8728"&gt;CodePlex Import&lt;/a&gt; tool). Following code snippet shows how to create user profile programmatically:&lt;br /&gt;&lt;br /&gt;Create a SharePoint site with Forms authentication enabled. (Check this &lt;a href="http://www.simple-talk.com/dotnet/windows-forms/configuring-forms-authentication-in-sharepoint-2007/"&gt;link &lt;/a&gt;for creating FBA based site)&lt;br /&gt;&lt;br /&gt;Use following code to create user profile: &lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using Microsoft.Office.Server;&lt;br /&gt;using Microsoft.Office.Server.Administration;&lt;br /&gt;using Microsoft.Office.Server.UserProfiles;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;namespace UserProfileCreate&lt;br /&gt;{&lt;br /&gt;    class Program&lt;br /&gt;    {&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            using (SPSite site = new SPSite("http://servername/"))&lt;br /&gt;            {&lt;br /&gt;                ServerContext context = ServerContext.GetContext(site);&lt;br /&gt;                UserProfileManager profileManager = new UserProfileManager(context);&lt;br /&gt;  //account name : membership provider name:account name&lt;br /&gt;&lt;br /&gt;                String accountName = "demomembershipprovider:shridhar";&lt;br /&gt;                UserProfile userProfile;&lt;br /&gt;                if (profileManager.UserExists(accountName))&lt;br /&gt;                {&lt;br /&gt;                    userProfile = profileManager.GetUserProfile(accountName);&lt;br /&gt;                    userProfile["WorkPhone"].Add("4251111111");&lt;br /&gt;                    userProfile.Commit();&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    userProfile = profileManager.CreateUserProfile(accountName);&lt;br /&gt;                    userProfile["WorkPhone"].Add("4251111111");&lt;br /&gt;                    userProfile.Commit();&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;          }&lt;br /&gt;      }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-5524988407205327554?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/5524988407205327554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=5524988407205327554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/5524988407205327554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/5524988407205327554'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/03/create-user-profiles-with-forms.html' title='Create user profiles with Forms Authentication'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-6005870528001078141</id><published>2008-03-12T05:01:00.000-07:00</published><updated>2009-02-09T20:39:48.340-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search'/><title type='text'>Search Query URL</title><content type='html'>SharePoint search URL syntax provides one of the easiest way of search. Very easily we can integrate SharePoint search with other applications.&lt;br /&gt;This URL syntax works on http get. Following is syntax reference:&lt;br /&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr style="background: gray none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;td style="font-weight: bold;"&gt;Key&lt;/td&gt;&lt;td style="font-weight: bold;"&gt;Description&lt;/td&gt;&lt;td style="font-weight: bold;"&gt;Example&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;K=&lt;/td&gt;&lt;td&gt;Search key&lt;/td&gt;&lt;td&gt;http://servername/search/results.aspx?k=sharepoint&lt;br /&gt;This url searches for keyword sharepoint&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;v1=&lt;/td&gt;&lt;td&gt;Order By&lt;/td&gt;&lt;td&gt;http://servername/search/results.aspx?k=sharepoint&amp;amp;v1=date&lt;br /&gt;This url searches for keyword sharepoint and orders the search results by modified date&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;s=&lt;/td&gt;&lt;td&gt;Search Scope&lt;/td&gt;&lt;td&gt;http://servername/search/results.aspx?k=sharepoint&amp;amp;s=All%20Sites&lt;br /&gt;This url searches for keyword sharepoint in all sites scope&lt;/td&gt;&lt;/tr&gt;&lt;tr &gt;&lt;td&gt;start1=&lt;/td&gt;&lt;td&gt;Page start&lt;/td&gt;&lt;td&gt;http://servername/search/results.aspx?k=sharepoint&amp;amp;start1=15&lt;br /&gt;This url searches for keyword sharepoint and returns results from 15th record&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-6005870528001078141?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/6005870528001078141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=6005870528001078141' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6005870528001078141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6005870528001078141'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/03/search-query-url.html' title='Search Query URL'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-6350164301260667821</id><published>2008-02-29T05:20:00.000-08:00</published><updated>2008-02-29T05:24:05.717-08:00</updated><title type='text'>How to change Application Pool Identity of SharePoint Site</title><content type='html'>If you have to change your SharePoint site application pool identity , you need to do it from "Service Accounts" option available from SharePoint Central administrator site. I tried changing it directly from IIS console (inetmgr), i got error "Service Not Available" on my SharePoint site. When i changed the same from central administrator , site started working.&lt;br /&gt;To change service account:&lt;br /&gt;1) Open Central Administrator&lt;br /&gt;2) Select "Operations" tab&lt;br /&gt;3) Click "Service Accounts" under Security Configurations section&lt;br /&gt;4) From Service Account UI, Select the web application and change the account as shown in below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_b8vnd3hatKE/R8gHIj0FNHI/AAAAAAAAAD8/EpOHraZ1vhw/s1600-h/serviceacc.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_b8vnd3hatKE/R8gHIj0FNHI/AAAAAAAAAD8/EpOHraZ1vhw/s320/serviceacc.JPG" alt="" id="BLOGGER_PHOTO_ID_5172392015669048434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;Hope this helps someone :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-6350164301260667821?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/6350164301260667821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=6350164301260667821' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6350164301260667821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6350164301260667821'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/02/how-to-change-application-pool-identity.html' title='How to change Application Pool Identity of SharePoint Site'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_b8vnd3hatKE/R8gHIj0FNHI/AAAAAAAAAD8/EpOHraZ1vhw/s72-c/serviceacc.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-6750463665092160545</id><published>2008-02-11T20:06:00.000-08:00</published><updated>2008-02-11T20:19:44.172-08:00</updated><title type='text'>SharePoint common design/architecture tasks</title><content type='html'>While working on several SharePoint based solution, i found few design tasks which are mandatory for most of SharePoint portal based solution. This blog post has some details on common design tasks and also resources which has useful information on SharePoint architecture and design considerations.&lt;br /&gt;&lt;br /&gt;some common design tasks for SharePoint portal based solution are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Designing Site Hierarchy&lt;/li&gt;&lt;li&gt;Site Definition/Site Templates&lt;/li&gt;&lt;li&gt;Designing Content types and Site columns&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Designing Site Hierarchy&lt;/span&gt;&lt;br /&gt;Accurate design of site hierarchy is key in any SharePoint portal based solution. Site hierarchy not designed properly could create confusion and can become unusable.&lt;br /&gt;Site hierarchy design includes indentifying site collections, top level sites, sub sites.  A very common question we facce while desining site hierarchy is, whether to use individual site collections or subsites with in a site collection. Few parameters that can help us in making this decision are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Usage of site&lt;/li&gt;&lt;li&gt;Administration&lt;/li&gt;&lt;li&gt;Search Scope&lt;/li&gt;&lt;li&gt;Scalability&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;This &lt;a href="http://technet2.microsoft.com/windowsserver/WSS/en/library/cd272bb2-972e-42f9-a102-fdaedf5e7ce71033.mspx?mfr%20=true"&gt;technet&lt;/a&gt; article has good details on when to use site collection and when to use sub site.&lt;br /&gt;Clear understanding of SharePoint site collection architecture is must while designing site hierarchy. This &lt;a href="http://www.sharepointblogs.com/llowevad/archive/2007/06/25/site-collection-logical-architecture.aspx"&gt;blog&lt;/a&gt; has very good post on site collection architecture.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Site Definition/Site Templates&lt;/span&gt;&lt;br /&gt;Once site hierarchy is defined, next task is to identify what all content or features need to be enabled in each top level sites or sub sites and also customizing the look and feel of the site. This includes choosing   site templates, Lists and features that need to be enabled. We can customize SharePoint site either by creating custom site template or create new site definition.   A site definaton defines a unique type of SharePoint site.&lt;br /&gt;SharePoint provides few out of the box site definition Team site, Blank site etc are few templates provided by SharePoint. A common question here is whether to go for custom template or create a site definition. Some parameters that can help is making this decision are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If changes are simple, for example changes in UI or adding new fields to a list , go for custom site template.&lt;/li&gt;&lt;li&gt;If we need to create a new content type or major changes in existing site structure, go for&lt;br /&gt;creating site definition.&lt;/li&gt;&lt;/ul&gt;Each approach has its pros and cons. Refer this article from &lt;a href="http://msdn2.microsoft.com/en-us/library/ms916803.aspx#odc_spscustomizingsharepointsites2_guidelinesforusingtemplates"&gt;MSDN&lt;/a&gt; to decide on which one to choose.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Content Types and Site Columns&lt;/span&gt;&lt;br /&gt;Content type provides underlying structure for whole site. Identifying content types and site columns is another key design activity. Content types provide a way to organize site content in a meaningful way. Content types are basically collection of meta data and settings.  Content types allow us to store multiple content associated with a document library or a list. Content types include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Meta data&lt;/li&gt;&lt;li&gt;Event handlers&lt;/li&gt;&lt;li&gt;Workflows&lt;/li&gt;&lt;li&gt;Retention Policies&lt;/li&gt;&lt;li&gt;Base Template&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Site Column&lt;br /&gt;A site column is a reusable column definition that can be assigned to multiple lists across multiple sites. It helps to ensure consistency of meta data across sites and lists.&lt;br /&gt;&lt;br /&gt;Custom Lists&lt;br /&gt;Lists are the actual data storage in SharePoint. Identify re-usable lists and create these lists at Site Collection level so that these can be re-used.&lt;br /&gt;&lt;br /&gt;This &lt;a href="http://technet2.microsoft.com/Office/en-us/library/63bb092a-00fe-45ff-a4b8-d8be998d1a3c1033.mspx?mfr=true"&gt;technet&lt;/a&gt; article has useful information on planning content types&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-6750463665092160545?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/6750463665092160545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=6750463665092160545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6750463665092160545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6750463665092160545'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/02/sharepoint-common-designarchitecture.html' title='SharePoint common design/architecture tasks'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-8473314944160198941</id><published>2008-02-06T23:08:00.000-08:00</published><updated>2008-02-06T23:49:12.796-08:00</updated><title type='text'>SPSite Vs SPWeb and SPWebApplication</title><content type='html'>When i started working on SharePoint , i always used to get consfused with SpSite and SPWeb, the confusion starts from the name itself. SDK documenetation doesnt give complete idea on what is what. I wrote a small code to map these objects to actual sites created on my SharePoint farm, following is the code:&lt;br /&gt;&lt;br&gt;&lt;br /&gt;            String hierarchy="";&lt;br /&gt;            //Read web application collection&lt;br /&gt;            SPWebApplicationCollection webApplicationCol = SPWebService.ContentService.WebApplications;&lt;br /&gt;            foreach (SPWebApplication webApp in webApplicationCol)&lt;br /&gt;            {   //Web application name&lt;br /&gt;                hierarchy += "Web Application Name(SPWebApplication):" + webApp.Name + "\r\n";&lt;br /&gt;                for (int i = 0; i &lt; webApp.Sites.Count;i++ )&lt;br /&gt;                {&lt;br /&gt;                    SPSite site = webApp.Sites[i];&lt;br /&gt;                    //sie collection URL&lt;br /&gt;                    hierarchy += "Site Collection URL(SPSite):" + site.Url + "\r\n"; &lt;br /&gt;                    for (int j = 0; j &lt; site.AllWebs.Count; j++)&lt;br /&gt;                    {&lt;br /&gt;                        SPWeb web = site.AllWebs[j];&lt;br /&gt;                        for (int k = 0; k &lt; web.Webs.Count;k++ )&lt;br /&gt;                        {&lt;br /&gt;                            SPWeb web1 = web.Webs[k];&lt;br /&gt;                            //top level site and subsites URL&lt;br /&gt;                            hierarchy += "Sub Site URL(SPWeb):" + web1.Url + "\r\n";&lt;br /&gt;                        }&lt;br /&gt;                        &lt;br /&gt;                        web.Dispose();&lt;br /&gt;                    }&lt;br /&gt;                    site.Dispose();&lt;br /&gt;                }&lt;br /&gt;                hierarchy += "----------------------------------------------" + "\r\n";&lt;br /&gt;&lt;br&gt;&lt;br /&gt;Output of the above code shows how SPSite and SpWeb map to your actual SharePoint sites and web application.&lt;br /&gt;Diagram below shows the relationship and hierarchy of these SharePoint objects:&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_b8vnd3hatKE/R6qxV4678JI/AAAAAAAAAD0/b3FSgtGgOYU/s1600-h/sitecol.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5164134912348647570" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_b8vnd3hatKE/R6qxV4678JI/AAAAAAAAAD0/b3FSgtGgOYU/s320/sitecol.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;A SharePoint Web application (SPWebApplication) is web site inside Ineternet Information server, A web application can have multiple sites , a Site (SpSite) is a collection a single top level site (SPWeb) and group of sites (SPWebCollection) and sub sites.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-8473314944160198941?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/8473314944160198941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=8473314944160198941' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8473314944160198941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8473314944160198941'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/02/spsite-vs-spweb-and-spwebapplication.html' title='SPSite Vs SPWeb and SPWebApplication'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_b8vnd3hatKE/R6qxV4678JI/AAAAAAAAAD0/b3FSgtGgOYU/s72-c/sitecol.JPG' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-7640253083583947225</id><published>2008-02-04T23:38:00.000-08:00</published><updated>2008-02-05T00:07:06.475-08:00</updated><title type='text'>Customizing List Edit/New/View Forms</title><content type='html'>SharePoint provides out of the box Custom List Form webparts to update view and add list items. These webparts can be easily customized to apply custom styles.&lt;br /&gt;Following steps show how to customize the new item creation form of "Contracts" list of SharePoint:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Create a blank webpart page&lt;/li&gt;&lt;li&gt;Open the page in SharePoint designer&lt;/li&gt;&lt;li&gt;Add Custom List Form webparat (Insert-&gt;SharePoint Controls-&gt;Custom List Form):&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_b8vnd3hatKE/R6gXf4678GI/AAAAAAAAADc/c9_9qwHyCEs/s1600-h/EditList1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_b8vnd3hatKE/R6gXf4678GI/AAAAAAAAADc/c9_9qwHyCEs/s320/EditList1.JPG" alt="" id="BLOGGER_PHOTO_ID_5163402809403240546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Select the list which requires custom interface and select content type:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_b8vnd3hatKE/R6gYIY678HI/AAAAAAAAADk/EkHnmXTyIHE/s1600-h/editlst2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_b8vnd3hatKE/R6gYIY678HI/AAAAAAAAADk/EkHnmXTyIHE/s320/editlst2.JPG" alt="" id="BLOGGER_PHOTO_ID_5163403505187942514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This provides interface for adding new item, view list and edit list items.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;SharePoint designer adds DatForm webpart with all form fields related to the content type selected:&lt;br&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_b8vnd3hatKE/R6gYt4678II/AAAAAAAAADs/SiyCVXf7hAU/s1600-h/listedt3.JPG"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_b8vnd3hatKE/R6gYt4678II/AAAAAAAAADs/SiyCVXf7hAU/s320/listedt3.JPG" alt="" id="BLOGGER_PHOTO_ID_5163404149433036930" border="0" /&gt;&lt;/a&gt;&lt;br&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Edit the html to apply custom styles.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-7640253083583947225?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/7640253083583947225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=7640253083583947225' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7640253083583947225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/7640253083583947225'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/02/customizing-list-editnewview-forms.html' title='Customizing List Edit/New/View Forms'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_b8vnd3hatKE/R6gXf4678GI/AAAAAAAAADc/c9_9qwHyCEs/s72-c/EditList1.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-8391441332720127150</id><published>2008-01-22T06:43:00.000-08:00</published><updated>2008-01-22T06:47:21.463-08:00</updated><title type='text'>How to read recurring events using CAML query.</title><content type='html'>Reading past instances of a recurring events in SharePoint is little tricky. By setting CalendarDate field of SPQuery and using DateRangesOver element of CAML query we can read past and future instances of a recurring event.&lt;br /&gt;&lt;br /&gt;Following code shows how to read events happend in past:&lt;br /&gt;&lt;br /&gt;         using (SPSite oSPSite = new SPSite(siteName.Text))&lt;br /&gt;           {&lt;br /&gt;               using (SPWeb oSPWeb = oSPSite.OpenWeb())&lt;br /&gt;               {&lt;br /&gt;                   SPList list = oSPWeb.GetList(listName.Text);&lt;br /&gt;&lt;br /&gt;                   SPQuery query = new SPQuery();&lt;br /&gt;                  &lt;br /&gt;                   query.ExpandRecurrence = true;&lt;br /&gt;                   query.CalendarDate = new DateTime(2008, 1, 1);&lt;br /&gt;                  &lt;br /&gt;                   query.Query = "&amp;lt;Where&amp;gt;&amp;lt;DateRangesOverlap&amp;gt;&amp;lt;FieldRef Name=\"EventDate\" /&amp;gt;&amp;lt;FieldRef Name=\"EndDate\" /&amp;gt;&amp;lt;FieldRef Name=\"RecurrenceID\" /&amp;gt;&amp;lt;Value Type=\"DateTime\"&amp;gt;&amp;lt;Week /&amp;gt;&amp;lt;/Value&amp;gt;&amp;lt;/DateRangesOverlap&amp;gt;&amp;lt;/Where&amp;gt;";&lt;br /&gt;                   SPListItemCollection listItems;&lt;br /&gt;                   listItems = list.GetItems(query);&lt;br /&gt;                   foreach (SPListItem items in listItems)&lt;br /&gt;                   {&lt;br /&gt;                       // items["EventDate"].ToString()&lt;br /&gt;                   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;This code returns all events happend in a week which includes date 2008-1-1.&lt;br /&gt;&lt;br /&gt;Recurring event for current day can be read by making small change the above code:&lt;br /&gt;Set CalendarDate to current date:&lt;br /&gt;query.CalendarDate = new DateTime(2008, 1, 22);&lt;br /&gt;&lt;br /&gt;And change the query to:&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;query.Query = "&amp;lt;Where&amp;gt;&amp;lt;DateRangesOverlap&amp;gt;&amp;lt;FieldRef Name=\"EventDate\" /&amp;gt;&amp;lt;FieldRef Name=\"EndDate\" /&amp;gt;&amp;lt;FieldRef Name=\"RecurrenceID\" /&amp;gt;&amp;lt;Value Type=\"DateTime\"&amp;gt;&amp;lt;&lt;span style="font-weight: bold;"&gt;Today &lt;/span&gt;/&amp;gt;&amp;lt;/Value&amp;gt;&amp;lt;/DateRangesOverlap&amp;gt;&amp;lt;/Where&amp;gt;";&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-8391441332720127150?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/8391441332720127150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=8391441332720127150' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8391441332720127150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/8391441332720127150'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/how-to-read-recurring-events-using-caml.html' title='How to read recurring events using CAML query.'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-336529234608023373</id><published>2008-01-20T00:48:00.000-08:00</published><updated>2008-01-20T21:27:11.823-08:00</updated><title type='text'>SharePoint Survey Results using Pie chart</title><content type='html'>SharePoint out of the box survey results are shown in bar chart. We can easily show it in pie chart using charting tools. Code snippet below shows how we can show survey results in a pie chart using Telerik chart controls (www.telerik.com). Survey resutls will be rendered as a webpart shown below:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_b8vnd3hatKE/R5QsQvFqPaI/AAAAAAAAADU/JY-FB76HaRU/s1600-h/survey.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_b8vnd3hatKE/R5QsQvFqPaI/AAAAAAAAADU/JY-FB76HaRU/s320/survey.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5157796139275795874" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Below code snippet renders SharePoint survey results as Pie chart using Telerik chart control:&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Runtime.InteropServices;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Xml.Serialization;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using Microsoft.SharePoint;&lt;br /&gt;using Microsoft.SharePoint.WebControls;&lt;br /&gt;using Microsoft.SharePoint.WebPartPages;&lt;br /&gt;using Telerik.WebControls;&lt;br /&gt;using Telerik.Charting;&lt;br /&gt;using Telerik.WebControls.Dialogs;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;namespace CommonControls.Survey&lt;br /&gt;{&lt;br /&gt;    [Guid("ce0403df-d85c-4ba0-9b57-f944fb70ded4")]&lt;br /&gt;    public class SurveyChart : Microsoft.SharePoint.WebPartPages.WebPart&lt;br /&gt;    {&lt;br /&gt;        List&amp;lt;Response&amp;gt; response;&lt;br /&gt;        String surveyQuestion;&lt;br /&gt;        RadChart chart;&lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;        public SurveyChart()&lt;br /&gt;        {&lt;br /&gt;            this.ExportMode = WebPartExportMode.All;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        protected override void RenderContents(HtmlTextWriter htmlTextWriter)&lt;br /&gt;        {&lt;br /&gt;            htmlTextWriter.Write("&amp;lt;TABLE&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;");&lt;br /&gt;            this.chart.RenderControl(htmlTextWriter);&lt;br /&gt;            htmlTextWriter.Write("&amp;lt;/TABLE&amp;gt;&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;");&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        protected override void CreateChildControls()&lt;br /&gt;        {&lt;br /&gt;            string[] colors = { "#FFDA43", "#2F89C2", "#F267CD", "#79E364", "#EB5D2D", "#42AE18", "#FF9C40", "#B99A72", "#9BC0FF", "#98CC88", "#C3B600" };&lt;br /&gt;            chart = new RadChart();&lt;br /&gt;            chart.UseSession = false;&lt;br /&gt;            chart.TempImagesFolder = "~/_layouts/temp";&lt;br /&gt;            chart.RadControlsDir = "~/_layouts/radcontrols/RadControls/";&lt;br /&gt;            &lt;br /&gt;            ChartSeries chartSeries = new ChartSeries();&lt;br /&gt;            chart.AddChartSeries(chartSeries);&lt;br /&gt;            ChartTitle title = new ChartTitle();&lt;br /&gt;            &lt;br /&gt;&lt;br /&gt;            ChartSeries series = chart.GetChartSeries(0);&lt;br /&gt;            series.Name = surveyQuestion;&lt;br /&gt;            &lt;br /&gt;            chart.Legend.HAlignment = ChartHAlignment.Center;&lt;br /&gt;            chart.Legend.VAlignment = ChartVAlignment.Bottom;&lt;br /&gt;            chart.Legend.LegendStyle = LegendItemsPositionType.Row;&lt;br /&gt;            &lt;br /&gt;            &lt;br /&gt;            response = GetSurveyResponse("http://server/sites/techresources/", "http://server/sites/techresources/Lists/Survey2");&lt;br /&gt;            title.Text = surveyQuestion;&lt;br /&gt;            title.TextFont = new Font("Verdana", 7);&lt;br /&gt;            chart.Chart.ChartTitle = title;&lt;br /&gt;&lt;br /&gt;   series.Clear();&lt;br /&gt;   series.DiameterScale      = 0.40;&lt;br /&gt;   series.ShowLabelConnectors   = false;    &lt;br /&gt;   series.ShowLabels            = true;&lt;br /&gt;   series.LabelAppearance.Distance = 7;    &lt;br /&gt;   series.LabelAppearance.TextFont = new Font("Verdana", 7);&lt;br /&gt;   series.NotOverlapLabels      = true;&lt;br /&gt;            series.Type = ChartSeriesType.Pie;&lt;br /&gt;   ColorConverter cc = new ColorConverter();&lt;br /&gt;            int i = 0;&lt;br /&gt;   foreach (Response res in response)&lt;br /&gt;   {&lt;br /&gt;    ChartSeriesItem seriesItem = new ChartSeriesItem();&lt;br /&gt;    seriesItem.YValue = res.totalResponse;&lt;br /&gt;    seriesItem.ItemMap.ToolTip = res.choiceName;&lt;br /&gt;                seriesItem.Label = res.totalResponse.ToString();&lt;br /&gt;    seriesItem.Appearance.MainColor = (Color) cc.ConvertFromString(colors[i++]);&lt;br /&gt;    seriesItem.Appearance.BorderColor = Color.DimGray;&lt;br /&gt;    seriesItem.Appearance.FillStyle = FillStyle.Solid;&lt;br /&gt;                seriesItem.Name =  res.choiceName;&lt;br /&gt;    series.Items.Add(seriesItem);&lt;br /&gt;   }  &lt;br /&gt;            chart.Skin = "LightGreen";  &lt;br /&gt;            this.Controls.Add(chart);&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        public List&amp;lt;Response&amp;gt; GetSurveyResponse(string siteUrl, string surveyName)&lt;br /&gt;        {&lt;br /&gt;            &lt;br /&gt;            List&amp;lt;Response&amp;gt; responseList;&lt;br /&gt;            string questionName = "";&lt;br /&gt;                using (SPSite oSPSite = new SPSite(siteUrl))&lt;br /&gt;                {&lt;br /&gt;                    using (SPWeb oSPWeb = oSPSite.OpenWeb())&lt;br /&gt;                    {&lt;br /&gt;                        SPList surveyList = oSPWeb.GetList(surveyName);&lt;br /&gt;                        if (surveyList.BaseType != SPBaseType.Survey)&lt;br /&gt;                            throw new Exception("List is not of survey type");&lt;br /&gt;                        responseList = new List&amp;lt;Response&amp;gt;();&lt;br /&gt;                        foreach (SPField field in surveyList.Fields)&lt;br /&gt;                        {&lt;br /&gt;                            if (field.Type == SPFieldType.Choice)&lt;br /&gt;                            {&lt;br /&gt;                                SPFieldChoice choiceField;&lt;br /&gt;                                choiceField = (SPFieldChoice)field;&lt;br /&gt;                                questionName = field.StaticName;&lt;br /&gt;                                surveyQuestion = field.Title;&lt;br /&gt;                                foreach (string choiceName in choiceField.Choices)&lt;br /&gt;                                {&lt;br /&gt;                                    Response resField = new Response();&lt;br /&gt;                                    resField.choiceName = choiceName;&lt;br /&gt;                                    responseList.Add(resField);&lt;br /&gt;                                }&lt;br /&gt;                            }&lt;br /&gt;                        }&lt;br /&gt;                        foreach (Response res in responseList)&lt;br /&gt;                        {&lt;br /&gt;                            SPQuery responseQuery = new SPQuery();&lt;br /&gt;                            responseQuery.Query = @"&amp;lt;Where&amp;gt;&lt;br /&gt;                                        &amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name=" + questionName + " /&amp;gt;&amp;lt;Value Type=\"Choice\"&amp;gt;" + res.choiceName + @"&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&lt;br /&gt;                                       &amp;lt;/Where&amp;gt;";&lt;br /&gt;                            res.totalResponse = surveyList.GetItems(responseQuery).Count;&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            return responseList;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-336529234608023373?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/336529234608023373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=336529234608023373' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/336529234608023373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/336529234608023373'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/sharepoint-survey-results-using-pie.html' title='SharePoint Survey Results using Pie chart'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_b8vnd3hatKE/R5QsQvFqPaI/AAAAAAAAADU/JY-FB76HaRU/s72-c/survey.JPG' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-1305069783909816867</id><published>2008-01-17T05:21:00.000-08:00</published><updated>2009-02-09T20:37:04.335-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CAML Query'/><title type='text'>How to read choice values for Multi choice questions in a Survey</title><content type='html'>Multi choice questions are very common in survey. SpFieldChoice object can be used to access choice values programmatically . &lt;br /&gt;SpFieldChoice provides a string collection which stores the choice values for multi choice field type. &lt;br /&gt;Following code snippet shows how to read choice values for multi choice field types.&lt;br /&gt;&lt;br /&gt;            string siteName = "http://server/site";&lt;br /&gt;            string listURL = "http://server/site/Lists/listname";&lt;br /&gt;            using (SPSite oSPSite = new SPSite(siteName))&lt;br /&gt;            {&lt;br /&gt;                using (SPWeb oSPWeb = oSPSite.OpenWeb())&lt;br /&gt;                {&lt;br /&gt;                    SPList list = oSPWeb.GetList(listURL);&lt;br /&gt;                    foreach (SPField field in list.Fields)&lt;br /&gt;                    {&lt;br /&gt;                        //check whether field type is multi choice or not&lt;br /&gt;                        if (field.Type == SPFieldType.Choice)&lt;br /&gt;                        {&lt;br /&gt;                            SPFieldChoice choice = (SPFieldChoice) field;&lt;br /&gt;                            foreach (string choiceName in choice.Choices)&lt;br /&gt;                            {&lt;br /&gt;                                //choiceName will have the &lt;br /&gt;                            }&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-1305069783909816867?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/1305069783909816867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=1305069783909816867' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1305069783909816867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1305069783909816867'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/how-to-read-choice-values-for-multi.html' title='How to read choice values for Multi choice questions in a Survey'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-6221401610744822228</id><published>2008-01-14T00:54:00.001-08:00</published><updated>2009-02-09T20:37:43.811-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search'/><title type='text'>Highlight search results keyword</title><content type='html'>The out of the box search results, the kewords are marked as bold, but it can be easily marked with background color by changing the XSLT. &lt;br /&gt;To highlight the search results with different background color follow these simple steps:&lt;br /&gt;1) Edit search results page&lt;br /&gt;2) Modify the search core results webpart (Click on Modify Shared webpart menu)&lt;br /&gt;3) Under search core results tool pane, click "XSL Editor" button. Copy the xsl and save it in a text file&lt;br /&gt;4) In the above xsl file you will find XSL tempalte like&lt;br /&gt; &amp;lt;xsl:template match="c0"&amp;gt;&lt;br /&gt;  &amp;lt;b&amp;gt;&lt;br /&gt;   &amp;lt;xsl:value-of select="."&amp;#47&amp;gt;&lt;br /&gt;  &amp;lt;&amp;#47b&amp;gt;&lt;br /&gt; &amp;lt;&amp;#47xsl:template&amp;gt;&lt;br /&gt; &amp;lt;xsl:template match="c1"&amp;gt;&lt;br /&gt;  &amp;lt;b&amp;gt;&lt;br /&gt;   &amp;lt;xsl:value-of select="."&amp;#47&amp;gt;&lt;br /&gt;  &amp;lt;&amp;#47b&amp;gt;&lt;br /&gt; &amp;lt;&amp;#47xsl:template&amp;gt;&lt;br /&gt;&lt;br /&gt;You will find 10 such templates. Each of the keywords is represented in the XML returned by the search engine by a value starting with c.&lt;br /&gt;Now wrap each of these &amp;lt;xsl_value&amp;gt; tag inside &amp;lt;Span&amp;gt; tag with background color:&lt;br /&gt;&lt;br /&gt;  &amp;lt;xsl:template match="c0"&amp;gt;&lt;br /&gt;  &amp;lt;span style="background:yellow"&amp;gt;&lt;br /&gt;   &amp;lt;b&amp;gt;&lt;br /&gt;    &amp;lt;xsl:value-of select="."&amp;#47&amp;gt;&lt;br /&gt;   &amp;lt;&amp;#47b&amp;gt;&lt;br /&gt;  &amp;lt;&amp;#47span&amp;gt;&lt;br /&gt; &amp;lt;&amp;#47xsl:template&amp;gt;&lt;br /&gt; &amp;lt;xsl:template match="c1"&amp;gt;&lt;br /&gt;  &amp;lt;span style="background:gray"&amp;gt;&lt;br /&gt;   &amp;lt;b&amp;gt;&lt;br /&gt;    &amp;lt;xsl:value-of select="."&amp;#47&amp;gt;&lt;br /&gt;   &amp;lt;&amp;#47b&amp;gt;&lt;br /&gt;  &amp;lt;&amp;#47span&amp;gt;&lt;br /&gt; &amp;lt;&amp;#47xsl:template&amp;gt;&lt;br /&gt;&lt;br /&gt;5) Copy the updated xsl back to "XSLT Editor" box. Save and publish the page.&lt;br /&gt;&lt;br /&gt;The above xsl will mark first two keywords with yellow and gray background as shown below:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_b8vnd3hatKE/R4sl_PFqPZI/AAAAAAAAABM/5vvN-eot50w/s1600-h/keyword.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_b8vnd3hatKE/R4sl_PFqPZI/AAAAAAAAABM/5vvN-eot50w/s320/keyword.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5155255966767922578" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-6221401610744822228?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/6221401610744822228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=6221401610744822228' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6221401610744822228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/6221401610744822228'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/highlight-search-results-keyword.html' title='Highlight search results keyword'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_b8vnd3hatKE/R4sl_PFqPZI/AAAAAAAAABM/5vvN-eot50w/s72-c/keyword.JPG' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-4495176967152408339</id><published>2008-01-11T01:16:00.001-08:00</published><updated>2008-01-11T01:36:13.460-08:00</updated><title type='text'>VS 2005 Code Snippet for SPWeb and SPSite (Best practice)</title><content type='html'>Very often we create SPWeb and SPSite object while writing SharePoint code.These two objects are very expensive object and proper can should be taken to dispose the objects after its use. Following MSDN article has good details on how to use these objects:&lt;br /&gt;http://msdn2.microsoft.com/en-us/library/aa973248.aspx&lt;br /&gt;&lt;br /&gt;I have created VS 2005 code snippet which creates the SPWeb and SPSite objects as per the best practice.  "Code Snippet" which is a feature of VS 2005 allows you to quickly add re-usable blocks of code in your project.&lt;br /&gt;&lt;br /&gt;To add this code snippet to your VS 2005:&lt;br /&gt;1. Save the following XML file as "spweb.snippet"&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;CodeSnippets  xmlns="http:&amp;#47;&amp;#47;schemas.microsoft.com&amp;#47;VisualStudio&amp;#47;2005&amp;#47;CodeSnippet"&amp;gt;&lt;br /&gt; &amp;lt;CodeSnippet Format="1.0.0"&amp;gt;&lt;br /&gt;  &amp;lt;Header&amp;gt;&lt;br /&gt;   &amp;lt;Title&amp;gt;spweb&amp;lt;&amp;#47;Title&amp;gt;&lt;br /&gt;   &amp;lt;Shortcut&amp;gt;spweb&amp;lt;&amp;#47;Shortcut&amp;gt;&lt;br /&gt;   &amp;lt;Description&amp;gt;Code snippet creating disposable SPWeb object&amp;lt;&amp;#47;Description&amp;gt;&lt;br /&gt;   &amp;lt;Author&amp;gt;Sridhar&amp;lt;&amp;#47;Author&amp;gt;&lt;br /&gt;   &amp;lt;SnippetTypes&amp;gt;&lt;br /&gt;    &amp;lt;SnippetType&amp;gt;Expansion&amp;lt;&amp;#47;SnippetType&amp;gt;&lt;br /&gt;    &amp;lt;SnippetType&amp;gt;SurroundsWith&amp;lt;&amp;#47;SnippetType&amp;gt;&lt;br /&gt;   &amp;lt;&amp;#47;SnippetTypes&amp;gt;&lt;br /&gt;  &amp;lt;&amp;#47;Header&amp;gt;&lt;br /&gt;  &amp;lt;Snippet&amp;gt;&lt;br /&gt;   &amp;lt;Declarations&amp;gt;&lt;br /&gt;    &amp;lt;Literal&amp;gt;&lt;br /&gt;     &amp;lt;ID&amp;gt;SPWebName&amp;lt;&amp;#47;ID&amp;gt;&lt;br /&gt;     &amp;lt;ToolTip&amp;gt;SPWeb Object name&amp;lt;&amp;#47;ToolTip&amp;gt;&lt;br /&gt;     &amp;lt;Default&amp;gt;oSPWeb&amp;lt;&amp;#47;Default&amp;gt;&lt;br /&gt;    &amp;lt;&amp;#47;Literal&amp;gt;&lt;br /&gt;    &amp;lt;Literal&amp;gt;&lt;br /&gt;     &amp;lt;ID&amp;gt;SPSiteName&amp;lt;&amp;#47;ID&amp;gt;&lt;br /&gt;     &amp;lt;ToolTip&amp;gt;SPSite Object name&amp;lt;&amp;#47;ToolTip&amp;gt;&lt;br /&gt;     &amp;lt;Default&amp;gt;oSPSite&amp;lt;&amp;#47;Default&amp;gt;&lt;br /&gt;    &amp;lt;&amp;#47;Literal&amp;gt;&lt;br /&gt;   &amp;lt;&amp;#47;Declarations&amp;gt;&lt;br /&gt;   &amp;lt;Code Language="csharp"&amp;gt;&lt;br /&gt;    &amp;lt;![CDATA[using(SPSite $SPSiteName$ = new SPSite("http:&amp;#47;&amp;#47;server"))&lt;br /&gt;    {&lt;br /&gt;     using(SPWeb $SPWebName$ = $SPSiteName$.OpenWeb())&lt;br /&gt;     {&lt;br /&gt;    &lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;  ]]&amp;gt;&lt;br /&gt;   &amp;lt;&amp;#47;Code&amp;gt;&lt;br /&gt;  &amp;lt;&amp;#47;Snippet&amp;gt;&lt;br /&gt; &amp;lt;&amp;#47;CodeSnippet&amp;gt;&lt;br /&gt;&amp;lt;&amp;#47;CodeSnippets&amp;gt;&lt;br /&gt;&lt;br /&gt;2. Copythis spweb.snippet file to "C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#" folder.&lt;br /&gt;&lt;br /&gt;3. Open your VS 2005 project and right click select "Insert Snippet..", from the list select spweb.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_b8vnd3hatKE/R4c3I_FqPWI/AAAAAAAAAA0/w92nORmcWr0/s1600-h/snip1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_b8vnd3hatKE/R4c3I_FqPWI/AAAAAAAAAA0/w92nORmcWr0/s320/snip1.JPG" alt="" id="BLOGGER_PHOTO_ID_5154148926062476642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. Following code will be added to your project:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_b8vnd3hatKE/R4c3ZfFqPXI/AAAAAAAAAA8/3jjygYGq298/s1600-h/sni2.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_b8vnd3hatKE/R4c3ZfFqPXI/AAAAAAAAAA8/3jjygYGq298/s320/sni2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5154149209530318194" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-4495176967152408339?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/4495176967152408339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=4495176967152408339' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4495176967152408339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4495176967152408339'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/vs-2005-code-snippet-for-spweb-and.html' title='VS 2005 Code Snippet for SPWeb and SPSite (Best practice)'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_b8vnd3hatKE/R4c3I_FqPWI/AAAAAAAAAA0/w92nORmcWr0/s72-c/snip1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-1404214389014369487</id><published>2008-01-10T20:30:00.000-08:00</published><updated>2008-01-10T21:03:10.523-08:00</updated><title type='text'>Yahoo , MSN messenger presence detection</title><content type='html'>Using SharePoint Content Editor WebPart you can show online presence, use the html code to show your YAHOO and MSN messenger online status. After rendering the webpart the presence status looks like this:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_b8vnd3hatKE/R4b35fFqPVI/AAAAAAAAAAs/2eXKgm_laPk/s1600-h/presence.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_b8vnd3hatKE/R4b35fFqPVI/AAAAAAAAAAs/2eXKgm_laPk/s320/presence.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5154079390541954386" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Follow these steps to show your online presence:&lt;br /&gt;1) Edit page&lt;br /&gt;2) Add Content Editor Webpart to your page&lt;br /&gt;3) Copy following html (add your MSN and Yahoo messenger id)&lt;br /&gt;4) Save the page&lt;br /&gt;&lt;br /&gt;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;&amp;lt;span&amp;gt;&amp;lt;img border="0" height="12" width="12" src="&amp;#47;_layouts&amp;#47;images&amp;#47;imnhdr.gif" onload="IMNRC('your@msnid.com')" ShowOfflinePawn="1" id="MSNID1" &amp;#47;&amp;gt;your name&amp;lt;&amp;#47;span&amp;gt;&lt;br /&gt;&amp;lt;&amp;#47;td&amp;gt;&amp;lt;&amp;#47;tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;&amp;lt;a href="http:&amp;#47;&amp;#47;edit.yahoo.com&amp;#47;config&amp;#47;send_webmesg?.target=your_yahooid&amp;.src=pg"&amp;gt;&lt;br /&gt;&amp;lt;img border=0 src="http:&amp;#47;&amp;#47;opi.yahoo.com&amp;#47;online?u=your_yahooid&amp;m=g&amp;t=0"&amp;gt;your name&amp;lt;&amp;#47;a&amp;gt;&lt;br /&gt;&amp;lt;&amp;#47;td&amp;gt;&amp;lt;&amp;#47;tr&amp;gt;&amp;lt;&amp;#47;table&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-1404214389014369487?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/1404214389014369487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=1404214389014369487' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1404214389014369487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/1404214389014369487'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/yahoo-msn-messenger-presence-detection.html' title='Yahoo , MSN messenger presence detection'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_b8vnd3hatKE/R4b35fFqPVI/AAAAAAAAAAs/2eXKgm_laPk/s72-c/presence.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-4000784103505528780</id><published>2008-01-09T21:50:00.000-08:00</published><updated>2009-02-09T20:37:43.811-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search'/><title type='text'>How to read raw XML from SharePoint search results</title><content type='html'>SharePoint search results can be customized by altering the search result XSL. For developing and testing our custom XSL we need sample search results in XML format. Following XML code snippet can be used to get search results in raw XML format:&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" &amp;gt;&lt;br /&gt;&amp;lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" /&amp;gt;&lt;br /&gt;&amp;lt;xsl:template match="/"&amp;gt;&lt;br /&gt;&amp;lt;xmp&amp;gt;&amp;lt;xsl:copy-of select="*"/&amp;gt;&amp;lt;/xmp&amp;gt;&lt;br /&gt;&amp;lt;/xsl:template&amp;gt;&lt;br /&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;&lt;br /&gt;Follow these steps to configure the XSL:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Edit search results page, modify "Search Core Results" webpart&lt;/li&gt;&lt;li&gt;Click on XSL Editor button under "Data View Properties".&lt;/li&gt;&lt;li&gt;Replace the XSL with above XSL snippet.&lt;/li&gt;&lt;li&gt;Save the page.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-4000784103505528780?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/4000784103505528780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=4000784103505528780' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4000784103505528780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4000784103505528780'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/how-to-read-raw-xml-from-sharepoint.html' title='How to read raw XML from SharePoint search results'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-3403967509800714949</id><published>2008-01-08T00:14:00.000-08:00</published><updated>2008-01-08T07:51:08.345-08:00</updated><title type='text'>Send document links on mail using Content Query webpart</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;Content Query Webpart can be used to show sharepoint site content. This is one of the coolest webpart in MOSS 2007. Content from site collection, sub sites and lists can be displayed using this webpart. It provides lot of filtering, sorting and grouping options. The display can also be changed as per our requirement. In this blog post , showing how we can use this webpart to show documents in a document library and also provide an interface to mail the document link. Following is sample UI of content query webpart after applying custom styles:&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_b8vnd3hatKE/R4M3KPFqPRI/AAAAAAAAAAM/vXxB1imOgNw/s1600-h/cqwp.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5153023047630470418" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_b8vnd3hatKE/R4M3KPFqPRI/AAAAAAAAAAM/vXxB1imOgNw/s400/cqwp.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;p&gt;&lt;br /&gt;On clicking the mail icon, configured mail application opens with document link inside mail body and subject as document name.&lt;br /&gt;Following is steps to get this done: &lt;/p&gt;&lt;ol&gt;&lt;li&gt;Add content query webpart to your page &lt;/li&gt;&lt;li&gt;Configure your contetn query webpart to point to the document library. Apply other filters if required.&lt;/li&gt;&lt;li&gt;Select List Type "Document Library"&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_b8vnd3hatKE/R4OaDfFqPTI/AAAAAAAAAAc/cFpKtPv56rs/s1600-h/cqwp1.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5153131783317503282" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_b8vnd3hatKE/R4OaDfFqPTI/AAAAAAAAAAc/cFpKtPv56rs/s320/cqwp1.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/li&gt;&lt;p&gt;4. Add custom style. This can be done by updating ItemStyle.xsl.&lt;/p&gt;&lt;p&gt;5. Open SharePoint Designer, Open ItemStyle.xsl file from Style Library&gt;XSL Style Sheets folder.&lt;/p&gt;&lt;p&gt;6. Make sure you checkout the file before making changes.In this file, each "&amp;lt;xsl:template" node indiates a Item style.&lt;/p&gt;&lt;p&gt;7. Add custom style node provided at the end (check at the end of the post).&lt;/p&gt;&lt;p&gt;8. Create SendMail.js file (check at the end of the post). And copy it in _layouts folder (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS).&lt;/p&gt;&lt;p&gt;9. Copy the mailto image file to image folder (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES). f. Save and checkin ItemStyle.xsl file&lt;/p&gt;&lt;p&gt;10. Now edit the Content Query Webpart, Expand the "Presentation" group under content query tool part.&lt;/p&gt;&lt;p&gt;11. Here you will find the new styles that we added under ItemStyles:&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_b8vnd3hatKE/R4M9evFqPSI/AAAAAAAAAAU/J7IzilrTOBI/s1600-h/cqwp2.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5153029996887555362" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_b8vnd3hatKE/R4M9evFqPSI/AAAAAAAAAAU/J7IzilrTOBI/s320/cqwp2.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;12. Select the "MailDocs" style &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;ItemStyle.xsl node:&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;&amp;lt;xsl:template name="MailDocs" match="Row[@Style='MailDocs']" mode="itemstyle"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:variable name="SafeLinkUrl"&amp;gt;&lt;br /&gt;&amp;lt;xsl:call-template name="OuterTemplate.GetSafeLink"&amp;gt;&lt;br /&gt;&amp;lt;xsl:with-param name="UrlColumnName" select="'LinkUrl'"/&amp;gt;&lt;br /&gt;&amp;lt;/xsl:call-template&amp;gt;&lt;br /&gt;&amp;lt;/xsl:variable&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:variable name="DisplayTitle"&amp;gt;&lt;br /&gt;&amp;lt;xsl:call-template name="OuterTemplate.GetTitle"&amp;gt;&lt;br /&gt;&amp;lt;xsl:with-param name="Title" select="@Title"/&amp;gt;&lt;br /&gt;&amp;lt;xsl:with-param name="UrlColumnName" select="'LinkUrl'"/&amp;gt;&lt;br /&gt;&amp;lt;/xsl:call-template&amp;gt;&lt;br /&gt;&amp;lt;/xsl:variable&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:variable name="LinkTarget"&amp;gt;&lt;br /&gt;&amp;lt;xsl:if test="@OpenInNewWindow = 'True'" &amp;gt;_blank&amp;lt;/xsl:if&amp;gt;&lt;br /&gt;&amp;lt;/xsl:variable&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:variable name="DisplayDate"&amp;gt;&lt;br /&gt;&amp;lt;xsl:call-template name="OuterTemplate.GetTitle"&amp;gt;&lt;br /&gt;&amp;lt;xsl:with-param name="Title" select="@Created"/&amp;gt;&lt;br /&gt;&amp;lt;/xsl:call-template&amp;gt;&lt;br /&gt;&amp;lt;/xsl:variable&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;table width="299" border="0" cellspacing="0" cellpadding="0"&amp;gt;&amp;lt;tr align="left" valign="top"&amp;gt;&lt;br /&gt;&amp;lt;td width="220" height="25" valign="middle" class="BodyText"&amp;gt;&lt;br /&gt;&amp;lt;span&amp;gt;&amp;lt;a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}"&amp;gt;&lt;br /&gt;&amp;lt;script type='text/javascript' language='javascript' src='http://aditidt142vpc:5927/_layouts/SendMail.js'&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;xsl:value-of select="$DisplayTitle" /&amp;gt;&lt;br /&gt;&amp;lt;/a&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td valign="middle" &amp;gt;&lt;br /&gt;&amp;lt;a href="#"&amp;gt;&lt;br /&gt;&amp;lt;xsl:attribute name="onClick"&amp;gt;javascript:SendMail('&amp;lt;xsl:value-of select="$DisplayTitle" /&amp;gt;','&amp;lt;xsl:value-of select="@LinkUrl" /&amp;gt;')&amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;&amp;lt;img src="../_layouts/images/Mailicon.jpg" width="16" height="12" style="border-width:0px;"/&amp;gt;&lt;br /&gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/xsl:template&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;SendMail.js&lt;/p&gt;&lt;p&gt;---------------------------------------------&lt;/p&gt;&lt;p&gt;function SendMail(docName, docURL)&lt;br /&gt;{   &lt;br /&gt;    var subject = docName;&lt;br /&gt;    window.location = 'mailto:?subject='+subject+'&amp;amp;Content-Type=text/html&amp;amp;body=Click the Link below to view the document%0A' + docURL;&lt;br /&gt;    return false;&lt;br /&gt;}&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-3403967509800714949?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/3403967509800714949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=3403967509800714949' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3403967509800714949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3403967509800714949'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/send-document-links-on-mail-using.html' title='Send document links on mail using Content Query webpart'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_b8vnd3hatKE/R4M3KPFqPRI/AAAAAAAAAAM/vXxB1imOgNw/s72-c/cqwp.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-2068289002085549981</id><published>2008-01-02T06:11:00.000-08:00</published><updated>2008-01-03T07:17:49.196-08:00</updated><title type='text'>Using SSRS Reports in SharePoint integrated mode with Custom Authentication</title><content type='html'>&lt;span style="font-family:arial;"&gt;Just sharing the problem that we faced while deploying SSRS reports on SharePoint.&lt;br /&gt;SSRS was configured in SharePoint integrated mode with form based authentication. While trying to access reports from report viewer webpart we got following error:&lt;br /&gt;Object moved Object moved to here&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;This issue was fixed after applying SQL Server hotffix &lt;a href="http://support.microsoft.com/kb/939942"&gt;http://support.microsoft.com/kb/939942&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When we extended default zone to Internet zone with FBA we got following error:&lt;br /&gt;"The specified path refers to a SharePoint zone that is not supported. The default zone path must be used."&lt;br /&gt;After googling found that SSRS SharePoint integrated mode works only with default zone and it is not supported on any other zones (Intranet, Extranet or Custom).&lt;br /&gt;Following blog has more details on this problem:&lt;br /&gt;&lt;a href="http://www.sharepointblogs.com/nrdev/archive/2007/06/21/ssrs-in-sharepoint-2007-site-using-forms-based-authentication-sharepoint-integrated-mode.aspx"&gt;http://www.sharepointblogs.com/nrdev/archive/2007/06/21/ssrs-in-sharepoint-2007-site-using-forms-based-authentication-sharepoint-integrated-mode.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also found following excellent guide on installing and configuring SSRS in SharePoint integrated mode:&lt;br /&gt;&lt;a href="http://blogs.msdn.com/sharepoint/attachment/4194088.ashx"&gt;http://blogs.msdn.com/sharepoint/attachment/4194088.ashx&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-2068289002085549981?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/2068289002085549981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=2068289002085549981' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2068289002085549981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/2068289002085549981'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2008/01/using-ssrs-reports-in-sharepoint.html' title='Using SSRS Reports in SharePoint integrated mode with Custom Authentication'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-3936877687094712677</id><published>2007-12-25T23:34:00.000-08:00</published><updated>2007-12-25T23:40:38.124-08:00</updated><title type='text'>SharePoint Stylesheet (CSS) reference</title><content type='html'>Found some useful links on SharePoint CSS reference.&lt;br /&gt;Following two links provide reference to MOSS 2007 CSS:&lt;br /&gt;&lt;span style="font-size: 11pt; color: rgb(31, 73, 125); font-family: 'Calibri','sans-serif';"&gt;http://msdn2.microsoft.com/en-us/library/ms438349.aspx&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; color: rgb(31, 73, 125); font-family: 'Calibri','sans-serif';"&gt;&lt;a href="/exchweb/bin/redir.asp?URL=http://www.heathersolomon.com/content/sp07cssreference.htm" target="_blank"&gt;http://www.heathersolomon.com/content/sp07cssreference.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And this one for SharePoint 2003 CSS reference:&lt;br /&gt;http://www.sharepointcustomization.com/resources/tipstricks/wss_cssguide.htm&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-3936877687094712677?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/3936877687094712677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=3936877687094712677' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3936877687094712677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/3936877687094712677'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2007/12/sharepoint-stylesheet-css-reference.html' title='SharePoint Stylesheet (CSS) reference'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-4930380931722674691</id><published>2007-12-19T04:37:00.000-08:00</published><updated>2007-12-19T04:42:41.795-08:00</updated><title type='text'>Diffrence between SPWeb.Users and SPWeb.SiteUsers of SharePoint Server 2007</title><content type='html'>&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;SPWeb.Users&lt;/td&gt;&lt;td&gt;Property returns collection of user objects that are explicitly assigned permissions.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;SPWeb.SiteUsers&lt;/td&gt;&lt;td&gt;Property returns collection of user objects that belong to site collection.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Following code returns an error message "user not found" if the user is not assigned explicit permission:&lt;br /&gt;&lt;span style="color:#000066;"&gt;SPSite site = new SPSite("http://servername/testsite");&lt;br /&gt;SPWeb web = site.OpenWeb();&lt;br /&gt;SPUser user = web.Users[@"domainname\username"];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After assigning explicit permission to the user (from site settings&gt;Permissions&gt;Add Users) the above code runs without any error.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-4930380931722674691?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/4930380931722674691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=4930380931722674691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4930380931722674691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4930380931722674691'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2007/12/diffrence-between-spwebusers-and.html' title='Diffrence between SPWeb.Users and SPWeb.SiteUsers of SharePoint Server 2007'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5714440201609676844.post-4251365175506059809</id><published>2007-12-19T04:31:00.000-08:00</published><updated>2007-12-19T04:37:16.670-08:00</updated><title type='text'>Impersonating SharePoint portal user through API</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;SharePoint portal logged in user context can be changed programatically by using SPSite object.&lt;br /&gt;SPSite object provides overloaded constructor which takes SPUserToken as parameter. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Following code snippet shows how logged in user context can be changed: &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;color:#000099;"&gt;SPUser user = SPContext.Current.Web.SiteUsers[@"domainname\username"];&lt;br /&gt;using(SPSite oSiteCollection = new SPSite("&lt;/span&gt;&lt;a href="http://server/sites/default.aspx"&gt;&lt;span style="font-family:arial;font-size:85%;color:#000099;"&gt;http://Server/&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;font-size:85%;color:#000099;"&gt;", user.UserToken))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;color:#000099;"&gt;{   //write your code here&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;color:#000099;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;It is not possible to change the user context of an SPSite object once it has been created. Switching users requires creating a new SPSite object.&lt;br /&gt;Check this MSDN link for more details:&lt;/span&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms469253.aspx"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;http://msdn2.microsoft.com/en-us/library/ms469253.aspx&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5714440201609676844-4251365175506059809?l=sridharu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sridharu.blogspot.com/feeds/4251365175506059809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5714440201609676844&amp;postID=4251365175506059809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4251365175506059809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5714440201609676844/posts/default/4251365175506059809'/><link rel='alternate' type='text/html' href='http://sridharu.blogspot.com/2007/12/impersonating-sharepoint-portal-user.html' title='Impersonating SharePoint portal user through API'/><author><name>Sridhar</name><uri>http://www.blogger.com/profile/15660325345703773361</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
