Sanjaya on SharePoint/Microsoft technologies

a blog on technologies like .net, MOSS 2007, wss 3.0 etc

Archive for the ‘Technology’ Category

Customizing a SharePoint data form web part

Posted by sNjY on July 19, 2009

In this post, I am going to talk about customizing a SharePoint data form web part with XML and XSLT. I call this web part an easy web part as it comes so easy with the beauty of XML and XSLT. It takes only three steps:

  1. Configure web part data source with XML
  2. Specify parameters to filter data with XML
  3. Customize the look and feel with XSLT.

Getting Started

The base web part XML to begin with is attached below. As you can see, this is a SharePoint data form web part with many configurable properties.

dataformwebpartxml

Next, I just need to customize three sections marked by red boxes above. Here they go again:

  • DataSourcesStri

Specify your SharePoint data source XML. You can refer to the XML SharePoint designer generates when a data source is chosen for a data form web part. However, make sure to replace the markup sensitive characters with their respective encodings.

  • & → & (ampersand)
  • &lt; → < (less-than sign)
  • &gt; → > (greater-than sign)

    Look at the xml below to find out what I mean

     dataformdatasourcexml 

  • ParameterBindin

Specify parameters binding here. Here is a sample below with some custom parameters marked in the red box

 

 dataformwebpartParameterbindingxml

 

  • DataFields

Specify the fields you would like to include from the chosen data source.

 dataformwebpartdatafields

XSLT for Look and feel:
Use custom xslt for look and feel. The xslt can be specified after the web part is deployed to a SharePoint site.

dataformwebpatxsllink

 

SharePoint designer can also be used to generate your xslt.

Finally, here is one of the web parts I created using the above customizations:

 dataformwebpartsamplewebpart 

The screen shot shows the list of parameters that can be configured using the web part parameters editor window;

 

dataformwebpartparametereditor 

By dropping multiple instances of the web part with different set of parameters, a web part page looks like this:

webpartpagewithmultiplewebparts

Posted in Technology | Tagged: , , , | 5 Comments »

Override CSS in SharePoint

Posted by sNjY on June 16, 2009

There are many ways to override a CSS class in SharePoint. However, the way i’m going to talk about is, i believe the easiest way when there are a few css classes you want to quickly override and achieve the kind of look and feel you want.

First find which CSS classes you want to modify, here is a link to CSS reference chart for sharepoint 2007

http://www.heathersolomon.com/content/sp07cssreference.htm

In my example below, i will be overriding the srch-paging and srch-stats classes to modify the back groud color for search paging and search statistics web parts commanly used in Sharepoint Search centers. Here are steps:

  • Drop a content editor webpart on the results.aspx page of your Search center.
  • On the property pane, open the source editor for the webpart.
  • Insert inline styles as given below and save.  

<style>

.srch-stats{

    background-color: red !important;

    white-space:normal !important;

}

 .srch-Page{

    background-color: #000000 !important;

}

</style>

               

  • Set the content editor webpart chrometype to none as you don’t want anything of this webpart to be displayed on the page.

Posted in Technology | Tagged: , | Leave a Comment »

Documents (doc,docx,xls,xlsx,pdf etc) preview functionality with sharepoint search

Posted by sNjY on April 15, 2009

I have been working with this product called Longitude for sharepoint for some time now. I must say this is a great product that extends shrepoint search capabilities. It lets users preview documents without the necessity to download them as shown:

 preview1

Some of the other kool features of the product are:

  • Faceted Navigation (let users refine results based on grouping by document metadatas)
  • Popularity tagging
  • Key concepts (based on document tagging)
  • Documents preview, download, print etc functionality right on the search results page.
  • XSLT based customization of Search UI
  • Parametric Search
  • Hit highlighting
  • Wild card Search
  • Enhanced People Search etc

With these features, finding the relevant information is 10 times faster than with the default sharepoint search.

For additional info on the product, visit http://www.ba-insight.net

Posted in Technology | Tagged: , , , , , , , , , , , , | 4 Comments »

Extending Sharepoint Search with Longitude

Posted by sNjY on March 8, 2009

Longitude for SharePoint is a product from Ba-insight that extends search capabilities of MOSS 2007. 

Here are some vidoes demo of the product.

http://www.ba-insight.net/enterprise-search-demo.html

Here is a comparison among Mss 2008, Moss 2007 search and Ba-insight Longitude for search.

http://www.ba-insight.net/longitude-feature-matrix2.html

Posted in Technology | Tagged: , , , , , , , , | 3 Comments »

Changing sharepoint workflow history list programatically

Posted by sNjY on November 21, 2008

Posted in Technology | Tagged: | Leave a Comment »

SharePoint Tips

Posted by sNjY on November 18, 2008

Here are some sharepoint tips. Please click on respective links for a detailed explaination.

Thanks to my friend Mahesh for sharing these.

· Migrate an SSP to another farm (Office SharePoint Server 2007) This article describes the unique process of migrating an SSP from one server to another.
· Running SharePoint Virtually (VIDEO) In conversations with customers and partners, most organizations running SharePoint are now considering running it on virtualized servers. Last week, Michael Noel, partner at Convergent Computing – a Microsoft Gold Partner and SharePoint MVP, sat down with me to talk about running SharePoint components virtually.
· Internet presence scenario (Office SharePoint Server 2007) This series of topics and an accompanying poster provides an end-to-end scenario that outlines how to plan, design, build, and maintain an enterprise’s Internet presence Web site based on Office SharePoint Server 2007. This scenario focuses on the design, creation, and deployment of an Internet presence site in a large enterprise.
· Security for Federation (Office SharePoint Server 2007) This article describes security considerations for the Federation feature of Office SharePoint Server 2007 with the Infrastructure Update for Microsoft Office Servers installed.
· Microsoft SharePoint Products and Technologies Team Blog
· SharePoint Toolbox
· SharePointPedia is the very first custom developed Internet facing SharePoint based application hosted by the MSCOM Operations team that has support for Windows Live ID authentication and integration with Microsoft’s “RegSys” user profile system that is used across all Microsoft.com properties

Posted in Technology | Tagged: | Leave a Comment »

Developing a sharepoint workflow

Posted by sNjY on October 14, 2008

Following is a link to a pdf document that talks about basics of developing a sharepoint workflow. I found this very informative. I hope you’ll like it too.

so20you20want20to20develop20custom20sharepoint20workflows1

Posted in Technology | Tagged: , | Leave a Comment »

SharePoint Calculated Fields

Posted by sNjY on August 22, 2008

The sharepoint calculated fields formula support EXCEL functions.I recently came to know about this and it really proved useful to format a date field.

The article below has extensive list of excel functions.

 http://blog.ray1.net/2008/04/sharepoint-calculated-fields-use-excel.html

 Note: The formatted calculated fields then can be used in many places including SPD workflow which runs on a sharepoint list item.

 

Posted in Technology | Tagged: , | 2 Comments »

SharePoint List views, few issues and workarounds

Posted by sNjY on August 22, 2008

I’m sure List Views need not be defined here if you are a SharePoint guy. They are frequently used. In short, list views are used to display a particular view of list data with sorting, filtering, grouping etc. As this article is intended for SharePoint developers and administrators, let me quickly get into the point I want to Share. In this article I wish to talk about some cool and not so cool things about List views in SharePoint from my own experience. I hope some of you can benefit.

If we take Task List for example, following are the default views that are installed along with a team site or a document workspace.

All Tasks   
My Tasks  
Due Today  
Active Tasks  
By Assigned To  
By My Groups 
 The list view name itself speaks on what’s the kind of view of list data that is displayed by it. Obviously, list views are cool features in SharePoint to present list data. These views can be edited to select/deselect the columns to be displayed, to enable/disable sorting, filtering and grouping, to change items display style, to change items count per page etc.

Enough of good things about the list views, now let s get into some of the limitations and workarounds to them. I will continue with Tasks List for example.

Limitations:

 1.)

 The listed default views or any custom views for a task list can be viewed as a dropdown list on a standard list view web part tool bar and user can switch between them and view different views of data as shown below:

 

 This is good. But what is not so good is that a view does not appear in the list after you edit it. Thereafter, the only way to access or view the view is by using the view’s web address. A view has its web address assigned to it. For example, for the view My Tasks, the web address is like

http://server/lists/tasks/myitems.aspx

 

Let’s say if you have edited the view called My Tasks, thereafter, it cannot be viewed anywhere else but using its web address only.

 

I even copied the list form web parts source code by opening the myitems.aspx page in SharePoint designer and pasted the list form web part in a brand new aspx page. When I opened my new page, I

 Was able to see the My Tasks view but it disappeared from the original page i.e.

http://server/lists/tasks/myitems.aspx.

Findings:

The edited view for example My Tasks actually exist in the system. You can create a custom ListviewWebPart and use the edited view to display data where ever you want. Following is a sample source code:

protected override void CreateChildControls()

{

base.CreateChildControls();

SP.WebPartPages.ListViewWebPart lst = new ListViewWebPart();

lst.ListName =

SPControl.GetContextWeb(System.Web.HttpContext.Current).Lists["Tasks"].ID.ToString(“B”).ToUpper();

lst.ViewGuid = SPControl.GetContextWeb(System.Web.HttpContext.Current).Lists["Tasks"].Views[“My Tasks”].ID.ToString(“B”).ToUpper();

lst.ViewType =ViewType.Html;

lst.ChromeType = System.Web.UI.WebControls.WebParts.PartChromeType.None;

lst.GetDesignTimeHtml();this.Controls.Add(lst);

}

Tip if you must have to edit an existing view and you don’t want it to disappear:

Create a custom view from any of the existing views and edit it. SharePoint gives you an option to pick up a standard view or data sheet view etc or existing views to start with to create a new view.

 2)

Next limitation applies to Task list. As this is a typical filtering issue, it can exist in other types of lists as well. Please see the article below:

http://sanjayapdl.wordpress.com/2008/03/21/single-web-part-to-display-tasks-assigned-to-current-user-and-current-users-groups/

 

Posted in Technology | Tagged: , , | 12 Comments »

Removing a version “restore” option in a document workspace

Posted by sNjY on August 21, 2008

This is very common that versioning is enabled in a doc lib to create a version of each edit. This helps to trace the changes of a document metadata and is a very useful feature.

How to view item versions:

On click of the context menu item “Version History” in a document, system redirects to Versions.aspx (a layouts page) . Versions.aspx pulls all the versions for the current document and displays.

How to view restore option and who can resotre:

In this page, user who has a add/edit/delete permission on the document, can resotre a particular version. “Restore” is an option provided as a context menu item on each version item.

Removing restore option for all users:

I took this approach, which is good and working. If you have any other way of achieving this please lemme know.

I noticed that the restore option was not shown for a user who has only view permission on the document. Then i saw through the application page Versions.aspx. In this page, the current user’s  effective base permissions on a item is passed to the system. The options in the context menu are filtered based on those permissions. I then found out the effective base permission on a item for a user who had only view permissions. Next, i hardcoded those permissions and checked, the restore option was gone as system interpreted that the logged in user has view permission only. I also ensured that this change would apply  for my document workspace alone, as Versions.aspx is an application page and other sites in the farm can use it too. Following is the piece of code, i modified on the page (versions.aspx)

<% if (m_list != null && m_item != null) %>

 

<% { %>

 

Id=

<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(m_item.ID.ToString()),Response.Output); %>

 

 

Perm=

<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(m_item.Web.Url.Contains(“sitename”)? “0x” + “0000000000031061″:”0x” + m_item.EffectiveBasePermissions.ToString(“X”)),Response.Output); %>

 

 

<% } else { %>

 

Perm=

<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(m_item.Web.Url.Contains(“sitename”)? “0x” + “0000000000031061″:”0x” + Web.EffectiveBasePermissions.ToString(“X”)),Response.Output); %>

 

 

<% } %>

 

Posted in Technology | Tagged: | 1 Comment »