<?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:blogger='http://schemas.google.com/blogger/2008' 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-8930273875748579641</id><updated>2024-11-06T08:27:03.734+05:30</updated><category term="SharePoint"/><category term="Absolute Position"/><category term="C#"/><category term="Sharepiont"/><category term="ASP.Net"/><category term="Batch Deleting"/><category term="Batch Updating"/><category term="IIS7"/><category term="InfoPath Forms"/><category term="JQuery"/><category term="JavaScript"/><category term="Read Resource File"/><category term="SPDisposeCheck"/><category term="SQL"/><title type='text'>Development Tips &amp;amp; Tricks</title><subtitle type='html'>SharePoint | ASP.Net | C# | Infopath Forms | CSS | Javascript | JQuery</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-2788023742578996084</id><published>2011-12-22T15:16:00.001+05:30</published><updated>2011-12-22T15:28:09.829+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Batch Deleting"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><title type='text'>SharePoint Batch Deleting List Items Programatically</title><content type='html'>While working on a custom SharePoint solution, I had a requirement to delete multiple list items one time rather than deleting one by one.&lt;br /&gt;
&lt;b&gt;Example&lt;/b&gt;: Delete only the items from a list which doesn&#39;t have value for a custom column.&lt;br /&gt;
&lt;br /&gt;
When i think of the solution i couldn&#39;t make new &lt;b&gt;SPListItemCollection&lt;/b&gt; object out of the items which needs to be deleted, which is possible in regular c# application development.&lt;br /&gt;
However in SharePoint we can do the batch delete of list items using CAML script.&lt;br /&gt;
The CAML script needs to be generated for the items which needs to be deleted as below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Get the list items:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;SPListItemCollection items = spList.Items;
&lt;/pre&gt;&lt;b&gt;Generate CAML Script:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;StringBuilder methodBuilder = new StringBuilder();

string batchFormat = &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot;?&gt;&quot; +
&quot;&lt;ows:Batch OnError=\&quot;Return\&quot;&gt;{0}&lt;/ows:Batch&gt;&quot;; //{0}-methodFormat

string methodFormat = &quot;&lt;method ID=\&quot;{0}\&quot;&gt;&quot; + //{0}-Unique Value for each Item
&quot;&lt;setlist Scope=\&quot;Request\&quot;&gt;{1}&lt;/SetList&gt;&quot; + //{1}-List Guid
&quot;&lt;setvar Name=\&quot;ID\&quot;&gt;{2}&lt;/SetVar&gt;&quot; + //{2}-List ItemID
&quot;&lt;setvar Name=\&quot;Cmd\&quot;&gt;Delete&lt;/SetVar&gt;&quot; +
&quot;&lt;/Method&gt;&quot;;

// Build the CAML delete command script.
foreach (SPListItem item in items)
{
    //get the custom column value
    string customColumnValue = string.Empty;
    if (null != item[&quot;CustomColumnName&quot;])
        customColumnValue = item[&quot;CustomColumnName&quot;].ToString();
    
    //check whether custom column is empty
    if (string.IsNullOrEmpty(customColumnValue))
    {
        methodBuilder.AppendFormat(methodFormat, item.ID, item.ParentList.ID, item.ID);
    }
}

//batch delete script.  
string batchDeleteScript = string.Format(batchFormat, methodBuilder.ToString());
&lt;/pre&gt;&lt;b&gt;Execute CAML Script:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;spWeb.ProcessBatchData(batchDeleteScript);
&lt;/pre&gt;&lt;b&gt;Similarly batch updating script can also be generated. Look at the detailed post &lt;a href=&quot;http://developmenttricks.blogspot.com/2011/12/sharepoint-batch-updating-list-items.html&quot;&gt;here&lt;/a&gt; for code.&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/2788023742578996084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/sharepoint-batch-deleting-list-items.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/2788023742578996084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/2788023742578996084'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/sharepoint-batch-deleting-list-items.html' title='SharePoint Batch Deleting List Items Programatically'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-3546346009225064408</id><published>2011-12-22T13:58:00.001+05:30</published><updated>2011-12-22T15:27:54.650+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Batch Updating"/><category scheme="http://www.blogger.com/atom/ns#" term="Sharepiont"/><title type='text'>SharePoint Batch Updating List Items Programatically</title><content type='html'>While working on a custom SharePoint solution, I had a requirement to update multiple list items one time rather than updating one by one.&lt;br /&gt;
&lt;b&gt;Example&lt;/b&gt;: Update only the items in a list which doesn&#39;t have value for a custom column (update with some value).&lt;br /&gt;
&lt;br /&gt;
When i think of the solution i couldn&#39;t make new &lt;b&gt;SPListItemCollection&lt;/b&gt; object out of the items which needs to be updated, which is possible in regular c# application development.&lt;br /&gt;
However in SharePoint we can do the batch update of list items using CAML script.&lt;br /&gt;
The CAML script needs to be generated for the items which needs to be updated as below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Get the list items:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;SPListItemCollection items = spList.Items;
&lt;/pre&gt;&lt;b&gt;Generate CAML Script:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;StringBuilder methodBuilder = new StringBuilder();

string batchFormat = &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot;?&gt;&quot; +
&quot;&lt;ows:Batch OnError=\&quot;Return\&quot;&gt;{0}&lt;/ows:Batch&gt;&quot;; //{0}-methodFormat

string methodFormat = &quot;&lt;method ID=\&quot;{0}\&quot;&gt;&quot; + //{0}-Unique Value for each Item
&quot;&lt;setlist&gt;{1}&lt;/SetList&gt;&quot; + //{1}-List Guid
&quot;&lt;setvar Name=\&quot;Cmd\&quot;&gt;Save&lt;/SetVar&gt;&quot; +
&quot;&lt;setvar Name=\&quot;ID\&quot;&gt;{2}&lt;/SetVar&gt;&quot; + //{2}-List ItemID
&quot;&lt;setvar Name=\&quot;urn:schemas-microsoft-com:office:office#{3}\&quot;&gt;{4}&lt;/SetVar&gt;&quot; + //{3}-Column Name, {4}-Column Value
&quot;&lt;/Method&gt;&quot;;

// Build the CAML update command script.
foreach (SPListItem item in items)
{
    //get the custom column value
    string customColumnValue = string.Empty;
    if (null != item[&quot;CustomColumnName&quot;])
        customColumnValue = item[&quot;CustomColumnName&quot;].ToString();
    
    //check whether custom column is empty
    if (string.IsNullOrEmpty(customColumnValue))
    {
        methodBuilder.AppendFormat(methodFormat, item.ID, item.ParentList.ID, item.ID, &quot;CustomColumnName&quot;, &quot;New Updated Value&quot;);
    }
}

//batch update script.  
string batchUpdateScript = string.Format(batchFormat, methodBuilder.ToString());
&lt;/pre&gt;&lt;b&gt;Execute CAML Script:&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;spWeb.ProcessBatchData(batchUpdateScript);
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Similarly batch deleting script can also be generated. Look at the detailed post &lt;a href=&quot;http://developmenttricks.blogspot.com/2011/12/sharepoint-batch-deleting-list-items.html&quot;&gt;here&lt;/a&gt; for code.&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/3546346009225064408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/sharepoint-batch-updating-list-items.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/3546346009225064408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/3546346009225064408'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/sharepoint-batch-updating-list-items.html' title='SharePoint Batch Updating List Items Programatically'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-4101842007025252886</id><published>2011-12-20T18:14:00.000+05:30</published><updated>2011-12-22T15:30:17.808+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Absolute Position"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><title type='text'>JavaScript Find Absolute Position of element</title><content type='html'>&lt;b&gt;Scenario&lt;/b&gt;: Get coordinates of a element (X, Y) to display overlay message immediate next or immediate below the element.&lt;br /&gt;
Based on the coordinates set the absolute position of the control (overlay) to display it accordingly. The overlay can be started any side/corner of the element.&lt;br /&gt;
&lt;br /&gt;
Get the element object using JavaScript:&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;var obj = document.getElementById(&quot;controlelement&quot;);
&lt;/pre&gt;Get the position of the element from Left&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosLeft(obj) 
{
    var posLeft = 0;
    if (obj.offsetParent) 
    {
        while (obj.offsetParent) 
        {
            posLeft += obj.offsetLeft;
            obj = obj.offsetParent;
        }
    }
    else if (obj.x) 
    {
        posLeft += obj.x;
    }

    return posLeft;
}
&lt;/pre&gt;Get the position of the element from Top&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosTop(obj) 
{
    var posTop = 0;
    if (obj.offsetParent) 
    {
        while (obj.offsetParent) 
        {
            posTop += obj.offsetTop;
            obj = obj.offsetParent;
        }
    }
    else if (obj.y) 
    {
        posTop += obj.y;
    }
    return posTop;
}
&lt;/pre&gt;Get the position of the element from Bottom&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosBottom(obj) 
{
    var posBottom = 0;
    if (obj.offsetParent) 
    {
        posBottom += obj.offsetHeight;
        while (obj.offsetParent) 
        {
            posBottom += obj.offsetTop;
            obj = obj.offsetParent;
        }
    }
    else if (obj.y) 
    {
        posBottom += obj.y;
        posBottom += obj.height;
    }
    return posBottom;
}
&lt;/pre&gt;Get the position of the element from Right&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosRight(obj) 
{
    var posRight = 0;
    if (obj.offsetParent) 
    {
        posRight += obj.offsetWidth;
        while (obj.offsetParent) 
        {
            posRight += obj.offsetLeft;
            obj = obj.offsetParent;
        }
    }
    else if (obj.x) 
    {
        posRight += obj.x;
        posRight += obj.width;
    }
    return posRight;
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/4101842007025252886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/javascript-get-coordinates-of-element.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4101842007025252886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4101842007025252886'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/javascript-get-coordinates-of-element.html' title='JavaScript Find Absolute Position of element'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-4629020182338490598</id><published>2011-12-20T17:55:00.001+05:30</published><updated>2011-12-22T15:27:11.501+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Absolute Position"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><title type='text'>JQuery Find Absolute Position of element</title><content type='html'>&lt;b&gt;Scenario&lt;/b&gt;: Get coordinates of a element(X, Y) to display overlay message immediate next or immediate below the element.&lt;br /&gt;
Based on the coordinates  set the absolute position of the control (overlay) to display it accordingly. The overlay can be started any side/corner of the element.&lt;br /&gt;
&lt;br /&gt;
Get the element object using JQuery:&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;var obj = $(&#39;[id$=controlelement]&#39;);
&lt;/pre&gt;Get the position of the element from Left&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosLeft(obj) 
{
    var pos = obj.offset();
    var left = pos.left;
    return left;
}
&lt;/pre&gt;Get the position of the element from Top&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosTop(obj) 
{
    var pos = obj.offset();
    var top = pos.top;
    return top;
}
&lt;/pre&gt;Get the position of the element from Bottom&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosBottom(obj) 
{
    var pos = obj.offset();
    var top = pos.top;
    var height = obj.height();
    var bottom = top + height;
    return bottom;
}
&lt;/pre&gt;Get the position of the element from Right&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;function findPosRight(obj) 
{
    var pos = obj.offset();
    var left = pos.left;
    var width = obj.width();
    var right = left + width;
    return right;
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/4629020182338490598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/jquery-get-coordinates-of-element.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4629020182338490598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4629020182338490598'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/jquery-get-coordinates-of-element.html' title='JQuery Find Absolute Position of element'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1250928530689344190</id><published>2011-12-20T15:26:00.001+05:30</published><updated>2011-12-22T15:55:53.904+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><category scheme="http://www.blogger.com/atom/ns#" term="SPDisposeCheck"/><title type='text'>SharePoint Check Memory Leaks in Custom Solution Development</title><content type='html'>In any SharePoint custom solution development, it is very important to make sure there are no memory leaks in the code. If there are any memory leaks the performance will be down and might face unnecessary issues at run-time.&lt;br /&gt;
While developing the code every developer ensures that SPSite and SPWeb objects are disposed either way (using clause or dispose method). But in a bigger solutions there are always chances for missing them in manual verification.&lt;br /&gt;
&lt;br /&gt;
How good if there is a tool available to verify whether our solution (code) has any memory leaks, which can be checked in seconds of time. Yes there is a tool for the same. You can download it from &lt;a href=&quot;http://download.microsoft.com/download/B/4/D/B4D279A0-E159-40BF-A5E8-F49ABDBE95C7/SPDisposeCheck.msi&quot;&gt;SPDisposeChecker&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Even you can make this Tool as part of your visual studio Tools. &lt;a href=&quot;http://snahta.blogspot.com/2009/06/avoiding-memory-leaks-from-beggining.html&quot;&gt;Follow the simple 3 steps&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1250928530689344190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/sharepoint-check-memory-leaks-in-custom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1250928530689344190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1250928530689344190'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/sharepoint-check-memory-leaks-in-custom.html' title='SharePoint Check Memory Leaks in Custom Solution Development'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-8197626828267109145</id><published>2011-12-20T14:42:00.001+05:30</published><updated>2011-12-22T16:47:29.404+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Read Resource File"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><title type='text'>SharePoint Read Resource File Programatically</title><content type='html'>SharePoint custom solution development might requires some dynamic or configuration values. Generally the high level configurations can be stored in web.config(Ex: external connection string). But if there are more number of configurations required (Es: List columns, Content type names etc.,) we cannot store them in .config file as it is not safe.&lt;br /&gt;
&lt;br /&gt;
So here the resource file comes into picture. Resource file is XML-Based file which holds the data in key-value pair. Resource file is generally used to store huge configurations for re-usability &amp; consistency and Localization.&lt;br /&gt;
&lt;br /&gt;
Resource file (.resx) should be added to &lt;b&gt;12\Resources&lt;/b&gt; directory in the solution as a new item.&lt;br /&gt;
The name format is &lt;b&gt;SampleResourceFile.en-US.resx&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Usage&lt;/b&gt;:&lt;br /&gt;
If the solution provides provisioning of lists or libraries with multiple columns programatically using either code or xml, All the column names can be stored in Resource file as a Key-Value pair. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Read Resource File: XML&lt;/b&gt;&lt;br /&gt;
The resource value for a key can be read in XML as below.&lt;br /&gt;
&lt;pre class=&quot;xml&quot; name=&quot;code&quot;&gt;&lt;fieldref Name=&quot;$Resources:SampleResourceFile,CustomColumnNameKey&quot; ID=&quot;{8CFF7E12-722B-4a9e-B553-219F21AC77D6}&quot; Required=&quot;FALSE&quot; /&gt;&lt;/pre&gt;&lt;b&gt;Read Resource File: C# Code&lt;/b&gt;&lt;br /&gt;
The resource value for a key can be read in c# as below.&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;string customColumnNameKey = SPUtility.GetLocalizedString(&quot;$Resources:CustomColumnNameKey&quot;, SampleResourceFile, (uint)CultureInfo.CurrentCulture.LCID); //LCIT is current local languare
&lt;/pre&gt;To read the resource file programatically, a common wrapper class can be created to read the resource file throughout the solution by passing the key.&lt;br /&gt;
&lt;pre class=&quot;xml&quot; name=&quot;code&quot;&gt;public class Resources
{
    /// Resource File Name.
    /// Filename can be configured in web.configured or can be used as constant.
    private const string RESOURCE_FILE_NAME = &quot;SampleResourceFile&quot;;

    /// Method to get the singleton instance.
    public static string GetValue(string key)
    {
        return SPUtility.GetLocalizedString(&quot;$Resources:&quot; + key, RESOURCE_FILE_NAME, (uint)CultureInfo.CurrentCulture.LCID);
    }
}

string customColumnName = Resources.GetValue(&quot;CustomColumnNameKey&quot;);
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/8197626828267109145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/how-to-read-sharepoint-resource-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/8197626828267109145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/8197626828267109145'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/12/how-to-read-sharepoint-resource-file.html' title='SharePoint Read Resource File Programatically'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-2203440729736142739</id><published>2011-08-26T16:39:00.001+05:30</published><updated>2011-12-20T14:40:47.971+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Sharepiont"/><title type='text'>How To Download Folder from SharePoint Document Library or List</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Scenario&lt;/b&gt;: SharePoint document library download folder&lt;br /&gt;
&lt;br /&gt;
Generally SharePoint is used for Content &amp;amp; Document Management System. If it is more of Document Management System, users will upload and download files and documents quite often to/from document library or list.&lt;br /&gt;
&lt;br /&gt;
Downloading a single document or file is straight forward, by clicking on the file. But there is no straight way to download folder from SharePoint document library. And downloading one by one file from a library is hectic if it has has more number of files (say 100s).&lt;br /&gt;
&lt;br /&gt;
However a folder with all the files can be downloaded easily by following the below steps:&lt;br /&gt;
1. Go to the document library or list.&lt;br /&gt;
2. Open &lt;b&gt;Explorer View&lt;/b&gt; of the respective document library.&lt;br /&gt;
3. Drag &amp;amp; Drop the folder from library to local drive.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;OR&lt;/b&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Select the folder -&amp;gt; right click -&amp;gt; copy, then paste it on the local drive.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/2203440729736142739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-download-folder-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/2203440729736142739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/2203440729736142739'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-download-folder-from.html' title='How To Download Folder from SharePoint Document Library or List'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1223538992690867556</id><published>2011-08-23T12:14:00.001+05:30</published><updated>2011-12-20T14:41:20.344+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="IIS7"/><title type='text'>How To Install IIS7 on Windows7 and Windows Vista</title><content type='html'>I have faced issues in configuring/installing II7 on my machine (which has windows 7 installed) from Control Panel -&gt; Program Files -&gt; Turn Windows features on or off. It is always throwing an error message &quot;one or more components are not installed&quot;.&lt;br /&gt;
&lt;br /&gt;
To address this i found a nice(microsoft) tool &lt;a href=&quot;http://www.microsoft.com/web/downloads/platform.aspx&quot;&gt;Microsoft Web Platform Installer&lt;/a&gt;, which installs II7 in a single click.&lt;br /&gt;
And also it provides many other microsoft related features installation/configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji8U7hrp1m0Jafzek2dHcKRzGZLOWMYy3heyfYrI9Q3oI_X487CqIqwZ0wYLQloB0sCGA_AySzVq49K3pesShyzxowJvP-BX7Pq4sXaVT-fonI39rmNCRhT2PLQpennyoSeV4lH2Uzp4g/s1600/MS+Web+Platform+Installer.JPG&quot; imageanchor=&quot;1&quot; style=&quot;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji8U7hrp1m0Jafzek2dHcKRzGZLOWMYy3heyfYrI9Q3oI_X487CqIqwZ0wYLQloB0sCGA_AySzVq49K3pesShyzxowJvP-BX7Pq4sXaVT-fonI39rmNCRhT2PLQpennyoSeV4lH2Uzp4g/s320/MS+Web+Platform+Installer.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1223538992690867556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/how-to-installing-iis-7-on-windows-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1223538992690867556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1223538992690867556'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/how-to-installing-iis-7-on-windows-7.html' title='How To Install IIS7 on Windows7 and Windows Vista'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji8U7hrp1m0Jafzek2dHcKRzGZLOWMYy3heyfYrI9Q3oI_X487CqIqwZ0wYLQloB0sCGA_AySzVq49K3pesShyzxowJvP-BX7Pq4sXaVT-fonI39rmNCRhT2PLQpennyoSeV4lH2Uzp4g/s72-c/MS+Web+Platform+Installer.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1927029299919984570</id><published>2011-08-23T11:33:00.000+05:30</published><updated>2011-12-20T14:41:29.216+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>How To Repair SUSPECT Database</title><content type='html'>Sometimes we see a SharePoint error &quot;Cannot connect to the configuration database&quot;. One of the reasons for this could be the Respective DataBase is set to &lt;b&gt;SUSPECT&lt;/b&gt; mode.&lt;br /&gt;
&lt;br /&gt;
Reasons for database SUSPECT state:&lt;br /&gt;
1. Database corruption.&lt;br /&gt;
2. Not enough space for the SQL Server to recover the database during startup.&lt;br /&gt;
3. Insufficient memory or disk space.&lt;br /&gt;
4. Unexpected SQL Server Shutdown, Power failure or a Hardware failure.&lt;br /&gt;
&lt;br /&gt;
Follow the below steps to repair the SUSPECT database:&lt;br /&gt;
1. Identify all the databases which are in SUSPECT mode&lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;USE master
GO
SELECT NAME,STATE_DESC FROM SYS.DATABASES 
WHERE STATE_DESC=&#39;SUSPECT&#39;
GO
&lt;/pre&gt;&lt;b&gt;Note:&lt;/b&gt;Check the latest log for the database which is marked as suspect. &lt;br /&gt;
SQL Server -&gt; Management -&gt; SQL Server Logs&lt;br /&gt;
&lt;br /&gt;
2. Get the database first into EMERGENCY mode to repair it&lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;USE master
GO 
ALTER DATABASE &quot;databasename&quot; SET EMERGENCY
GO
&lt;/pre&gt;&lt;b&gt;Note:&lt;/b&gt; The EMERGENCY database is one way which means read-only.&lt;br /&gt;
&lt;br /&gt;
3. Repair the Database in emergency mode&lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;DBCC checkdb(&#39;databasename&#39;)
ALTER DATABASE &quot;databasename&quot; SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (&#39;databasename&#39;, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE &quot;databasename&quot; SET MULTI_USER
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1927029299919984570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/how-to-repair-suspect-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1927029299919984570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1927029299919984570'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/how-to-repair-suspect-database.html' title='How To Repair SUSPECT Database'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-5644304610094369365</id><published>2011-08-11T17:23:00.002+05:30</published><updated>2011-08-11T17:33:22.365+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><title type='text'>SharePoint Feature Activation Dependency</title><content type='html'>&lt;b&gt;Scinario:&lt;/b&gt;&lt;br /&gt;
While provisiong two dependent(one on the other) content/solutions through different features, it is that one of the features might need the resources of other while gettting activated. In this scinario the first feature should be activated before the second, to avoid the dependency issues.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
Feature 1. Custom Content Type&lt;br /&gt;
Feature 2. Page with Custom Content Type (dependent on custom content type)&lt;br /&gt;
&lt;br /&gt;
To make sure the same through feature provisioning instead manually, we have feature activation dependency attribute which can be specified in feature.xml file. Which doesn&#39;t allow to get activated unless until the dependency feature(s) is activated.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;xml&quot; name=&quot;code&quot;&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;feature Id=&quot;BA43F694-A057-4C28-AA36-CF402A0A5BF1&quot;
  Title=&quot;Feature Dependency: Page with Custom Content Type&quot;
  Description=&quot;Feature Activation Dependency: Page with Custom Content Type.&quot;
  Version=&quot;1.0.0.0&quot;
  Hidden=&quot;FALSE&quot;
  Scope=&quot;Web&quot;
  DefaultResourceFile=&quot;core&quot;
  xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;

  &lt;elementmanifests&gt;
    &lt;elementmanifest Location=&quot;elements.xml&quot;/&gt;
  &lt;/ElementManifests&gt;

  &lt;activationdependencies&gt;
    &lt;!-- Custom Content Type --&gt;
    &lt;activationdependency FeatureId =&quot;1781D8FA-2423-40db-8922-B21C32BC1B7E&quot;/&gt;

    &lt;!-- Publishing Site Collection level Infrastructure feature --&gt;
    &lt;activationdependency FeatureId =&quot;F6924D36-2FA8-4f0b-B16D-06B7250180FA&quot;/&gt;

    &lt;!-- Publishing Web level feature --&gt;
    &lt;activationdependency FeatureId =&quot;94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB&quot;/&gt;
  &lt;/ActivationDependencies&gt;
&lt;/Feature&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt; Multiple dependencies can be specified for one feature.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/5644304610094369365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-set-feature-dependency.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/5644304610094369365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/5644304610094369365'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-set-feature-dependency.html' title='SharePoint Feature Activation Dependency'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-8286718316437686875</id><published>2011-08-11T16:45:00.000+05:30</published><updated>2011-08-11T16:45:23.112+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><title type='text'>SharePoint PageViewer WebPart Resize Issue</title><content type='html'>SharePoint OTB PageViewer works fine to display a static web page. But it has a Resizing issue when the source web page has some links which redirects to some other target pages (of more dimentions than source page) within the PageViewer webpart.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Issue/Scinario:&lt;/b&gt;&lt;br /&gt;
1. A custom search page of height 500x300 is added to pageviewer.&lt;br /&gt;
2. The results page with 2 results resize to 300x200.&lt;br /&gt;
Now say the result item link redirects to new web page of dimensions 600x500. As pageviewer doesn&#39;t support resizing the new page will be shown in 300x200 dimensions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;
A Content Editor WebPart instead PageViewer WebPart can be used with below iframe and source script to address the resize issue.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Limitations:&lt;/b&gt;&lt;br /&gt;
The content editor webpart height and width should be set to fixed values(for best page view).&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;js&quot; name=&quot;code&quot;&gt;&lt;iframe id=&quot;MyFrame&quot; src=&quot;/pages/testpage.aspx&quot; scrolling=&quot;no&quot; FRAMEBORDER=&quot;0&quot; border=&quot;0&quot; style=&quot;height:100% !important;width:100% !important; overflow:auto !important&quot; onload=&quot;setIframeHeight(&#39;MyFrame&#39;)&quot;&gt;&lt;/iframe&gt;

&lt;script type=&quot;text/javascript&quot;&gt;	
  function setIframeHeight(iframeName)
  {
	  var iframeWin = window.frames[iframeName];
	  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	  if (iframeEl &amp;&amp; iframeWin) 
         {
	    iframeEl.style.height = &quot;auto&quot;; // helps resize if new page is shorter than previous
	    iframeEl.style.height = 100 + &quot;%&quot;;
	  }
  }	
&lt;/script&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/8286718316437686875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-pageviewer-webpart-resize.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/8286718316437686875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/8286718316437686875'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-pageviewer-webpart-resize.html' title='SharePoint PageViewer WebPart Resize Issue'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1051187758751671819</id><published>2011-08-10T13:47:00.017+05:30</published><updated>2011-12-20T15:15:14.899+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><title type='text'>SharePoint Copy Survey from One Server to Another</title><content type='html'>Migrating the survey list from one location(server) to another location(server) is very simple, if we go for list template. But this process doesn&#39;t work if the requirement demands for the existing responses along with survey details.&lt;br /&gt;
&lt;br /&gt;
Though it copies all the survey details and responses details, the responded user(created by and modified by) and datetime (created and modified) details are replaced with current user (who is creating the survey with the template) and current datetime details.&lt;br /&gt;
&lt;br /&gt;
To copy the survey as is (all questions and responses) i found a nice codeplex tool &lt;b&gt;&lt;a href=&quot;http://spdeploymentwizard.codeplex.com/&quot;&gt;SharePoint Content Deployment Wizard&lt;/a&gt;&lt;/b&gt;. The post has the detailed documentation on what it can do and how can be used.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;This also works with limitations&lt;/b&gt;:&lt;br /&gt;
The settings of the source Survey should be set as follows before copying.&lt;br /&gt;
Go to Survey list -&gt; Survey Settings&lt;br /&gt;
1. &lt;b&gt;Allow multiple responses &lt;/b&gt;(Yes)(Advanced Settings)&lt;br /&gt;
2. &lt;b&gt;Edit access&lt;/b&gt;: Specify which responses users can edit  &lt;br /&gt;
All responses (Yes)(Title, Description and Navigation)&lt;br /&gt;
After copying the survey, the settings can be again changed to earlier state.&lt;br /&gt;
&lt;br /&gt;
It also helps in copying the following as well.&lt;br /&gt;
- site collections&lt;br /&gt;
- webs&lt;br /&gt;
- lists&lt;br /&gt;
- folders&lt;br /&gt;
- list items (including files)&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1051187758751671819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-copy-survery-from-one-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1051187758751671819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1051187758751671819'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-copy-survery-from-one-server.html' title='SharePoint Copy Survey from One Server to Another'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-6655746270312605797</id><published>2011-08-09T15:24:00.026+05:30</published><updated>2011-08-09T16:37:44.916+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><title type='text'>SharePoint ListItem New, Edit and Display forms Dynamic URLs</title><content type='html'>Getting the SharePoint List Item form URLs(New, Edit ad Display) dynamically respect to the context instead of hard-coding.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;SPListItem listItem = SPList.GetItemById(itemID);

// New form full url
string newFormFullUrl = string.Format(&quot;{0}{1}?ID={2}&quot;, listItem.Web.Url, listItem.ParentList.Forms[PAGETYPE.PAGE_NEWFORM].ServerRelativeUrl, listItem.ID);

// Edit form full url
string editFormFullUrl = string.Format(&quot;{0}{1}?ID={2}&quot;, listItem.Web.Url, listItem.ParentList.Forms[PAGETYPE.PAGE_EDITFORM].ServerRelativeUrl, listItem.ID);

// Display form full url
string displayFormFullUrl = string.Format(&quot;{0}{1}?ID={2}&quot;, listItem.Web.Url, listItem.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl, listItem.ID);

//Relative Url
string newFormRelativeUrl = string.Format(&quot;{0}?ID={1}&quot;, listItem.ParentList.Forms[PAGETYPE.PAGE_NEWFORM].ServerRelativeUrl, listItem.ID);
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/6655746270312605797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-listitem-new-edit-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/6655746270312605797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/6655746270312605797'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/08/sharepoint-listitem-new-edit-and.html' title='SharePoint ListItem New, Edit and Display forms Dynamic URLs'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-116600295171854015</id><published>2011-04-20T15:03:00.007+05:30</published><updated>2011-08-11T17:34:06.611+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>C# FileName Remove Special Characters not Allowed in FileName</title><content type='html'>While generating a filename programatically/dynamically by accepting the filename as user input, it is mandatory to make the raw filename valid by removing the special characters if given.&lt;br /&gt;
&lt;br /&gt;
The following are the special characters which are not allowed in filename.&lt;br /&gt;
&lt;b&gt;\/:*?&quot;&lt;&gt;|#%&amp;.{}~&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;Note&lt;/i&gt;: Period(.) is allowed but as filename can&#39;t be start or end with it and consecutive periods(.. or ...) are not allowed, considering it as invalid char for filename.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;using System;
using System.Linq;
private static string GetValidFileName(string rawFileName)
{
  string fileName = rawFileName;
  //special chars not allowed in filename
  string specialChars = @&quot;\/:*?&quot;&quot;&lt;&gt;|#%&amp;.{}~&quot;;
  //Replace special chars in raw filename with empty spaces to make it valid
  Array.ForEach(specialChars.ToCharArray(), specialChar =&gt; fileName = fileName.Replace(specialChar, &#39; &#39;));
  fileName = fileName.Replace(&quot; &quot;, string.Empty);//Recommended to remove the empty spaces in filename
  return fileName;
}
&lt;/pre&gt;&lt;br /&gt;
To know more about filename constraints, look at the detailed post &lt;b&gt;&lt;a href=&quot;http://support.microsoft.com/default.aspx?scid=kb;en-us;905231&quot;&gt;here&lt;/a&gt;&lt;/b&gt;.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/116600295171854015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/04/c-filename-remove-special-characters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/116600295171854015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/116600295171854015'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/04/c-filename-remove-special-characters.html' title='C# FileName Remove Special Characters not Allowed in FileName'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1750533863474442588</id><published>2011-03-30T19:30:00.001+05:30</published><updated>2011-03-31T00:33:56.724+05:30</updated><title type='text'>SharePoint Error Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack</title><content type='html'>One of the scenarios of getting this exception is with improper usage of SPSecurity.RunWithElevatedPrivileges.&lt;br /&gt;
&lt;br /&gt;
One of my posts &lt;a href=&quot;http://developmenttricks.blogspot.com/2011/03/sharepoint-spsecurityrunwithelevatedpri.html&quot;&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt; describes on proper usage of SPSecurity.RunWithElevatedPrivileges to address the same issue.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1750533863474442588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-error-unable-to-evaluate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1750533863474442588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1750533863474442588'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-error-unable-to-evaluate.html' title='SharePoint Error Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-4729196144780461766</id><published>2011-03-30T19:18:00.000+05:30</published><updated>2011-03-30T19:18:11.956+05:30</updated><title type='text'>SharePoint SPSecurity.RunWithElevatedPrivileges Usage</title><content type='html'>SPSecurity.RunWithElevatedPrivileges is used to run or execute the set of code statements in the context of an Application Pool Account instead of Current Logged in User.&lt;br /&gt;
&lt;br /&gt;
The below code snippet shows the implementation details.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;SPSecurity.RunWithElevatedPrivileges(delegate()
{
  using (SPSite site = new SPSite(SPContext.Current.Site.ID))
  {
    using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
    {
      web.AllowUnSafeUpdates = true;
      //Code to edit/delete the file in a library
      web.AllowUnsafeUpdates = false;
    }
  }
});
&lt;/pre&gt;SPContext.Current.Web can not be used directly with in the RunWithElevatedPrivileges block as the SPWeb object becomes a instance of current logged-in user&#39;s context and it gives the below error if tries to update any content in the same Web with READ only access.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Error&lt;/b&gt; : Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.&lt;br /&gt;
&lt;br /&gt;
To address the issue, a new instance of SPSite and SPWeb should be cerated within the RunWithElevatedPrivileges code block as above.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/4729196144780461766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-spsecurityrunwithelevatedpri.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4729196144780461766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4729196144780461766'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-spsecurityrunwithelevatedpri.html' title='SharePoint SPSecurity.RunWithElevatedPrivileges Usage'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1607848454302370579</id><published>2011-03-30T19:01:00.000+05:30</published><updated>2011-03-30T19:01:38.538+05:30</updated><title type='text'>SharePoint Layout Page for Only Administrator Accessible</title><content type='html'>SharePoint Layout (Application) pages are accessible by any user who has a least possible access/permissions for any of the sites in the server/farm.&lt;br /&gt;
&lt;br /&gt;
A layout page access can be restricted to only Site Administrator by overriding the &lt;b&gt;RequireSiteAdministrator&lt;/b&gt; property of &lt;b&gt;LayoutsPageBase&lt;/b&gt; class.&lt;br /&gt;
&lt;br /&gt;
The below code snippet shows sample implementation.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;using Microsoft.SharePoint.WebControls;
public class MyLayoutPage : LayoutsPageBase
{
  //It mmakes sure only site administrators can access this page
  protected override bool RequireSiteAdministrator
  {
    get
    {
      return true;
    }
  }
  protected void Page_Load(object sender, EventArgs e)
  {
    //Code goes here...
  }
}
&lt;/pre&gt;It is just one of the members, look at the post &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.layoutspagebase_members.aspx&quot;&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt; to know about many other members/methods of &lt;b&gt;LayoutsPageBase&lt;/b&gt; class.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1607848454302370579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-layout-page-for-only.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1607848454302370579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1607848454302370579'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-layout-page-for-only.html' title='SharePoint Layout Page for Only Administrator Accessible'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-8174666789949022226</id><published>2011-03-30T00:22:00.002+05:30</published><updated>2011-03-31T00:29:11.800+05:30</updated><title type='text'>SharePoint Manager Tool for Heirarchical View of Content</title><content type='html'>SharePoint Manager is a very userful and powerful tool for SharePoint developers for reverse engineering, just like .NET Reflector for .Net developers.&lt;br /&gt;
&lt;br /&gt;
SharePoint Manager tool is from the same person who wrote WSPBuilder (another must have tool) in SharePoint Development.&lt;br /&gt;
&lt;br /&gt;
This tool helps the developers to traverse all the content from FARM -&gt; Web Application -&gt; Site Collection -&gt; Web Site -&gt; Libraries -&gt; List Item -&gt; Field  etc., in a heirarchical view in a explorer tree view.&lt;br /&gt;
&lt;br /&gt;
It also gives the xml, data of a specific item, properties, caml query of views etc.,&lt;br /&gt;
&lt;br /&gt;
Download the SharePoint Manager &lt;a href=&quot;http://spm.codeplex.com/releases/51438/download/160598&quot;&gt;&lt;b&gt;2007&lt;/b&gt;&lt;/a&gt;/&lt;a href=&quot;http://spm.codeplex.com/releases/51438/download/146573&quot;&gt;&lt;b&gt;2010&lt;/b&gt;&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/8174666789949022226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-manager-tool-for-reverse.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/8174666789949022226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/8174666789949022226'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-manager-tool-for-reverse.html' title='SharePoint Manager Tool for Heirarchical View of Content'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-6262720474996277556</id><published>2011-03-29T23:29:00.001+05:30</published><updated>2011-03-31T00:30:17.332+05:30</updated><title type='text'>C# Code Quality Tools</title><content type='html'>Code quality is very important in delivering the reliable solutions.&lt;br /&gt;
But most of the developers simply write the code to implement a solution for the requirement.&lt;br /&gt;
&lt;br /&gt;
I strongly recommend to analyse the code before delivering. I suggest the below code analysis tools wchich works with Visual Studio integration.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/StyleCop&quot;&gt;StyleCop&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/FxCop&quot;&gt;FxCop&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
These tools really helps in analysing the code and suggesting the improvements on design, localization, performance, security, naming convensions and Readability.&lt;br /&gt;
&lt;br /&gt;
And also gives the report on Unused parameters in functions, Unused functions, Wrong scope (of functions, variables, enums, etc.,).&lt;br /&gt;
&lt;br /&gt;
Find the list of tools for static code analysis &lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis&quot;&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/6262720474996277556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/c-code-quality-tools.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/6262720474996277556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/6262720474996277556'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/c-code-quality-tools.html' title='C# Code Quality Tools'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-4044528395923617418</id><published>2011-03-29T21:28:00.000+05:30</published><updated>2011-03-29T21:28:50.408+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>C# TimeZone Corresponding Time</title><content type='html'>In an Application (public web site) Development, TimeZone is the key if there is a time dependency for making some actions/transactions and the site is public facing across the Globe in different time zones.&lt;br /&gt;
&lt;br /&gt;
TimeZoneInfo class holds the information of TimeZone properties i.e., TimeZone Display Name, TimeZone ID, All the available TimeZones and the Local TimeZone.&lt;br /&gt;
&lt;br /&gt;
The below code snippet explains the real time implementation to get the TimeZone Corresponding Time.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;private DateTime GetBaseDateTime(string sourceTimeZoneName)
{
  TimeZoneInfo sourceTimeZone = null;
  //loop through all the TimeZones to get source TimeZone object
  foreach (TimeZoneInfo tz in TimeZoneInfo.GetSystemTimeZones())
  {
    if (tz.DisplayName.ToUpper() == sourceTimeZoneName.ToUpper())
    {
      sourceTimeZone = tz;
      break;
    }
  }
  //TimeZoneInfo.Local gives the local timezone

  DateTime sourceTime = DateTime.MinValue;
  if (null != sourceTimeZone)
  {
    //get the source datetime based on the source timezone
    sourceTime = TimeZoneInfo.ConvertTime(DateTime.Now, sourceTimeZone);
  }
  return sourceTime;
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/4044528395923617418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/c-timezone-corresponding-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4044528395923617418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4044528395923617418'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/c-timezone-corresponding-time.html' title='C# TimeZone Corresponding Time'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-4669537120112625751</id><published>2011-03-28T13:06:00.001+05:30</published><updated>2011-03-31T00:31:46.521+05:30</updated><title type='text'>Blogger Publish the Code Snippets in a Formatted View</title><content type='html'>While blogging one or more posts might need code snippet(lines of code statements) as a reference or support to the problem/solution statement.&lt;br /&gt;
&lt;br /&gt;
Adding the code statements to the blog post directly renders as html where the readability might be lost.&lt;br /&gt;
&lt;br /&gt;
To improve the readablity of code snippets, i recommend a nice solution which i found. The solution is simple and straight forward which can be done 3 simple steps and it allows the end-users to copy the code snippet to clipboard or get a print of that easily.&lt;br /&gt;
&lt;br /&gt;
Find the detailed post &lt;a href=&quot;http://blog.weareon.net/how-to-publish-code-snippets-in-blog-in-3-steps/&quot;&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/4669537120112625751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/blogger-publish-code-snippets-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4669537120112625751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/4669537120112625751'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/blogger-publish-code-snippets-in.html' title='Blogger Publish the Code Snippets in a Formatted View'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1738523532416924749</id><published>2011-03-25T20:13:00.001+05:30</published><updated>2011-03-25T23:03:13.101+05:30</updated><title type='text'>Magic with CSS Styling (Reverse the Full Page Text)</title><content type='html'>Type the below full STYLE tag (css elements are commented, remove comments to make it work) in any of the free text boxes and submit.&lt;br /&gt;
Even it works with blog post as well...&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;&lt;style&gt;
/*body
{
  direction:rtl;
}
*
{
  direction:rtl;
  unicode-bidi:bidi-override;
  text-decoration:blink;
}*/
&lt;/style&gt;&lt;/pre&gt;&lt;br /&gt;
Thats it upon rendering the submitted text, the page renderes the complete html (text) in reverse order from right to left including scroll bars.&lt;br /&gt;
&lt;br /&gt;
To avoid this behaviour the entered text should be encoded while submitting and should not be decoded while rendering (if decoded the page again renders the style tag instead text.&lt;br /&gt;
&lt;br /&gt;
To encode the entered text use the below code statement in the business-logic.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;using System.Web;
HttpContext.Current.Server.HtmlEncode(tbExtension.Text.Trim());
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1738523532416924749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/magic-with-css-styling-reverse-full.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1738523532416924749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1738523532416924749'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/magic-with-css-styling-reverse-full.html' title='Magic with CSS Styling (Reverse the Full Page Text)'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-1119241776982932894</id><published>2011-03-25T19:49:00.000+05:30</published><updated>2011-03-25T19:49:46.001+05:30</updated><title type='text'>SharePoint Custom WebPart Load JavaScript File</title><content type='html'>To load the JavaScript file (resides in the web site or layouts folder) in a custom web part, add the below set of code statements in the CreateChildControls() method.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;using System.Web.UI.HtmlControls;
protected override void CreateChildControls()
{                    
  base.CreateChildControls();

  string jsFilePath = &quot;/_layouts/MyProject/MyFolder/myJsFile.js&quot;;
  HtmlGenericControl jsControl = new HtmlGenericControl(&quot;script&quot;);
  jsControl.Attributes.Add(&quot;type&quot;, &quot;text/javascript&quot;);
  jsControl.Attributes.Add(&quot;src&quot;, jsFilePath);
  this.Page.Header.Controls.Add(jsControl);
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/1119241776982932894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-custom-webpart-load.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1119241776982932894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/1119241776982932894'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-custom-webpart-load.html' title='SharePoint Custom WebPart Load JavaScript File'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-5241324120586585186</id><published>2011-03-25T19:36:00.005+05:30</published><updated>2011-03-31T00:37:59.695+05:30</updated><title type='text'>SharePoint Check Current User Permissions (SPBasePermissions)</title><content type='html'>I came accross a requirement where a custom web part or page displays the Generic List fields, however hide some of the fields if the current logged-in user doesn&#39;t have edit or delete list items permission.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;using Microsoft.SharePoint;
if (!SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.EditListItems))
{ 
  //hide the fields/controls which are not supposed to be shown here
}
&lt;/pre&gt;To see the OTB available list of permissions(SPBasePermissions) have a look at the post &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx&quot;&gt;&lt;b&gt;here&lt;/b&gt;&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/5241324120586585186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-check-current-user.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/5241324120586585186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/5241324120586585186'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-check-current-user.html' title='SharePoint Check Current User Permissions (SPBasePermissions)'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8930273875748579641.post-3002532639146841684</id><published>2011-03-24T16:41:00.002+05:30</published><updated>2011-03-30T00:27:34.012+05:30</updated><title type='text'>SharePoint Update User Profile Programatically (SSP User Profiles)</title><content type='html'>Below is the code snippet to update the user profile with OTB &amp; Custom Properties.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;
using (SPSite site = new SPSite(&quot;http://sitecollectionurl&quot;))
{
  //User profile manager object holds the complete profile store
  UserProfileManager profileManager = new UserProfileManager(ServerContext.GetContext(site));

  //UserProfile object holds the acount specific userprofile
  UserProfile userProfile = profileManager.GetUserProfile(&quot;domain\\administrator&quot;);

  //OTB property name can be assigned as below using PropertyConstants class
  userProfile[PropertyConstants.FirstName].Value = &quot;My first name&quot;;

  //Custom property value can be assigned as below by hardcoding the property name
  userProfile[&quot;CustomPropertyName&quot;].Value = &quot;Test Value&quot;;

  userProfile.Commit();
}
&lt;/pre&gt;&lt;br /&gt;
Loop through all the user profiles available in SSP profile store.&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;UserProfileManager profileManager = new UserProfileManager(ServerContext.GetContext(site));
foreach(UserProfile userProfile in profileManager)
{
  if(null != userProfile[PropertyConstants.FirstName].value)
    lblFirstName.Text = userProfile[PropertyConstants.FirstName].value;

  if(null != userProfile[&quot;CustomPropertyName&quot;].value)
    lblCustomPropertyValue.Text = userProfile[&quot;CustomPropertyName&quot;].value;
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://developmenttricks.blogspot.com/feeds/3002532639146841684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-update-user-profile-ssp-user.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/3002532639146841684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8930273875748579641/posts/default/3002532639146841684'/><link rel='alternate' type='text/html' href='http://developmenttricks.blogspot.com/2011/03/sharepoint-update-user-profile-ssp-user.html' title='SharePoint Update User Profile Programatically (SSP User Profiles)'/><author><name>Murali Krishna Golla</name><uri>http://www.blogger.com/profile/11619667326620951858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5wj-3EnKInUMkEWnkI-JST4OtSj51VfOhd0qh3dGCZJbJOioqJ28sQ6KRCHUxx-lApI5Gr16_aqU8x9LAhEPQT7VgFqOEkUVFmLxCV1KHTsYEJO3xsDVLCcPnS5ldxg/s113/*'/></author><thr:total>2</thr:total></entry></feed>