Wednesday, September 29, 2010

Some excerpts from Life

Always Be brave and apologize. Kick the ego on the butt if it creeps between you two. Remember, no matter how much you care for your plant of life there is still bound to be weeds of distrust and misgivings. Weed out the negative emotions and let your love have fresh air of trust, transparency, commitment and communication.

Then the fragrance will engulf the whole family in love, joy and happiness. I know The magic of love dwell only if you sacrifice your needs and selfishness for happiness of others. Nothing is more satisfying then giving other happiness instead of stealing being content with other's persons sorrow.

Monday, March 29, 2010

Show today's Birthday's and Anniversaries in Sharepoint

Is there any requirement that ask you to display the birthday of an Employee in your organisation. Are you thinking of developing a webpart and compare the date and display it in your homepage. Well that is not at all required if you have a Sharepoint Designer which is fortunately free to download. Lets build the task from the steps below

  1. lets say we have a column with the name DOB which stores the date of birth in datetime format.
  2. Create a computable column give it a name as DOBthisYear and add this "=TEXT(DOB,"M/D/")&TEXT(Today,"YYYY")" without first and last quotes :-)
  3. now lets view the list again where it shows the DOB for current year.
  4. Open the page in Designer and edit the page. Browse through the Datasource in the site and drag and drop the list to your place.
  5. Now it will add the powerful DataformWebpart. in a list view. Now add a filter to the list in the column DOBthisYear which equals [Current Date].
  6. Save the dataformwebpart give some formatting with the image of the employee to show up in the list.

Monday, December 28, 2009

Sharepoint Connectable Webparts - Easier way than SPS-2003

Found a really helpful method to develop connectable webparts where we can pass objects as reference to another webpart.

http://businessagility.typepad.com/the_edge/2008/11/developing-custom-connectable-web-parts-in-microsoft-office-sharepoint-server-2007.html

The interface which contains the data to pass would look similar to the following:
public interface IDataProviderInterface
{
String myFilterValue { get; set; }
}


The Provider Web Part then implements the data provider interface and provides a method to communicate the data by using the ConnectionProvider method attribute.

[ConnectionProvider("DisplayName", "ID")]
public IDataProviderInterface ProviderMethod()
{
return this as IDataProviderInterface;
}


The Consumer does not directly implement the interface; rather it provides a method to consume the data as specified by the ConnectionConsumer method attribute.

[ConnectionConsumer("DisplayName", "ID")]
public void ConsumerMethod(IDataProviderInterface dataProv)
{
_providedData = dataProv;
}

Wednesday, December 9, 2009

How to find the worker process aka w3wp.exe running for ur Sharepoint Web application

This post has to be modified for IIS 6.

When you require the need of attaching your webpart debugger to the current running instance of W3WP process container for your SharePoint application from Visual Studio, you find only the ID for the W3wp currently running in the server.
To identify the current running worker process in IIS 7.0 for your application to debug under VS 2005 or VS2008.

IIS 7.0 has a wonder administration tool called appcmd.exe from which every tasks for maintaining IIS can be batched process using this command tool.
Located in %systemroot%\system32\inetsrv\

Now to display the list of web application running under W3WP process run appcmd with this parameters:
C:\Windows\System32\inetsrv>appcmd list wp
you will see

WP "4900" (applicationPool:Portal)
WP "4540" (applicationPool:TimeSheet9898)
WP "3600" (applicationPool:SharePoint Central Administration v3)


for IIS 6.0 I'll post later.

Monday, December 7, 2009

Enable Debugging in Sharepoint Site

This comes very handy .. How to enable the debugging in your newly created development Sharepoint Site.
Turn on the call stack (CallStack="true")
Disable custom errors in Visual Studio (<customerrors mode="Off"></customerrors>)
Enable compilation debugging (<compilation debug="true"></compilation>)

Wednesday, September 16, 2009

Good Practices How about this, to retrieve items from Large SPList

Use PortalSiteMapProvider (Microsoft Office SharePoint Server 2007 only).

Steve Peschka's white paper Working with Large Lists in Office SharePoint Server 2007 describes an efficient approach to retrieving list data in Office SharePoint Server 2007 by using the PortalSiteMapProvider class. PortalSiteMapProvider provides an automatic caching infrastructure for retrieving list data. The GetCachedListItemsByQuery method of PortalSiteMapProvider takes an SPQuery object as a parameter, and then checks its cache to determine whether the items already exist. If they do, the method returns the cached results. If not, it queries the list and stores the results in a cache. This approach works especially well when you are retrieving list data that does not change significantly over time. When data sets change frequently, the class incurs the performance cost of continually writing to the cache in addition to the costs of reading from the database. Consider that the PortalSiteMapProvider class uses the site collection object cache to store data. This cache has a default size of 100 MB. You can increase the size of this cache for each site collection on the object cache settings page for the site collection. But this memory is taken from the shared memory available to the application pool and can therefore affect the performance of other applications. Another significant limitation is that you cannot use the PortalSiteMapProvider class in applications based on Windows Forms. The following code example shows how to use this method.

Good Coding Practice

Using PortalSiteMap Provider
C#

// Get the current SPWeb object.
SPWeb curWeb = SPControl.GetContextWeb(HttpContext.Current);

// Create the query.
SPQuery curQry = new SPQuery();
curQry.Query = "
Hotel
";

// Create an instance of PortalSiteMapProvider.
PortalSiteMapProvider ps = PortalSiteMapProvider.WebSiteMapProvider;
PortalWebSiteMapNode pNode = ps.FindSiteMapNode(curWeb.ServerRelativeUrl) as PortalWebSiteMapNode;

// Retrieve the items.

SiteMapNodeCollection pItems = ps.GetCachedListItemsByQuery(pNode, "myListName_NotID", curQry, curWeb);

// Enumerate through all of the matches.
foreach (PortalListItemSiteMapNode pItem in pItems)
{
// Do something with each match.
}

Friday, August 28, 2009

Quick reference to add PDF or any icons

http://support.microsoft.com/kb/832809