Tuesday, October 20, 2009

Sending Email or SMS using SPAlert ( SPAlertDeliveryChannels )

Title:Sending Email or SMS using SPAlert
Sends notification to a user about the list, list item, document, or document library to which the alert applies via E-mail or SMS.


SPAlert has the property SPAlertDeliveryChannels - an enumaration type that has enum values Email and Sms


Reference : MSDN

SharePoint 2010 Development Tools : SPMetal

Title: SPMetal
SPMetal is a command line tool that generates entity classes that are in turn used in Linq to SharePoint - Microsoft.SharePoint.Linq ( new in SP 2010 ). It is like an interface to connect to the Foundation 2010 Content Databases that enables operations such as add, delete and change items.


SPMetal can be found under the location C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN\
Usage:

SPMetal /web:http://ContosoServer/Marketing /code:MarketingSite.cs

Reference : MSDN

Client API Class Library in SharePoint 2010

Title: SharePoint 2010 Client API
It's not been 1 day before SharePoint SDK Documentation is released on MSDN and already its so compelling to using 2010. Here is some thing very intresting and I am waiting to write code on.


SharePoint Foundation 2010 has a all new class library 'The Client API'. Voila!!! what does that mean... now you can write even better managed client object model for Silverlight and .net in SharePoint 2010. Isnt it cool???


So, here are the available namespaces and class library references:

Microsoft.SharePoint.Client - Core namespace that provides types and members for working with SharePoint Foundation Web sites, list data, and security within a site collection.

Microsoft.SharePoint.Client.Application - Provides types and members that are used for authentication.

Microsoft.SharePoint.Client.Utilities - Provides utility types and members for managing users as principals.

Microsoft.SharePoint.Client.WebParts - Provides types and members for managing Web Parts within Web Part pages.

Microsoft.SharePoint.Client.Workflow - Provides types and members for managing workflow templates and workflow associations.

Reference : MSDN

Monday, October 19, 2009

SharePoint 2010 What's Deprecated?

Title: What's Deprecated?
As many as 190 Types and Methods are deprecated in the new version ( beta ).
you can find the details here.

What's New in SharePoint Server 2010?

Title: SharePoint Server 2010
Some of the new features in SharePoint Server 2010 are listed below:

Business Connectivity Services (BCS)
Enterprise Content Management (ECM)
SharePoint Enterprise Search
PerformancePoint Services
Excel Services
User Profiles and Social Data
Word Automation Services Overview

more information here

What's new in SharePoint Foundation 2010?

Title: Foundation 2010
Foundation 2010 ( next version of WSS 3.0 ) has the following new features

Alerts Enhancements
Business Connectivity Services
Client Object Model
Events Improvements
Microsoft Synch Framework
Mobile Device Development Enhancements
Query Enhancements
Ribbon
Sandboxed Solutions
Service Application Framework
Silverlight Integration and the Fluid Application Model
UI Improvements
Windows PowerShell for SharePoint
Workflow Improvements

more details here

SharePoint 2010 Resources

The much awaited SharePoint 2010 resources can now be obtained from here.

http://blogs.msdn.com/sharepoint/archive/2009/10/19/sharepoint-2010-resources.aspx

Tuesday, October 6, 2009

SPWeb.AvailableContentTypes Vs SPWeb.ContentTypes

Title: SPWeb.AvailableContentTypes Vs SPWeb.ContentTypes


Scenario: Try to get the content types from using both the properties. You might notice that there is no difference. Well then why do we have 2 different properties. Here is the code to get the content types ( notice the comments ) ...

static void GetListTypeID()
{
using (SPSite oSite = new SPSite(@"http://localhost/"))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
//SPContentTypeCollection ctypecoll = oWeb.ContentTypes; // USING CONTENT TYPES
SPContentTypeCollection ctypecoll = oWeb.AvailableContentTypes; // USING AVAILABLE CONTENT TYPES
foreach (SPContentType type in ctypecoll)
{
Console.WriteLine("ID: " + type.Id + " ; Name: " + type.Name);
}
}
}
}




Run the above using either of ContentTypes and AvailableContentTypes. You will see that the result is same.

From MSDN the difference is

The ContentTypes property returns only the content types that exist on the current Web site, not all content types in the current scope. Use the AvailableContentTypes property to return all content types in the current scope, including those of any parent Web sites.

Though it helped me to understand I couldnt get the real essence of it. So, the intresting concept is that AvailableContentTypes is READONLY. You cannot add a new ContentType by using AvailableContentTypes collection.

** CORRECTIONS **
My bad... Some mis-interpretation with my wordings above. The above code as is executed at Site Collection level gives the same results. As mentioned above from MSDN AvailableContentTypes gives information including subsite content types. However, my point is to bring out which one should be used to create new content types ( ContentType ) and which one is read-only ( AvailableContentTypes ). Hope you got the point right.

Monday, October 5, 2009

Programmatically Get Content Types

Title: You might want to get all the content types on a given site

Code:

static void GetListTypeID()
{
using (SPSite oSite = new SPSite(@"http://localhost/"))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPContentTypeCollection ctypecoll = oWeb.ContentTypes;
foreach (SPContentType type in ctypecoll)
{
Console.WriteLine("ID: " + type.Id + " ; Name: " + type.Name);
}
}
}
}