Wednesday, September 23, 2009

Creating a sequential workflow for MOSS using WWF and InfoPath

http://weblog.vb-tech.com/nick/archive/2007/02/25/2207.aspx


Wednesday, September 16, 2009

MOSS 2007 limitations

As with every application MOSS 2007 has limitations .

However, I think you will see these limitations are such that they will have little impact in virtually any enviroment.

Microsoft Office SharePoint Server (MOSS) 2007 Limits

Site Collections in a Web Application50,000
Sites in a Site Collection250,000
Sub-sites nested under a Site2,000
Lists on a Site2,000
Items in a List10,000,000
Documents in a Library2,000,000
Documents in a Folder2,000
Maximum document file size2GB
Documents in an Index50,000,000
Search Scopes1,000
User Profiles5,000,000

Wednesday, September 2, 2009

MOSS 2007 webpart using CAML query

Here is a simple webpart using CAML query to fetch a particular value from a SharePoint List.
I have an announcement list and I am searching for a "Title" corresponding to a field called "Posted By" in the same list. I use the u2u CAML query builder to build CAML queries.Here goes my webpart code:

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using System.Data;
using System.Diagnostics;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.Utilities;
namespace WSPBuilderProject1
{
[Guid("be9d2bda-11ef-43e2-bad3-85e5238a1755")]
public class WebPartFeature1 : Microsoft.SharePoint.WebPartPages.WebPart
{
Label lbl;
protected override void CreateChildControls()
{
try
{ //Initializing my site collection url
string sUrl = "http://sm-cala-csx01:5318/sites/HRDep";
//Always use the "using" statement to ensure proper disposal of the SPWeb and SPSite objects.
using (SPSite siteCollectionOuter = new SPSite(sUrl))
{
//Initializing my web app url since my lists are in a subsite called Docs
using (SPWeb webapp = siteCollectionOuter.AllWebs["/sites/HRDep/Docs"])
{
//The list Ann Log to which I want to add data after Item is added to list Announcements
SPList annLog = webapp.Lists["Announcements"];
//Adding the Title field of the new item to my Ann Log list
SPQuery getItem = new SPQuery();
getItem.Query = "Rxiyer";
SPListItemCollection items = annLog.GetItems(getItem);
lbl = new Label();
if (items != null)
{
string strTitle = SPEncode.HtmlEncode(items[0].DisplayName.ToString());
//HtmlEncode(items["Title"].ToString());
//QueryFieldNames["Title"].ToString();
lbl.Text = strTitle;
}
else
{
lbl.Text = "error";
}
this.Controls.Add(lbl);
}
}
}
catch (Exception ex)
{
//Writing any exceptions to the event viewer under a source called SharePoint Features
if (!EventLog.SourceExists("SharePoint Features"))
EventLog.CreateEventSource("SharePoint Features", "Application");
EventLog.WriteEntry("SharePoint Features", ex.ToString());
}
}
}
}

Tuesday, September 1, 2009

Infopath and Webservice reference

http://blogs.msdn.com/jannemattila/archive/2007/01/21/infopath-and-web-service-data-connection.aspx
http://blogs.msdn.com/philoj/archive/2005/11/08/490200.aspx

http://msdn.microsoft.com/en-us/library/aa192516(office.11).aspx

MOSS 2007: Event handler code to add item to a list

I wanted to update a list called "Ann Log" when a new item is added to a "Announcement" list.
So, I used to ItemAdded method of the event handler.
The simple steps are as follows:

  • I use the WSPBuilder project to create and deploy custom code on my portal since WSP builder makes my life really simple.You can download WSPBuilder add in to Visual Studio from here:http://wspbuilder.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30858
  • Now create a new project of type WSPBuilder .
  • I named it "ListItemFetcher".
  • Add a new item of the type "EventHandler". Keep the scope as "Web".It will automatically create a folder structure with feature.xml and element.xml.
  • In the elements.xml make the receiver type as "ItemAdded" and for Announcements list make the template id as "104"
  • Next open the EventHandler1.cs file and write the code for ItemAdded.
  • Here is my code snippet.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.Diagnostics;
namespace ListItemFetcher
{
public class EventHandler1 : SPItemEventReceiver
{
public override void ItemAdded(SPItemEventProperties properties)
{
try
{ //Initializing my site collection url
string sUrl = "
http://sm-cala-csx01:5318/sites/HRDep";
//Always use the "using" statement to ensure proper disposal of the SPWeb and SPSite objects.
using (SPSite siteCollectionOuter = new SPSite(sUrl))

{
//Initializing my web app url since my lists are in a subsite called Docs
using (SPWeb webapp = siteCollectionOuter.AllWebs["/sites/HRDep/Docs"])
{
//The list Ann Log to which I want to add data after Item is added to list Announcements
SPList annLog = webapp.Lists["Ann Log"];
//Adding the Title field of the new item to my Ann Log list
string item = properties.AfterProperties["Title"].ToString();
SPListItem annLogNewItem = annLog.Items.Add();
annLogNewItem["Title"] = item;
annLogNewItem.Update();
} } }
catch (Exception ex)
{
//Writing any exceptions to the event viewer under a source called SharePoint Features
if (!EventLog.SourceExists("SharePoint Features"))
EventLog.CreateEventSource("SharePoint Features", "Application");
EventLog.WriteEntry("SharePoint Features", ex.ToString());
} } }}
  • Now build and deploy the WSPBuilder project.If deploying to another machine use stsadm to deploy the WSP package.
  • Go onto SharePoint Central Admin -->Operations-->Solution Management and check if your ListItemFetcher.WSP is visible.
  • If yes bingo ! your solution has been deployed.
  • Go onto your Site Actions menu of your site -->Site Settings-->Site Features.
  • Activate the ListItemFetcher feature there and check by adding a new item to Announcements List it should add the same Title to Ann Log List.

  • Thursday, August 27, 2009

    Excel Services :Example

    Excel Services has several offerings and the one I would like to discuss in this post is how useful Excel Services programming could be for a Business.
    A person in an organization could define business logic and models on an excel spreadsheet .A developer could create a user interface for an end user to use the logic and get results.The developer could do this by calling the Excel Services web service to get the logic from the spreadsheet, perform calculations and publish the results on a user interface.
    Whenever the business logic needs to be changed there is no need for the developer to be involved . A person can just go and modify the logic or rule and the excel services would work with the new logic automatically.

    A very common example of Excel Services to demonstrate the same is "an Excel Services Mortgage Calculator".
    To refer to the same you can go to:http://msdn.microsoft.com/en-us/library/aa973804.aspx

    MOSS 2007 : psconfig.exe

    Use and Need of psconfig.exe in MOSS 2007

    In SharePoint Products and Technologies, you can use the psconfig.exe command-line tool as an alternate interface to perform several operations that control how the SharePoint Products and Technologies are configured. You must be a member of the Administrators group on the local computer to perform these operations.

    Here is a scenario I found where one would use psconfig instead of the MOSS graphical interface.

    For example, if you want to use a SQL server installed on different domain than SharePoint, without using domains trust relationship, you have to connect to the SQL instance using SQL authentication. When creating, or connecting a server to a farm, the only way to use SQL authentication is to use psconfig.exe (located at 12\bin directory) tool.

    More information on psconfig.exe:http://technet.microsoft.com/en-us/library/cc263093.aspx.

    You can also refer to :http://blogs.msdn.com/yvan_duhamel/archive/2008/11/24/configuring-your-sharepoint-farm-through-psconfig-command-line-tool.aspx