Show InfoPath forms data using XML Web Part

If you want a quick and dirty way of showing InfoPath form results in a SharePoint web part use XML Web Part.

  1. Develop the InfoPath web form.
  2. Publish it to a SharePoint list.
  3. Rename a copy of the above form as a “.cab”.
  4. Open the “cab” file using WinZip of winrar and copy the “view1.xsl”

  5. Upload the file to a list in the same SharePoint site.
  6. Add a XML web part to a page and set the properties as below.

     

    XML Link is the path to the InfoPath form results saved in the document library.

    XSL Link is the path to the XSL file we save in step 5.

     

    And the result is……..

     

     

     

    If you want further customization to the form, you can write your own XSL and set the path in the web part.

     

     

    Form with a custom XSL……

     

SharePoint list formula fields – created month name

Few days back one our users wanted to group all the items in a MOSS list by the created month. I just created a new filed and made it a formula field and just applied the following, then used this field to group the list items.

=CHOOSE(MONTH(Created),”January”,”February”,”March”,”April”,”May”,”June”,”July”,”August”,
“September”,”October”,”November”,”December”)

Happy formula writing J

Content Query WebPart

In my SharePoint development work I come across lot of customizations which includes Master Pages, Themes, navigation look & feel, etc. And the next mostly customized thing is CQWP. We are using this lot in our internal sites. And this is really a cool WebPart which ships with MOSS. When you want to display custom fields in CQWP you have to properly set the CommonViewFields with the correct data type. Otherwise the custom fields will not appear in the CQWP. Following is a list of data types which you can refer when you do the next customization 😉

  • Text
  • Note
  • Number
  • Currency
  • Integer
  • Boolean
  • DateTime
  • Threading
  • Lookup
  • Choice
  • URL
  • Counter
  • DisplayOnly (DisplayOnly field type has no storage of its own)And I have either used or seen these used, but have not seen them documented anywhere:
  • RichHTML
  • Image

SharePoint 2007 Usage Reports

For the past few weeks I was trying to develop some custom reports to track SharePoint site usage. The built-in reports show only the current statistics. But if someone wants to view old statistics there is no way that person can generate a report.

I started by going through the MOSS object model to find out some method where I can generate these reports easily. Then I found SPWeb.GetUsageData method. But it was giving enough problems and I decided to look for some other mean.

Finally I end up with a happy solution. It was so easy, you just connect to SharePoint shared services database and it has all the tables and views you need to generate the reports.

 

 

SharePoint Shared Services database

 

 

Available views

 

 

All the tables starting with ‘ANL’ contains site usage data.

 

I simply wrote few queries and developed required reports using SSRS. Or even you can use any reporting tool which is available in the market. Since I used SSRS I simply published it into a SharePoint site.

Following is a sample query I wrote to view the most popular documents in a SharePoint site.

 

SELECT ANLResource.DocName, COUNT_BIG(*) AS HitCount

FROM ANLResourceHits INNER JOIN

ANLWeb ON ANLResourceHits.WebGuid = ANLWeb.WebGuid INNER JOIN

ANLResource ON ANLResourceHits.ResourceId = ANLResource.ResourceId

WHERE (CHARINDEX(‘.aspx’, ANLResource.DocName) = 0) AND (CHARINDEX(‘.swf’,

ANLResource.DocName) = 0)

GROUP BY ANLResource.DocName

ORDER BY HitCount DESC