Archive for Sharepoint 2007

Comparison of Various SharePoint Products

 The attached excel sheet gives a good comparison of the following SharePoint products:

  • Windows SharePoint Services 3.0
  • SharePoint Portal Server 2003
  • Office SharePoint Server 2007 for Search
  • Office Forms Server 2007
  • Office SharePoint Server 2007 Standard CAL
  • Office SharePoint Server 2007 Enterprise CAL or for Internet Site

 Comparison of the products is based on the following features:

  • Collaboration
  • Portal
  • Search
  • Content Management
  • Business Process and Forms
  • Business Intelligence
  • Management
  • Platform

 Click here to download the complete excel sheet for your reference.

Comments (4)

Customizing Context Menu in SharePoint 2007


A couple of days back I got an email request from one of my friends who wanted to know that how can he customize the context menu for items in the document library for WSS 3.0, and the very next day I was assigned a project at my job in which I had to do exactly this as one of the requirements. So today I am writing this post to put a little light on how we can customize the context menu for items in a document library. Ok I am going to illustrate this with the help of an example problem.

Problem Statement:
Whenever we upload an excel file in the document library, the context menu should have an extra item in named as lets say "View Excel Sheet as a webpage" ofcourse in this post I am not going to illustrate how we would render that excel sheet as webpage to the user but this is just to give you an idea of how things are done. This menu item would also have an "excel" like icon along site it and whenever we will click on the menu item it would just alert the user the location of the excel file .i.e. where it is stored with reference to the site.

Ok now having stated the problem lets get to some basics first.

The context menu is itself a javascript program means that the context menu is generated by a javascript code . This javascript program can be found at

\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\Core.js

Yes the name of the file has changed to Core.js from ows.js, menus in Windows SharePoint Services and SharePoint Portal Server 2003 were located in a javascript files at the following location

\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\1033\ows.js

Ok now lets dig in a bit in the Core.js file, in the Core.js file the main function responsible for the document library drop down menus is AddDocLibMenuItems(m, ctx) and this provides a hook by which we can insert additional menu items.

The first few lines of the function are as follows

if (typeof(Custom_AddDocLibMenuItems) !="undefined")
    {
        if (Custom_AddDocLibMenuItems(m, ctx))
            return;
    }

Ok now what this piece of code does? it is basically looking as to whether a function named Custom_AddDocLibMenuItems is defined or not, if it is defined then it simply calls it. So the main idea here is to override this Custom_AddDocLibMenuItems function by our own script which we can use to extend the context menu, adding new items.

Note: It is recommended that you make a copy of your Core.js before you make any changes to it.

Ok now we can override the Custom_AddDocLibMenuItems function in core.js adding our own script as follows.

function Custom_AddDocLibMenuItems(m, ctx)
{
    var strDisplayTextCustom = ‘View Excel Sheet in Browser’;

    setDocType();

    if(currentItemAppName.toLowerCase() == "microsoft office excel")
    {
          strAction="alert(ctx.HttpRoot+unescapeProperly(currentItemFileUrl))";
  
           var strImagePath = ctx.imagesPath+"XLS16.GIF";
         
           // Add menu item
           CAMOpt(m, strDisplayTextCustom, strAction, strImagePath);
 
          // add a separator to the menu

           CAMSep(m);
   }
    return false;
}

How does the function above works?

The Custom_AddDocLibMenuItems function takes two parameters m and ctx, the first parameter m is basically representing the menu object itself, where as ctx provides HTTP context information about the web request. To add an item to the menu only one function call is needed.

CAMOpt(m, strDisplayTextCustom, strAction, strImagePath);

The CAMOpt function takes 4 parameters which are as follows:

1) The menu object to add item to.
2) The display text of the menu item.
3) Javascript action to perform when item is clicked.
4) Path to an image associated with the menu item.

CAMSep function simply adds a separator bar to the menu. Finally the function returns a false which means that standard menu items should also be included, if we had returned true then standard menu items would not have been included.

Having done all this simply save the Core.js file and open your sharepoint site and a few excel sheets to the document library and check its context menu. The context menu should be as shown in the image below.



      


Comments (39)

LIVE MOSS 2007 Based Site


If you are looking for a LIVE MOSS 2007 based site, you can find an excellent collection here

http://www.wssdemo.com/Pages/websites.aspx

Comments (1)

Application pages VS Safe Pages

Application Pages: is a template page from _layouts virtual directory and has the following the characteristics

1) It is available within every site.
2) Only one copy of the page is there on the server.
3) NOT accessible via the designer.
4) Accessible through the IIS.

Safe Pages: Template page that comes from site definitions and has the following characteristics.

1) Exists only on sites where it has been specified by a template or created by a user.
2) More than one copies can exist on the server.
3) Accessible via designer.
4) NOT accessible via IIS.

Comments (2)

Important Links for WSS 3.0 and MOSS 2007

Comments (8)

Common SharePoint terms explained

 
A Server Farm can have one or more Virtual Servers (IIS Web Sites)
A Virtual Servers must have one or more Managed Paths (including the root)
A Managed Path can have one or more Site Collections
A Site Collection must have one or more Webs (or Areas)
A Web can have one or more Lists but can also have one or more Subwebs
An Area is a special Web created for use only with SPS
A Listing is a special link create for use only with an SPS Area
A List can have one or more ListItems
A ListItem must have one or more Fields.
 
 

Comments (19)

Interesting query from a friend across the border :)

Today a friend from across the border scrapped me on orkut and asked an interesting question

 

is it necessary to install sharepoint to create the web parts? I have windows 2000?

 

"I have to use existing sharepoint webparts in my aspx page. for that do i need to install sharepoint ? "

 

 

Well this is quite a common question so I wanted to post the answer to it on my blog

 

So there are a few things we should keep in mind.

 

a)      To develop SharePoint webparts, we need a machine that runs Windows 2003, in case of any other operating system you can always Remote Desktop to work on another machine which has Windows 2003 this is quite a common practice.

 

b)      Webparts cannot run in complete isolation so you need to create a sample SharePoint site to play with the webparts you create.

 

c)   I assume SharePoint Service development is integrated with the Visual Studio .Net IDE on your machine (we’re talking about the .Net 1.1 framework. In .Net 2.0, Web Part development support is default) so that you have Web Part templates as you create a new project.

      d)  To make your life easy download Visual Studio 2005 Extensions 3. 0 for WSS, that really makes the webpart creating  process  quite easy. Click here to download Visual Studio 2005 Extensions for WSS.

 

Comments (2)

Creating web parts Visual studio 2005 extensions for WSS.

 
With Visual Studio 2005 Extensions for WSS its very easy to create a web part. Today I wanted to demonstrate how we can easily create a simple web part using Visual Studio 2005 Extensions for WSS .
 
 How to create a web part with Visual studio 2005 extensions for WSS. 
 
    Click here to download the document
 
 

Comments (2)

SharePoint Solution Generator::Creating a site definiton from an existing site

Ok to get started I have created a new team site, based on the standard team site template. I have created two Custom Lists in the site named Employees and Employee Education respectively both with some added columns like Employee Name, Employee Address, Phone, Degree, College , Grade etc.
 
Now lets start SharePoint Solution Generator and start creating a site definition solution.
 
 
1) Run SharePoint Solution Generator.
 
 
2) Click on Site Definition and Click Next.
 

 
3) Now choose a site instance you would like to create a site definition template from, or else you can specify a URL also . Once done please click Next.
 

>

4) Specify the location to Save your site definition and also specify the project name.;

5) Finally press finish to proceed with generating the solution.

 6) Click on "Click here to open the generated solution".

 7) The result is a C# site definition solution with the following elements in it:

8) Start debbuging the solution. The following is the output.

—— Build started: Project: Oz Site Definiton, Configuration: Debug Any CPU ——

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll" /reference:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.Security.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll /debug+ /debug:full /keyfile:Properties\Temporary.snk /optimize- /out:obj\Debug\Oz_Site_Definiton.dll /target:library Properties\AssemblyInfo.cs "Site Provisioning Handler\SiteProvisioning.cs" "Site Provisioning Handler\SiteProvisioning.Internal.cs"

Compile complete — 0 errors, 0 warnings

Oz Site Definiton -> C:\Documents and Settings\uzubair\My Documents\SharePoint Definitions\Oz Site Definiton\bin\Debug\Oz_Site_Definiton.dll

—— Deploy started: Project: Oz Site Definiton, Configuration: Debug Any CPU ——

—— Generate Oz_Site_Definiton.wsp file and setup batch file——

Creating solution …

Operation completed successfully.

Creating setup batch file …

Operation completed successfully.

—— Add and deploy Oz_Site_Definiton.wsp to the SharePoint ——

Adding solution …

Operation completed successfully.

Deploying solution …

Operation completed successfully.

—— Activate features in solution if necessary ——

No features in this solution were activated

Restarting IIS …

Operation completed successfully.

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

9) We can now create an instance of our new site definition. If we go to the create site screen there appeared an extra template selection tab called "Development" where our new site definition appears:

 

10) Select your definition as a site template and create site and it all works !!

 
 

Comments (9)

How to include items from folders within your CAML query Results

 

By default, only items out of the root folder are returned but there is a property you can set to get the results out of a folder (or all of them if you write a small loop).

SPSite site = new SPSite("http://usmanz");
if (site != null)
{
   SPWeb web = site.OpenWeb();
   foreach (SPList docLib in web.Lists)
   {
     if (docLib.Title == "Shared Documents")
     {
     foreach (SPFolder subFolder in  docLib.RootFolder.SubFolders)
     {
        SPQuery query = new SPQuery();
        query.Query = "<OrderBy><FieldRef Name=’Title’/></OrderBy>";
       query.Folder = subFolder;
        System.Data.DataTable table = docLib.GetItems(query).GetDataTable();
     }
   }
 }
}

 

Leave a Comment

Older Posts »