Articles tagged with: brain dump

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">