Monday, November 12, 2012

Before,After Properties and ListItem in Sharepoint 2010 Event Recievers

As we all know, event receivers are a great way to hook into various SharePoint events.  These can apply to Feature events such as FeatureActivated, List events such as FieldAdded, and many others.When working with events, you’ll quickly find that before (synchronous) and after (asynchronous) events exist, and the method suffix such as “ing” (e.g. ItemAdding) and “ed” (e.g. ItemAdded) will tell you whether it gets invoked before or after the actual change is made. 

Event receivers are common in SharePoint development so its better to understand the data available in each events. Sometimes as a developer we jump into coding before thinking about contextual data availability.One more important thing to notice list event receiver  and document library event receiver are different interns of contextual data availability.Following Table will give you a clear picture about the contextual data in each events.

  SharePointList

Event
BeforeProperties
AfterProperties
ListItem
ItemAdding
Null
New  Value
Null
ItemAdded
Null
New Value
New Value
ItemUpdating
Null
Changed Value
Original Value
ItemUpdated
Null
Changed Value
Changed Value
ItemDeleting
Null
Null
Original Value
ItemDeleted
Null
Null
Null

 
SharePointDocument Library
Event
BeforeProperties
AfterProperties
ListItem
ItemAdding
Null
Null
Null
ItemAdded
Null
Null
New Value
ItemUpdating
Original Value
Changed Value
Original Value
ItemUpdated
Original Value
Changed Value
Changed Value
ItemDeleting
Null
Null
Original Value
ItemDeleted
Null
Null
Null

I hope this post gives you a better idea of how before and after events work for both lists and libraries.

Saturday, October 6, 2012

Customize SharePoint 2010 global navigation bar using CSS



I´d like to lead you back to the basic CSS classes that run the SharePoint navigation. No need to get it to complicated, the global navigation can be customized in so many ways regarding the functions as well as look & feel, and there´s not so many classes involved.






In the SharePoint2010 core css there´s only four classes for the navigation list, the menu items, hover and selected. This following css contains a most simplified customization of the global navigation, it will change the background color, hover color, selected color and make it a bit higher and more prominent.Include following classes in your css file or in master page.
/* Navigation list */
.s4-tn
{
      background-color: #FFFFF; /*Menu background colour*/
      padding: 0px;
      margin: 0px;
      font-family: 'Calibri' !important;
      font-size: 11pt !important;
      padding-left: 10px;
}

/* Global navigation */
.s4-tn li.static > .menu-item
{
      color: #5A9A18;
      white-space: nowrap;
      border: 1px solid transparent;
      padding: 4px 10px;
      line-height: 25px;
      height: 28px;
}

/* Hover */
.s4-tn li.static > a:hover
{
      background: url("/_layouts/Images/selbg.png") repeat-x left top;
      background-color: #529610;
      color: #fff;
      text-decoration: none;
}

/* Selected */
.s4-toplinks .s4-tn a.selected
{
      background: url("/_layouts/Images/selbg.png") repeat-x left top;
      background-color: #529610;
      color: #fff;
      text-decoration: none;
      border: 1px transparent solid;
      padding-right: 10px;
      padding-left: 10px;
      margin: 0px;
      border-color: #529610;
}

I Hope this help.