Vs 2010 Solution and Project (1)

[Notes from the book – Sharepoint 2010 Development with VS 2010]

A single project can only produce a single .NET assembly (a DLL file). So if you need to produce multiple DLL fles, you need to create multiple projects in your VS 2010 solution.

Sandboxed solutions are deployed at the site collection level rather than the farm level, so this lets you isolate a solution so it is only available to one site collection within the farm

Sandboxed solutions also run in a separate process from the main SharePoint IIS web application process, and the separate process is throttled and monitored with quotas to protect the SharePoint site from becoming unresponsive due to a misbehaving sandboxed solution.

In a sandbox solution’s AssemblyInfo.cs, you see this line:
[assembly: AllowPartiallyTrustedCallers()]


When adding a new event receiver item, there are 5 types of event receivers you can create.

List Item, List Workflow and List Email event receivers – act on a specific list instance that you mustalso elest;

List and Web Event receivers act on the current Sharepoint, so no need to select a list instance.

EventReceiver project must be a Farm Solution!!!

After you add an Event Receiver:

Elements.xml is also called Element Manifest file. It contains information that describes the Sharepoint items being created to Sharepoint.

(manifest: A list of invoice; goods; cargos; passengers)

About the Deployment Location (property of Elements.xml)

Elements.xml’s <SequenceNumber> : If there are two or more event receivers and they are handling the same events, the one that has the smallest number in the SequenceNumber element is executed first.

In this ItemDeleting event, instead of deleting the item, we append an “*” to the title, and then cancel the delete event.

In this itemAdded event, we append ” added” to the title of the newly added item.

You might need more than one features in the project if your items need to be activated for different scope. You can add new features, and then set a different scope for each features. To set scope to the feature, double click the feature, and either change it in the visual designer or in the property pane.

4 different scopes: (from top to down)

* Farm
* Web Application (an IIS web site)
* Site (site collection)
* Web (web sites under site collection)

Use Feature Activation Dependencies to add the feature that this feature is depend on.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: