Tuesday, June 5, 2012

Custom List Form in SharePoint Designer 2010 will not render if the list columns are more then 70 : Resolved

In SharePoint 2010, You can easily create custom list forms in SharePoint Designer, but some List Form will not render through error as “Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.”



Here is the resolution of problem. Follow below link.

http://social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/11a8b7c7-6bdd-485e-a8c6-083896cf6f83

Also I have copied the solution provide by Linda Chapman [MSFT]. Thanks Linda for your contribution.
Custom List Form in SharePoint Designer 2010 will not render if the list has a large number of columns.

Symptom
Custom List Form will not render if the list has a large number of columns. To reproduce this issue create a custom list and add 68 single line of text columns. The custom list form web part will not render and an error message such as this will occur in the browser:

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.

Correlation ID:

For more information about custom list forms please refer to this article:

http://office.microsoft.com/en-us/sharepoint-designer-help/create-a-custom-list-form-using-sharepoint-designer-HA010378258.aspx

Cause

This occurs when a large XSL transforms happens in a single template.

Resolution
The issue can be resolved by breaking up the offending xsl template into smaller parts to avoid a large transform.

This example is for a New Form custom list form. The Edit Form is similar in template naming convention. Please refer to the end of the article for the template names of the various form modes.

1. Open the page that contains the none working custom list form web part.
2. Switch to code for this this workaround.
3. Search for the following string:


<xsl:call-template name="dvt_1.rowedit"/>


4. Copy this line paste it 3 to 5 times. The table structure and other components that makeup this template will be divided into the other copied templates. A general guideline is to have about 20 to 40 table rows per template. There is a fair amount of give with this recommendation.

5. Rename each pasted template by adding a number to the end of it.


<xsl:call-template name="dvt_1.rowedit"/>
<xsl:call-template name="dvt_1.rowedit2"/>
<xsl:call-template name="dvt_1.rowedit3"/>
<xsl:call-template name="dvt_1.rowedit4"/>
<xsl:call-template name="dvt_1.rowedit5"/>


6. Now, press the control key and click the dvt_1.rowedit. This will highlight the template's first line which is this:


<xsl:template name="dvt_1.rowedit">

7. Place the cursor infront of the less than sigh of <xsl:template name="dvt_1.rowedit">
8. Hold down Control + Shift and then press semicolon. This will highlight the entire template.
9. Go to the bottom of the template. The following should be the last line: </xsl:template>

9. Paste the following markup after the closing xsl temlate tag from stpe 9. In this example there are 5 different dvt_1.rowedit templates calls so we'll need 5 <xsl:template> elements to match.


<xsl:template name="dvt_1.rowedit">
<xsl:param name="Pos" select="position()"/>
<tr>
<td>
<table border="0" cellspacing="0" width="100%">

</table>
</td>
</tr>
</xsl:template>


10. Rename each of the templates pasted in step 9 to match the templates from step 5.


<xsl:template name="dvt_1.rowedit">

<xsl:template name="dvt_1.rowedit2"> 

11. Next, the conents of <xsl:template name="dvt_1.rowedit"> needs to be divided among the new templates, <xsl:template name="dvt_1.rowedit2">, <xsl:template name="dvt_1.rowedit3"> and so forth. The easiest way to do this is to start at the end of the template and cut out the last few table rows and paste them into the last template that was created. In this example that would be <xsl:template name="dvt_1.rowedit5">

The individual table rows that represent the various SharePoint fields are stored inside of the table HTML element and that valid HTML needs to be persisted into the new templates. A good way of ensure this happens is to find <table border="0" cellspacing="0" width="100%"> in <xsl:template name="dvt_1.rowedit"> and perform a Control + Shift + Semicolon to highlight the entire table.

Once this is done scroll down to the end of the table and carefully take entire table rows, <tr>, and their contents over to the last xsl template.

By default the following is the last chunk of markup in <xsl:template name="dvt_1.rowedit">:


<tr id="idAttachmentsRow">
<td nowrap="true" valign="top" class="ms-formlabel" width="20%">
<SharePoint:FieldLabel ControlMode="New" FieldName="Attachments" runat="server"/>
</td>
<td valign="top" class="ms-formbody" width="80%">
<SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/>
<script>
var elm = document.getElementById('idAttachmentsTable');
if (elm == null || elm.rows.length == 0)
document.getElementById('idAttachmentsRow').style.display='none';
</script>
</td>
</tr>
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<tr>
<td colspan="99" class="ms-vb">
<span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
</td>
</tr>
</xsl:if>


This particular table row represents the attachment functionality inside of a custom list form. This should not be in multiple templates and makes sense to go to the last XSL template created.

All the other table rows, <tr>, should contain the various columns in your list. Again, start from the bottom and work up to keep this exercise easy.

Adjust these steps accordingly if custom HTML layout is used to display field controls.

12. Finally, here is an example of the finished product. Each template only contains 1 column and the attachment functionality in the last xsl template. Also, only <xsl:template name="dvt_1.rowedit"> and <xsl:template name="dvt_1.rowedit2"> were included.


<xsl:template name="dvt_1.rowedit">
<xsl:param name="Pos" select="position()"/>
<tr>
<td>
<table border="0" cellspacing="0" width="100%">
<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Title<span class="ms-formvalidation"> *</span>
</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/>
<SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Title" ControlMode="New"/>
</td>
</tr>
</table>
</td>
</tr>
</xsl:template>

<xsl:template name="dvt_1.rowedit5">
<xsl:param name="Pos" select="position()"/>
<tr>
<td>
<table border="0" cellspacing="0" width="100%">
<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>NewColumn90</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="ff91{$Pos}" ControlMode="New" FieldName="NewColumn90" __designer:bind="{ddwrt:DataBind('i',concat('ff91',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@NewColumn90')}"/>
<SharePoint:FieldDescription runat="server" id="ff91description{$Pos}" FieldName="NewColumn90" ControlMode="New"/>
</td>
</tr>
<tr id="idAttachmentsRow">
<td nowrap="true" valign="top" class="ms-formlabel" width="20%">
<SharePoint:FieldLabel ControlMode="New" FieldName="Attachments" runat="server"/>
</td>
<td valign="top" class="ms-formbody" width="80%">
<SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/>
<script>
var elm = document.getElementById('idAttachmentsTable');
if (elm == null || elm.rows.length == 0)
document.getElementById('idAttachmentsRow').style.display=&apos;none&apos;;
</script>
</td>
</tr>
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<tr>
<td colspan="99" class="ms-vb">
<span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
</td>
</tr>
</xsl:if>
</table>
</td>
</tr>
</xsl:template>

Supplemental Information

The following are the template names for Edit Forms and Display Forms. The same concept applies to these as the New Form templates.

Display Form:


<xsl:call-template name="dvt_1.rowview"/> and <xsl:template name="dvt_1.rowview">


Edit Form, which is the same as New Form:


<xsl:call-template name="dvt_1.rowedit"/> and <xsl:template name="dvt_1.rowedit">

Enjoy !!!

Tuesday, May 22, 2012

SharePoint 2010 Capacity Planning

This article provides an overview of how to effectively plan and manage the capacity of SharePoint 2010 environments. This article also describes how to maintain a good understanding of the capacity needs and capabilities of your deployment, by analysis of performance and volume data.

Capacity management is an ongoing process, You need to plan for growth and change, so that your SharePoint Server 2010–based environment can continue to deliver an effective business solution.
The capacity management model includes additional steps to help you validate and tune the initial architecture, and provides a feedback loop for re-planning and optimizing the production environment until it can support design goals with optimal choices of hardware, topology, and configuration.

# The following specialized terms are used in SharePoint 2010 capacity management:

RPS:   Requests per second. The number of requests received by a farm or server in one second.
Peak hours:   The time or times during the day when load on the farm is at its maximum.
Peak load :  The average maximum daily load on the farm, measured in RPS.
Load spike:   Transient load peaks that fall outside usual peak hours. These can be caused by unplanned increases in user traffic, decreased farm throughput because of administrative operations, or combinations of such factors.
Scale up:   To scale up means to add resources such as processors or memory to a server.
Scale out :  To scale out means to add more servers to a farm.
Throughput:  Throughput is defined as the number of concurrent requests that a server or server farm can process.


# Limits and boundaries:
Web application limits

Content database size ( general usage scenarios)
200 GB per content database
Content database items
60 million items including documents and list items
Site collections per content database
2,000 recommended
5,000 maximum
Web site
250,000 per site collection
Site collection size
Maximum size of the content database
Web parts
25 per wiki or Web part page

List and library limits
The following table lists the recommended guidelines for lists and libraries.
List row size8,000 bytes per row
File sizeThe default maximum file size is 50 MB and  Maximum 2 GB.
Documents30,000,000 per library
Major versions400000
Items30,000,000 per list
List view lookup threshold8 join operations per query
List view threshold5000
List view threshold for auditors and administrators20000
Subsite2,000 per site view

Column limits
SharePoint Server 2010 data is stored in SQL Server tables.

Single line of text28 bytes
Multiple Lines of Text28 bytes
Choice28 bytes
Number12 bytes
Date and Time12 bytes
Lookup4 bytes
Yes / No5 bytes
Person or group4 bytes
Hyperlink or picture56 bytes
Calculated28 bytes

Blog limits
The following table lists the recommended guidelines for blogs.

Blog posts5,000 per site
Comments1,000 per post


Groups limits 

Number of SharePoint groups a user can belong to5000
Users in a site collection2 million per site collection
Active Directory Principles/Users in a SharePoint group5,000 per SharePoint group
SharePoint groups10,000 per site collection


References:
2.       Column limits

Wednesday, April 25, 2012

Display Item Attachments in SharePoint List View

It is very easy to display list item attachments
in List View and also manipulate the display of attachment, like if attachment is
image, we can display image not just a link.
1. Open List View in SharePoint Desinger
2. Add new column titled "Attachments".
3. Select TD tag of New column.
4. Replace selected code with below code.


 <td id="ItemAttchment" class="ms-vb">
          <xsl:element name="SharePoint:AttachmentsField">
          <xsl:attribute name="runat">server</xsl:attribute>
                    <xsl:attribute name="FieldName">Attachments</xsl:attribute>
          <xsl:attribute name="ControlMode">Display</xsl:attribute>
          <xsl:attribute name="Visible">true</xsl:attribute>
          <xsl:attribute name="ItemId">
              <xsl:value-of select="@ID"/>
          </xsl:attribute>
          </xsl:element>
</td>


5. View with Attachments

Monday, March 19, 2012

Quick Notes: Retrieving Values in Event Receivers using BeforeProperties and AfterProperties

In SharePoint Portal development there are many scenarios where we need to develop event receivers.
So for accessing list item/ library item values, we need to use BeforeProperties and AfterProperties of SharePoint Event receivers. But some times they give empty or null values.
Below chart gives great understanding of which values are populated in BeforeProperties , AfterProperties and properties.ListItem objects.

For list:



List

BeforeProperties

properties.ListItem

AfterProperties

ItemAdding

Empty

Null

New Value

ItemAdded

Empty

New Value

New Value

ItemUpdating

Empty

Old Values

Updated Values

ItemUpdated

Empty

Updated Values

Updated Values

ItemDeleting

Empty

Original Values

Empty

ItemDeleted

Empty

Null

Empty

For library:


List

BeforeProperties

properties.ListItem

AfterProperties

ItemAdding

Empty

Null

Empty

ItemAdded

Empty

New Value

Empty

ItemUpdating

Old Values

Old Values

Updated Values

ItemUpdated

Old Values

Updated Values

Updated Values

ItemDeleting

Empty

Original Values

Empty

ItemDeleted

Empty

Null

Empty


The Synergy MOSS blog has explain this more clearly, please check here for more details.
Good Post on "SP 2010: How To – Event Receivers and Custom Error Pages" by Tobias Zimmergren . 
http://zimmergren.net/technical/sp-2010-how-to-event-receivers-and-custom-error-pages

Wednesday, February 29, 2012

Quick Notes: SharePoint Solution Deployment Commands - PowerShell

------------Add Snippet-------------------------
"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\SharePoint.ps1"
Add-PSSnapin Microsoft.SharePoint.PowerShell
------------Add Solution-------------------------
Add-SPSolution "E:\SPSolutions\SharePoint. Finance.wsp"
Install-SPSolution –Identity SharePoint.Finance.wsp –WebApplication " http://SPServer:1000/" –GACDeployment -force
------------Update  Solution-------------------------
Update-SPSolution –Identity SharePoint.Finance.wsp –LiteralPath "E:\SPSolutions\SharePoint. Finance.wsp" –GacDeployment
------------Add Feature------------------------
Install-SPFeature Feature1 -force
Enable-SPFeature –Identity Feature1 –url "http://SPServer:1000/sites/Finance/"
------------Remove Feature------------------------
Uninstall-SPFeature Feature1
Disable-SPFeature –Identity Feature1 –url "http://spserver:1000/sites/Finance/"   

Microsoft has provided a tool to design PowerShell commands for SharePoint
Check this...
http://www.microsoft.com/resources/TechNet/en-us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.html