Ravendra's Blog

December 31, 2009

Sharepoint 2010 New Features

Filed under: Sharepoint — Ravendra Mishra @ 5:38 pm
Tags: , , ,

Sharepoint 2010 New Features

Terms WSS is replaced by SharePoint foundation server and MOSS is replaced by SharePoint server. New hardware requirement is 64bit server however it will work on x86 servers as well. OS requirement is x64 edition of either windows server 2008 or server 2008 R2. It also requires 64 bit version of MS SQL Server 2008 or 2005.

The most prominent change to the visual interface is the introduction of the Ribbon which looks same way as it does in Office 2007 and Office 2010

  1. Browser Support

SharePoint 2010 will support a wider range of browsers. Out of the box, SharePoint

will support IE 7 and newer, Firefox, and Safari as Tier 1 browsers. This means that

all features will work in these browsers.

  1. Lists

Lists in SharePoint 2010 get an overhaul,

XSL Lists?

SharePoint 2010 does allow you to use XSL for your list views rather than the dreaded CAML View schema. In this case, the list view is stored in an out-of-the-box XSL file called main.xsl, which in turn references other XSL files to render the output of a view.

XSL is a much more usable standard for rendering content than the CAML View

schema, and since it’s an open standard, you get much better tool support as well. More details on MSDN blog:

http://blogs.msdn.com/sharepointdesigner/archive/2009/11/16/sharepoint-2010-listview-blog-series-part-1-introduction-to-the-new-list-view.aspx

List View Joins

This is definitely one of the best features in Sharepoint 2010. You can now join data from multiple lists into a single view. This includes any external lists as well, so you can now put your legacy data sources into SharePoint and utilize parts of that data in pure SharePoint list views as well.

The list join feature works much in the same way as SQL views, although the

syntax is very different. These joined views are defined in CAML code in the view

itself.

List Throttling

In MOSS 2007 there was Microsoft recommendation to restrict view items by 2000 but there was no way to enforce it. In SharePoint 2010, administrators may enforce the limit of items in a view. By default, this limit is set to 5,000 items, but administrators can change this for any list or set of users or disable the feature completely.

List Validation

SharePoint 2010 allows to do validation of the input to a list, enforcing either business or technical rules for what kind of data should be accepted. If you have worked with calculated columns, the format of these validation rules is very similar,

For example, you can disable the editing of items using a simple validation rule such as [Modified]<[Created]. This will disallow editing if the Modified date is later than the Created date, which it will be for any subsequent edits after item creation. In previous version of SharePoint, this required .NET code.

External Lists

BCS replaces Business Data Catalog from SharePoint 2007. BCS allows to connect any data source and work with the data in that data source almost as if it were a standard SharePoint list. This is what is known as an external list.

There are a few limitations, but you can work with the normal CRUD operations

(Create, Read, Update, Delete), and you can use external lists as part of a joined

view.

  1. User Solutions

You may have heard about something called the Solution Sandbox. In short, the

Solution Sandbox allows you to deploy solutions to a single site collection rather

than to a web application. But it gets a lot better.

These site collection solutions are user uploadable, so end users can create or

download solution packages and deploy them to their sites without requiring web

application permissions. This includes .NET code for certain operations as well.

This may sound very scary, allowing users to run code. This is where the Solution

Sandbox comes into play.

The Solution Sandbox runs the .NET code in a limited environment to protect both

the performance and the security of your farm. You can limit these user solutions to

prevent that one faulty solution from consuming too many resources, and you can

even block solutions that you do not want running in your environment.

  1. Client Object Model

For developers, the new Microsoft.SharePoint.Client namespace offers an easy way

of creating client applications for use against SharePoint sites. This includes both

regular applications and Silverlight applications, as well as web-based applications.

The client object model provides a subset of the full SharePoint object model,

enough to work with major components such as lists, users, content types, sites, and

so on.

Ton Stegeman has written a blog post showing how to use the client object model in

JavaScript (or ECMAScript, really):

http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?ID=118

What is cool with the client object model is that you as a developer do not need to

learn a completely new object model. The client object model has more or less the

same objects as the regular object model, and the behavior is also very similar.

  1. Search

There are also improvements to search in SharePoint 2010. Search in SharePoint is

now served by three products: Search Server 2010, SharePoint Search, and FAST

Search for SharePoint 2010. Licensing is available from free (Search Server 2010)

to expensive (FAST Search for SharePoint 2010).

All the search engines offer improved search over previous versions, such as

relevance and query completion. Of course, the feature set increases with the more

expensive editions, but for most smaller organizations, the free Search Server 2010

will do a great job.

FAST Search

After Microsoft purchased FAST Search and Transfer, everyone has been looking

forward to seeing what Redmond was going to do with the company. To us as

SharePoint people, perhaps the biggest news is that SharePoint gets a special FAST

search engine, titled FAST Search for SharePoint 2010.

FAST has been a market leader for enterprise search for many years, but unless you

had a wallet the size of Egypt, you were unlikely to be able to share in the goodness.

However, the new engine promises both cheaper and easier access to FAST for

SharePoint sites.

  1. Business Intelligence

You find further new features in the Business Intelligence category, dubbed

Insights. Excel Services and the dashboards are still with us, but there are several

new features as well.

Related to Excel Services is SQL Server PowerPivot, a web-based service

previously known as Gemini. In short, users can now navigate and query massive

datasets in their browsers in microseconds. An Excel spreadsheet with tens of

millions of rows would take quite literally forever to download, but PowerPivot

makes filtering and working with data such as this very fast.

For enterprise license holders, Performance Point is now included. Performance

Point prior to SharePoint 2010 was a stand-alone SharePoint-based business

intelligence tool that Microsoft decided to include in the package for SharePoint

2010. Performance Point is great for setting up dashboards and getting insights into

business data, including drilling down into details in the browser.

The previously mentioned BCS improves Insights even more, allowing you to

expose other business data in SharePoint and utilize it as part of KPI dashboards or

in other business intelligence solutions.

  1. Managed Metadata Services

WithManaged Metadata Services, you can define and manage a central set of

metadata throughout your farm. You can then use these sets of metadata as

metadata in lists or content types, as tags for tagging content, or for other uses.

These sets of metadata are stored in term sets. For each term set, you can set

permissions and optionally allow users to extend the set by providing custom

values.

One vast improvement served by the Managed Metadata Services is the optional

content types distribution. You can now centrally define and manage content types

and allow your site collections to subscribe to these content types.

On the next page, in Figure 14, you can see the overview of the various service

applications that ship out of the box with SharePoint 2010.

  1. Service Applications

A major change in architecture, however, is that of service applications. Out is the

old Shared Services Provider, and in is the new method for sharing data and

services across an organization.

Service applications are individual services such as search, user profiles, Excel

Services, and others. However, rather than being part of one monolithic application

as was the case for Shared Services, the service applications are individual services

that can be turned on and off as needed.

Further, these service applications can expose themselves as WCF services to any

location anywhere. If you have no idea what that means, think of it like software as

a service where you can expose services in your SharePoint farm to someone else

either in your organization or on the Internet.

Companies may, for example, expose their user profile services to each other to

allow for cross-company people search. Other organizations may want to build a

giant Excel services rendering farm and allow other farms to utilize that service so

they do not have to implement it themselves.

Developers can also create new service applications and harness the power of

SharePoint to create completely new features either locally or globally.

  1. SharePoint Best Practices Analyzer

With the SharePoint 2010 release, SharePoint Best Practices Analyzer will be incorporated as part of the base SharePoint product. This tool provides Microsoft’s guidance for SharePoint implementation and troubleshooting. A Problems and Solutions page in the analyzer helps you solve common implementation problems.

  1. Usage reporting and logging

SharePoint 2010 includes a new database designed to support usage reporting and logging. The usage database is extensible, allowing third-party vendors to create custom reports based on the information it contains.

  1. Visio Services

Visio Services in SharePoint 2010 lets users share and collaborate on Visio diagrams. A built-in viewer lets SharePoint users view Visio files in their browser without having Visio installed on their system. Visio Services also retrieves and renders any external data used in the Visio diagrams.

  1. Enhanced collaboration features

SharePoint 2010 supports tagging content as well as providing enhanced blog authoring capabilities. There’s a new group authentication feature that’s based on distribution list or organization and a new rich text editor for creating wikis. In addition, calendars from Microsoft Exchange Server can be merged with SharePoint calendars.

Sharepoint 2010 New Features

Filed under: Uncategorized — Ravendra Mishra @ 2:50 pm

 Sharepoint 2010 New Features

December 3, 2009

Sharepoint workflow on list item delete

Filed under: Uncategorized — Ravendra Mishra @ 6:04 pm

In order to trigger workflow on item delete you need to create event receivers and from event receiver call the workflow already attached with list. You may also pass parameters to the workflow.

FeatureReceiver.cs

using System;

using System.Collections.Generic;

using CMPM;

using Microsoft.SharePoint;

using Microsoft.SharePoint.Administration;

using Microsoft.SharePoint.Workflow;

namespace CMPM

{

    public class FeatureReceiver : SPFeatureReceiver

    {

        string assemblyName = “EventDeleteItemMPPWWorkflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42bd3e28d7726752”;

        public override void FeatureActivated(SPFeatureReceiverProperties properties)

        {

            SPWebApplication webApp = null;

            if (properties.Feature.Parent is SPWeb)

            {

                SPWeb spWeb = properties.Feature.Parent as SPWeb;

                foreach (string strList in ActivityLists.Get())

                {

                    SPList list = spWeb.Lists[strList];                   

                    //Add date event receiver

                    string classNameDateHandler = “CMPM.DeleteEventHandler”;

                    list.EventReceivers.Add(SPEventReceiverType.ItemDeleting, assemblyName, classNameDateHandler);                  

                }

                spWeb.Update();

            }

        }

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)

        {

            if (properties.Feature.Parent is SPWeb)

            {

                using (SPWeb web = (SPWeb)properties.Feature.Parent)

                {

                    foreach (string strList in ActivityLists.Get())

                    {

                        SPList List = web.Lists[strList];

                        foreach (SPEventReceiverDefinition listEventReceiverDefinition in List.EventReceivers)

                        {

                            if (listEventReceiverDefinition.Assembly == assemblyName && listEventReceiverDefinition.Type == SPEventReceiverType.ItemDeleted)

                            {

                                listEventReceiverDefinition.Delete();

                                break;

                            }

                        }

                    }

                    web.Update();

                }

            }

        }

        public override void FeatureInstalled(SPFeatureReceiverProperties properties) { /* no op */}

        public override void FeatureUninstalling(SPFeatureReceiverProperties properties) { /* no op */}

        private List<SPWebConfigModification> CreateConfigModifications()

        {

            List<SPWebConfigModification> configModifications = new List<SPWebConfigModification>();

            //

            //  TODO: Add code to create web config modifications

            //

            return configModifications;

        }

    }

}

DeleteEventHandler.cs

using System;

using Microsoft.SharePoint;

using Microsoft.SharePoint.Workflow;

namespace CMPM

{

    public class DeleteEventHandler : SPItemEventReceiver

    {

        //public override void ItemDeleted(SPItemEventProperties properties)

        public override void ItemDeleting(SPItemEventProperties properties)

        {

            base.ItemDeleting(properties);

            string strListName = properties.ListTitle;

            SPWorkflowManager objWorkflowManager = null;

            SPWorkflowAssociationCollection objWorkflowAssociationCollection = null;

            using (SPWeb web = properties.OpenWeb())

            {

                SPListItem item = properties.ListItem;

                objWorkflowManager = web.Site.WorkflowManager; //item.Web.Site.WorkflowManager;

                objWorkflowAssociationCollection = web.Lists[strListName].WorkflowAssociations; //item.ParentList.WorkflowAssociations;

                foreach (SPWorkflowAssociation objWorkflowAssociation in objWorkflowAssociationCollection)

                {

                    //Find the GUID for the workflow association

                    if (objWorkflowAssociation.BaseId.ToString() == “dc891ef1-00e1-45fd-9774-528d00bf945d”)

                    {

                        MPPWWorkflowParameters objParams = new MPPWWorkflowParameters();

                        objParams.ListName = strListName;

                        objParams.IsDelete = true;

                        string strSerializedParams = objParams.getInitXmlString(objParams);

                        objWorkflowAssociation.AssociationData = strSerializedParams;

                        objWorkflowManager.StartWorkflow(item, objWorkflowAssociation,

                        objWorkflowAssociation.AssociationData, true);

                    }

                }

            }

        }

    }

}

WorkflowParameters.cs

using System;

using System.Linq;

using System.Text;

using System.IO;

using System.Xml.Serialization;

namespace CMPM

{

    [Serializable()]

    public class MPPWWorkflowParameters

    {

        private string listName = string.Empty;

        private bool isDelete = false;

        public string ListName

        {

            get { return listName; }

            set { listName = value; }

        }

        public bool IsDelete

        {

            get { return isDelete; }

            set { isDelete = value; }

        }

        public string getInitXmlString(MPPWWorkflowParameters objParams)

        {

            MPPWWorkflowParameters parameters = new MPPWWorkflowParameters();

            parameters.ListName = objParams.ListName;

            parameters.IsDelete = objParams.IsDelete;

            using (MemoryStream stream = new MemoryStream())

            {

                XmlSerializer serializer = new XmlSerializer(typeof(MPPWWorkflowParameters));

                serializer.Serialize(stream, parameters);

                stream.Position = 0;

                byte[] bytes = new byte[stream.Length];

                stream.Read(bytes, 0, bytes.Length);

                return Encoding.UTF8.GetString(bytes);

            }

        }

    }

}

Creating your own WSP package from a .net Assembly

Filed under: Uncategorized — Ravendra Mishra @ 4:43 pm

Creating your own WSP package from a .net Assembly

 

Let’s say you want to create a WSP package for a web part class library. For some reason you are not able to use standard tools to create WSP for you (i.e. stsdev etc).

  1. Create web part class library

Use sharepoint web part project type to create a new project.

  1. Add as many web parts you need to add

Please not that for each web part added you need to make a entry in following files

  1.  
    1. .ddf
    2. manifest.xml
    3. feature.xml
    4. webparts.xml

In a moment I will come into details of these file types.

  1. .ddf file

; Generated at 30/11/2009 10:10:50

.OPTION EXPLICIT

.Set CabinetNameTemplate=ReportingWebParts.wsp

.set DiskDirectoryTemplate=CDROM

.Set CompressionType=MSZIP

.Set UniqueFiles=off

.Set Cabinet=on

.Set DiskDirectory1=”bin\Debug\”

;*** Solution manifest

bin\Debug\manifest.xml

;*** Assembly files

“bin\Debug\BusinessLogicLayer.dll”

“bin\Debug\DataLayer.dll”

“bin\Debug\ReportingWebParts.dll”

;***********************************

;***     FeatureFiles section    ***

;***********************************

;*** add files for Reports feature

.Set DestinationDir=ReportingWebParts

“C:\Ravendra\ReportingWebParts\ReportingWebParts\feature.xml”

“C:\Ravendra\ReportingWebParts\ReportingWebParts\WebParts.xml”

;*** add files for Reports\WebParts feature

.Set DestinationDir=ReportingWebParts\WebParts

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\DistributorActivityByAccountManager.webpart”

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\ReportOfOutcomesReport.webpart”

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\ReportByShippingCompanyReport.webpart”

“C:\Ravendra\ReportingWebParts\\ReportingWebParts\\WebParts\ReportByProductReport.webpart”

  1. manifest.xml

<?xml version=”1.0″ encoding=”utf-8″?>

<!–Manifest created at 30/11/2009 09:41:19–>

<Solution SolutionId=”40890978-145b-4684-b3b7-5c2012541795″ ResetWebServer=”True” xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

  <!–Feature Manifest files–>

  <FeatureManifests>

    <FeatureManifest Location=”CMPMReportingWebParts\feature.xml” />

  </FeatureManifests>

  <!–Assembly files–>

  <Assemblies>

    <Assembly Location=”BusinessLogicLayer.dll” DeploymentTarget=”GlobalAssemblyCache” />

    <Assembly Location=”CMPM.DataLayer.dll” DeploymentTarget=”GlobalAssemblyCache” />

    <Assembly Location=”CMPMReportingWebParts.dll” DeploymentTarget=”GlobalAssemblyCache”>

                <SafeControls>

        <SafeControl Assembly=”CMPMReportingWebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42bd3e28d7726752″ Namespace=”CMPM.WebParts.Reports” TypeName=”*” Safe=”True” />

      </SafeControls>

                  </Assembly>

  </Assemblies>

</Solution>

  1. Feature.xml

<Feature Title=”ReportingWebParts” Description=”Cusotm web parts containing reports for ” Version=”1.0.0.0″ Scope=”Site” Hidden=”false”  xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

  <ElementManifests>

    <ElementManifest Location=”WebParts.xml” />

    <ElementFile Location=”WebParts\DistributorActivityByAccountManager.webpart” />

    <ElementFile Location=”WebParts\ReportByProductReport.webpart” />

    <ElementFile Location=”WebParts\ReportByShippingCompanyReport.webpart” />

    <ElementFile Location=”WebParts\ReportOfOutcomesReport.webpart” />

  </ElementManifests>

</Feature>

  1. Webparts.xml

<?xml version=”1.0″ encoding=”utf-8″?>

<!–Created by STSDEV at 2/11/2009 1:41:01 AM–>

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”&gt;

  <Module List=”113″ Url=”_catalogs/wp” Path=”WebParts” RootWebOnly=”True”>

    <File Url=”DistributorActivityByAccountManager.webpart”>

      <Property Value=”ReportingWebParts” />

    </File>

    <File Url=”ReportByProductReport.webpart”>

      <Property Value=”ReportingWebParts” />

    </File>

    <File Url=”ReportByShippingCompanyReport.webpart”>

      <Property Value=”ReportingWebParts” />

    </File>

    <File Url=”ReportOfOutcomesReport.webpart”>

      <Property Value=”ReportingWebParts” />

    </File>

  </Module>

</Elements>

  1. .WebPart files: for each webpart

<?xml version=”1.0″ encoding=”utf-8″?>

<webParts>

  <webPart xmlns=”http://schemas.microsoft.com/WebPart/v3″&gt;

    <metaData>

      <type />

      <importErrorMessage>Error importing WebParts.Reports.DistributorActivityByAccountManagerReport Web Part</importErrorMessage>

    </metaData>

    <data>

      <properties>

        <property>Distributor Activity By Account Manager Report</property>

        <property>Distributor Activity By Account Manager Report</property>

        <property>Normal</property>

        <property>True</property>

        <property>True</property>

        <property>All</property>       

      </properties>

    </data>

  </webPart>

</webParts>

 

  1. .Bat file to create WSP package

“C:\WINDOWS\System32\makecab.exe” /F ReportingWebParts.ddf /D CabinetNameTemplate=ReportingWebParts.wsp

JQuery to show/Hide elements dynamically

Filed under: Uncategorized — Ravendra Mishra @ 4:31 pm

<script>
 /*

 Text Boxes html
 <tr>
  <td width=”190px” valign=”top”>
   <h3>
    <nobr>Key or Licence Number
     <span>*</span>
    </nobr>
   </h3>
  </td>
  <td width=”400px” valign=”top”>
   <span dir=”none”>
   <input maxlength=”255″ title=”Key or Licence Number” /><br>
   </span>Provide UKHO licence
   number or ADP Key number where
   applicable.
  </td>
 </tr>
 Option/Radio Button html
 <tr>
  <td>
   <span title=”Digital Chart Services – AVCS”>
    <input value=”ctl00″ checked=”checked” />
    <label for=”ctl00_ctl19_g_e7b38077_2b92_4881_b667_83ee40defade_ff7_1_ctl00_ctl00″>Digital Chart Services – AVCS</label>
   </span>
  </td>
 </tr>

 */

 _spBodyOnLoadFunctionNames.push(“configureFields”);

 function slideShow(fieldName) {
  var selector = “nobr:contains(‘” + fieldName + “‘)”;
  //$(selector).parent().parent().parent().slideDown(‘slow’);
  $(selector).parent().parent().parent().show();
 }
 
 function slideHide(fieldName) {
  var selector = “nobr:contains(‘” + fieldName + “‘)”;
  //$(selector).parent().parent().parent().slideUp(‘slow’);
  $(selector).parent().parent().parent().hide();
 }
 
 function showGeneral()
 {
  // Hide these fields
  slideHide(‘Key or Licence Number’);
  slideHide(‘Product Name or Number’);
  slideHide(‘Current Base discs installed’);
  slideHide(‘Expiry Date’);
  slideHide(‘Permit Number’);
  slideHide(‘Edition Date’);
  slideHide(‘Current Weekly Update Held’);
 }
 
 function showDigital()
 {
  // Show these fields
  slideShow(‘Key or Licence Number’);
  slideShow(‘Product Name or Number’);
  slideShow(‘Current Base discs installed’);
  slideShow(‘Expiry Date’);
  // Hide these fields
  slideHide(‘Permit Number’);
  slideHide(‘Edition Date’);
  slideHide(‘Current Weekly Update Held’);
 }

 function showPaper()
 {
  // Hide these fields
  slideHide(‘Key or Licence Number’);
  slideHide(‘Product Name or Number’);
  slideHide(‘Current Base discs installed’);
  slideHide(‘Expiry Date’);
  // Show these fields
  slideShow(‘Permit Number’);
  slideShow(‘Edition Date’);
  slideShow(‘Current Weekly Update Held’);
 }
 
 function configureFields() {
  showGeneral();
  $(“span[title^=’General’]”).children(“input”).focus( function () { showGeneral() } );
  $(“span[title^=’Digital Chart Services’]”).children(“input”).focus( function () { showDigital() } );
  $(“span[title^=’Paper Products & Publications’]”).children(“input”).focus( function () { showPaper() } );
 }
</script>

Insert web parts in NewItem or Edit Item sharepoint pages

Filed under: Uncategorized — Ravendra Mishra @ 4:28 pm

ToolPaneView hack

This next workaround is great, because it can be done in the web browser and requires no SharePoint designer. It is exceedingly simple. For any web part page, simply append the following text to the URL:

&ToolPaneView=2

Thus, if my original URL was:

http://tidemo/tftp/Lists/IT%20Assets/DispForm.aspx?ID=2&Source=http%3a%2f%2ftidemo%2ftftp%2fLists%2fIT%2520Assets%2fAllItems.aspx&PageView=Shared

Then my new URL is:

http://tidemo/tftp/Lists/IT%20Assets/DispForm.aspx?ID=2&Source=http%3a%2f%2ftidemo%2ftftp%2fLists%2fIT%2520Assets%2fAllItems.aspx&PageView=Shared&ToolPaneView=2

Below is a screen capture of the effect. If you look carefully you see two things have happened. The page is now in Edit Mode and the “Add Web parts” window is displayed. Since we are in edit mode, we can click any web part zone and add our web part!

Sharepoint related sites to visit

Filed under: Uncategorized — Ravendra Mishra @ 3:43 pm

Following sites and blogs contains quite interesting sharepoint stuff

First of all another compiled list of top 100 sharepoint blogs http://www.sharepointjoel.com/Lists/Posts/Post.aspx?ID=31 

Bil Simser  http://weblogs.asp.net/bsimser

Jan Tielens http://weblogs.asp.net/jan

Richard http://cglessner.blogspot.com/

Gary Lapointe http://stsadm.blogspot.com/

Cleaver workaround http://www.cleverworkarounds.com/2008/02/28/more-sharepoint-branding-customisation-using-javascript-part-3/

Blog at WordPress.com.