Brain Dump

Nothing new here, just a place to gather my thoughts

Apr10

SharePoint column limit and Row-wrapping in SQL

Written by // Rogério Cruzeiro Categories // How To, Brain Dump

"SharePoint Server 2010 data is stored in SQL Server tables. To allow for the maximum number of possible columns in a SharePoint list, SharePoint Server will create several rows in the database when data will not fit on a single row. This is called row wrapping.

Each time that a row is wrapped in SQL Server, an additional query load is put on the server when that item is queried because a SQL join must be included in the query. To prevent too much load, by default a maximum of six SQL Server rows are allowed for a SharePoint item. This limit leads to a particular limitation on the number of columns of each type that can be included in a SharePoint list. The following table describes the limits for each column type.

The row wrapping parameter can be increased beyond six, but this may result in too much load on the server. Performance testing is recommended before exceeding this limit..."

http://technet.microsoft.com/en-us/library/cc262787(v=office.14).aspx#Column

 

$web = http://webapplication
$webapp = Get-spwebapplication $web
$webapp.MaxListItemRowStorage = 8 #the default value is 6
$WebApp.update()

Dec16

Manage SharePoint 2010 list throttling individually

Written by // Rogério Cruzeiro Categories // How To, Brain Dump

Enable Throttling via Powershell

Throttling can be enabled and disabled on a list-by-list basis to overcome some temporary threshold issues.

Check if throttling is currently enabled:

$web = Get-SPWeb http://URL_OF_YOUR_SITE
$list = $web.Lists["NAME_OF_YOUR_LIST"]

$list.IsThrottled

This will return true or false according to the Throttling settings. If it returns True, the the List has been throttled (has more items than the List View Throttle limit).  If it returns false, it has either less than the List View Throttle limit or throttling has been disabled via the EnableThrottling property.

To enable throttling on a list, simply run the following 

$web = Get-SPWeb http://URL_OF_YOUR_SITE 
$list = $web.Lists["NAME_OF_YOUR_LIST"]
$list.EnableThrottling = $true
$list.Update()
Nov22

Find closed web parts using SharePoint UI

Written by // Rogério Cruzeiro Categories // How To, Brain Dump

Web Part Maintenance Mode

How to find closed Web Parts?
Open the Web Part page in Web Part Maintenance Mode.

How?
Append ?contents=1 at the end in address bar
Example: http://contoso.com/default.aspx?contents=1

Nov20

SharePoint 2010 Event Handler Properties

Written by // Rogério Cruzeiro Categories // Brain Dump

what to use?

  • SPItemEventProperties.AfterProperties
  • SPItemEventProperties.BeforeProperties
  • SPItemEventProperties.ListItem

 

Custom list

 

AfterProperties

BeforeProperties

ListItem

ItemAdding

Changed value

Nothing

Null

ItemAdded

Changed value

Nothing

Changed value

ItemUpdating

Changed value

Nothing

Original value

ItemUpdated

Changed value

Nothing

Changed value

ItemDeleting

Nothing

Nothing

Item

ItemDeleted

Nothing

Nothing

Null

 

Library

 

AfterProperties

BeforeProperties

ListItem

ItemAdding

Nothing

Nothing

Nothing

ItemAdded

Nothing

Nothing

Changed value

ItemUpdating

Changed value

Nothing/Original value

Original value

ItemUpdated

Changed value

Nothing/Original value

Changed value

ItemDeleting

Nothing

Nothing

Item

ItemDeleted

Nothing

Nothing

Nothing

Why two values for the ItemUpdated and ItemUpdating?

When you add a new document to a document library the events fired are in this order: ItemAdding > ItemAdded. Until here nothing new. 
Well right after you add a new document the EditForm pops up in order to allow you to change any properties for the document.
The events that are fired for this Form after you press Save are: ItemUpdating > ItemUpdated.
Yet, at this moment (the moment right after you add a new document), the BeforeProperties has no usefull values like it should. In fact, it has nothing.

So, not only the Update events are fired, when your are adding a new document (because infact the document is already saved), as the BeforeProperties work diferently from the standard Update action.

Oct26

Enable / Disable Developer Dashboard using stsadm

Written by // Rogério Cruzeiro Categories // Brain Dump

Enable: stsadm -o setproperty -pn developer-dashboard -pv OnDemand (case sensitive)

Disable: stsadm -o setproperty -pn developer-dashboard -pv Off (case sensitive)

Oct26

When and what dispose

Written by // Rogério Cruzeiro Categories // Brain Dump

Avoiding memory leaks general rules:

  1. Use SPDisposeCheck utility to identify issues (very usefully on analysing 3rd party code)

  2. Dispose when:
    1. Enumeration AllWebs or Webs
    2. OpenWeb()
    3. Anytime the new command is used

  3. Don't dispose when:
    1. ParentWeb
    2. RootWeb
    3. SPContext
Oct26

AllowUnsafeUpdates set to false automatically

Written by // Rogério Cruzeiro Categories // Brain Dump

When you're persisting some property running with elevated priveligies, you have to set AllowUnsafeUpdates in order to bypass the security validation when you call the Update() method.

Bare i mind that any Exception (handled or otherwise) occur during the execution of your code, for instance: a try catch block, the AllowUnsafeUpdates property is setted back to false.

Jan06

Change SharePoint web.config to allow debug with call stack

Written by // Rogério Cruzeiro Categories // Brain Dump

Brain dump

1) Obtain the complete call stack instead of the default error page:

<SafeMode MaxControls="200" CallStack="false"/>
to
<SafeMode MaxControls="200" CallStack="true"/>

2) CustomeErrors mode value (in the system.web section) is set to Off:

<customErrors mode="On">
to
<customErrors mode="Off">