Monday, July 22, 2013

Various options to store your SharePoint Solution’s Configuration Data.


The various options are : -
  1. Code
  2. web.config
  3. SharePoint List
  4. External Data Source
  5. Property Bag - 
  6. Hierarchical Object Store


Ref:
1. http://blogs.msdn.com/b/zwsong/archive/2012/03/27/where-should-you-store-your-sharepoint-solution-s-configuration-data.aspx - Good one with comparison. Do read the comments.

2. Hierarchical Object Store in SharePoint 2010 - more info on how to use the same.

Wednesday, July 3, 2013

Sharepoint 2010 Events

New Events in SharePoint Foundation 2010
Two new Add events have been provided for SharePoint lists – that is, for SPList objects:

In addition to these Add events, two Delete events have also been added to SharePoint lists:

New events on Sharepoint Sites

New Synchronous After Events
The default synchronization behavior is synchronous for before events and asynchronous for after events. Also available is a new property on the SPEventReceiverDefinition base class called Synchronization. This property has get and set methods to retrieve and set the SPEventReceiverSynchronization enumeration value. This enumeration provides a value called Default to support backward compatibility.


New Event Binding Functionality in SharePoint Foundation 2010
The ability to bind events at the scope of the site collection (SPSite), as well as giving you the ability to bind XML event receivers that are scoped to the individual site (SPWeb).

SPSite-Level Binding
   SharePoint Foundation 2010 supports an SPSite-level event receivers collection. Like other event receiver collections, this one accepts bindings from SPWebEventReceiver, SPListEventReceiver, and SPItemEventReceiver objects. All of these event types can be scoped to the site collection level (that is, SPSite). However, an SPEmailEventReceiver object does not work at the site collection level because the way that this object is implemented.

SharePoint Foundation 2010 supports binding XML event receivers at the scopes of both SPWeb and SPSite instances by using the <Receivers> tag. When a SharePoint Feature is scoped to the site collection level, a <Receivers> tag is potentially ambiguous. The tag can indicate either site-wide event binding or event binding for the top-level site. Note, however, that the default behavior is to scope to the site level. Therefore, when you scope a Feature to the site collection level, use the attribute named Scope to specify the intended scope.

SharePoint Foundation 2010 supports event binding based on the SPItemEventReceiver event receiver by using semantics of the ListTemplateId property. This approach creates an event receiver definition that is scoped to the list as the list is created. SP supports event binding that is based on the SPItemEventReceiver object in the XML of a specified content type.


SP provide the identity (ID) of the originating user and then let the event receiver implementer respond as appropriate.
SharePoint Foundation 2010 also introduces a new property called OriginatingUserToken on the SPEventPropertiesBase class that
returns the ID of the originating user.

 Event code should check for this user by ID, and, optionally, perform behaviors that can potentially cause unexpected effects by using an impersonated site collection with the token of that originating user.

In some scenarios, for example, when an active workflow has code that is running with elevated privileges, the code runs in the context of the system account. But in this scenario, when event receiver code needs to run with the credentials of the originating user, SharePoint Foundation 2010 allows you to undo the reversion using the above feature.

Redirect to URL in SharePoint Foundation 2010

Microsoft SharePoint Foundation 2010 now allows event receivers to provide a redirection URL to provide custom messages through the user interface (UI). The redirect URL feature works with all pre-event receiver types (such as SPWebEventReceiver, SPListEventReceiver, and SPItemEventReceiver) in cases where the action is being cancelled. To support the new user interfaces, SharePoint Foundation 2010 added the CancelWithRedirectUrl field to values in the SPEventReceiverStatus enumeration  (values -CancelNoError,    CancelWithError,    CancelWithRedirectUrl,    Continue ). CancelWithRedirectUrl allows you to specify a redirect URL for a Web browser UI. Use the URL that is specified by the RedirectUrl property of the SPEventPropertiesBase object to navigate to alternate pages. This URL should be a server-relative URL, and cannot contain ECMAScript (JavaScript, JScript).



Devops links

  Build Versioning in Azure DevOps Pipelines