Tuesday, March 31, 2009

Data View Customization: Calculating the Number of Days Between Two Dates in XSLT

The objective was to display the number of days between two dates such as Today and last Oct. You can't do this in out of the box SharePoint so you have to go to the XLST to perform data manipulations. Unfortunately, XSLT 1.0 doesnt have any date manipulation so we looked at DDWRT.

My colleague, Michael Bollhoefer and I searched all over Google for terms like Date Manipulation, dateDiff xslt, xsl date comparisons, datedif xslt, date difference xslt, etc. We came across a template but for some reason it wasn't returning the correct value. Eventually we came to the conclusion that the date format had to be the root of our error. We needed to convert from a gregorian dateTime format (CCYY-MM-DDT00:00:00Z) into a Juliantime format. Then you can easily subtract or add to the julian numbers to get your desired result. Subtracting the gregorian results with a sub-string function didnt provide accurate results because you have to account for the number of days in each month.


Our research finally led us to Toni Frankola's post on endusersharepoint.com which resulted in the new XSLT:



<xsl:template name="DateDiff">
<xsl:param name="StartDate"></xsl:param>
<xsl:param name="TodayDate"></xsl:param>

<xsl:variable name="JulianToday">
<xsl:call-template name="calculate-julian-day">
<xsl:with-param name="Year" select="substring(ddwrt:FormatDateTime(string($TodayDate), 1033, 'yyyyMMdd'),0,5)"/>

<xsl:with-param name="Month" select="substring(ddwrt:FormatDateTime(string($TodayDate), 1033, 'yyyyMMdd'),5,2)"/>

<xsl:with-param name="Day" select="substring(ddwrt:FormatDateTime(string($TodayDate), 1033, 'yyyyMMdd'),7,2)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="JulianStartDate">
<xsl:call-template name="calculate-julian-day">
<xsl:with-param name="Year" select="substring(ddwrt:FormatDateTime(string($StartDate), 1033, 'yyyyMMdd'),0,5)"/>

<xsl:with-param name="Month" select="substring(ddwrt:FormatDateTime(string($StartDate), 1033, 'yyyyMMdd'),5,2)"/>

<xsl:with-param name="Day" select="substring(ddwrt:FormatDateTime(string($StartDate), 1033, 'yyyyMMdd'),7,2)"/>
</xsl:call-template>
</xsl:variable>

<xsl:value-of select="$JulianStartDate - $JulianToday"></xsl:value-of>
</xsl:template>

<xsl:template name="calculate-julian-day">
<xsl:param name="Year"/>
<xsl:param name="Month"/>
<xsl:param name="Day"/>

<xsl:variable name="JulianDay" select="floor((14 - $Month) div 12)"/>
<xsl:variable name="JulianYear" select="$Year + 4800 - $JulianDay"/>
<xsl:variable name="JulianMonth" select="$Month + 12 * $JulianDay - 3"/>

<xsl:value-of select="$Day + floor((153 * $JulianMonth + 2) div 5) + $JulianYear * 365 + floor($JulianYear div 4) - floor($JulianYear div 100) + floor($JulianYear div 400) - 32045"/>
</xsl:template>


This is the template that DID NOT WORK
http://www.exslt.org/date/functions/difference/index.html

Friday, March 27, 2009

JQuery for Everyone: Preview Pane for Multiple Lists

Paul Grenier (http://www.endusersharepoint.com/) has a great code snippet using jQuery that you can simply add to a content editor web part. The possibilities are truly endless. This can be used as an alternative to using CSS ( show and hide content ), navigation, or even Connected Web Parts. Check it out: JQuery for Everyone: Preview Pane for Multiple Lists along with JQuery for Everyone: Evolution of the Preview

Also, check out Toni Frankola's post: Deploy Custom JQuery Scripts to the SharePoint Site Collection and Chris Edwards post: Integrating jQuery for Use in Your WebParts and Application Layout Pages

Jan Tielens also has some great intros on integrating jQuery and SharePoint:
Integrating SharePoint 2007 and jQuery [Part One]
Integrating SharePoint 2007 and jQuery [Part Two]

Peter Serzo (via Joel Oleson's Blog) also gives the top 5 reasons to use jQuery.

Speaking of Jan Tielens, check out SmartTools for SharePoint

what is jQuery?
jQuery is a lightweight open source JavaScript library (only 15kb in size).

Office SharePoint Server 2007: Five Ways SharePoint Can Save You Money

Office SharePoint Server 2007: Five Ways SharePoint Can Save You Money
Overview
In this paper, we look at how Microsoft SharePoint Products and Technologies can help you to reduce TCO and maximize ROI for your enterprise solutions. SharePoint Products and Technologies provide a comprehensive suite of features in all areas of information management, and can enable you to consolidate all your enterprise solutions into a single, manageable platform. Many of the world's leading companies, such as MTV and the Bank of America, are already realizing benefits from the adoption of these technologies. The paper focuses on five specific ways in which SharePoint Products and Technologies can save you money. When you adopt SharePoint Products and Technologies in your organization, you can: • Reduce IT costs and complexity • Reduce development costs • Simplify management and training • Improve employee productivity • Enhance the effectiveness of customer service and sales teams

Thursday, March 26, 2009

The Phantom Security Menace: Rogue SharePoint Sites

Neil MacDonald of Gartner estimates that 30% of SharePoint servers are deployed outside of the management of the IT department.

This doesn't surprise me in the slightest. This has been one of the big concerns I've had over SharePoint for some time. SharePoint requires organizations to work together... even to implement! Clear roles and responsibilities should be defined before any project gets started. The most common pitfall of any SharePoint project is the lack of agreement between the IT side and the business side within an organization.

Usually the experts are the folks in the middle. We're the mediators and the peace-keepers. SharePoint experts are able to communicate and understand business needs at the same time working under the umbrella of restrictions that IT holds. I've seen time and time again where IT holds the keys to the kingdom and all decisions are made under an oppressive IT thumb. (I'll save business justification for a later discussion or common pitfalls.) Last time I checked, IT works for the business... right?

I think it all comes down to a matter of trust and a solid governance plan. IT doesn't want to lose control and the business just wants their needs met. So it really doesn't surprise me that 3 out of every 10 instances go outside of IT, whom can stonewall any project.

The way I see it, there should always be an intermediate team that works with both the business and IT. I think the worlds are so different that there really has to be a translator. It doesn't make the process much easier and in fact, puts a lot of pressure on the experts stuck in the middle but it's for the greater good.

Now, as for me.... on to writing up 'tangible' MOSS benefits for the business and arguing with IT for SharePoint Designer rights in production. These are the chronicles of a SharePoint consultant! ;o)

Consuming SharePoint Lists via AJAX

Check out Kirk Evans' post on Consuming SharePoint Lists via AJAX and his companion screencast on Channel9 that walks through the entire process of creating a feature using VSeWSS. Kirk uses Features to accomplish the task of consuming SharePoint list data via JavaScript instead of Web Services.

Make sure you also check out Jan Tielens post that shows how to enable .NET 3.5 in SharePoint, the lazy way as well as Features for SharePoint, by Ted Pattison.

Wednesday, March 25, 2009

InfoPath and MOSS - Web Enabled Feedback Form

Via Stacke: InfoPath and MOSS

Here's a nice step-by-step walk-through for creating an InfoPath Form Library with a custom InfoPath form which is connected back to the InfoPath Form Library in MOSS.

The article gives some nice explanation on how to have InfoPath Forms saved back to your MOSS Forms Library with a custom name. This name can include the date with a title of your choice. There are also some very useful InfoPath troubleshooting tips.

Once the Form is published, you can allow it to be filled out over the web via web browser using Content Types and a little configuration of the Document Library (“Allow management of content types?” to Yes. Since we want to have the form accessible via the web client, we need to select Display as a Web page under “Opening browser-enabled documents”.)

Nice write-up!

Tuesday, March 24, 2009

Packaging and Re-using SharePoint Designer Workflows

Emile Bosch has some great step-by-step instructions for Packaging and Re-using SharePoint Designer Workflows. Check out Part 1 and Part 2.

Emile also released a Beta SPD Workflow Export Utility which can be found on codeplex! Download Link

SharePoint Designer to Become a Free Product?

Just ran across Randy Williams' blog post that indicates this could be true or could be an April Fool's. As of April 1, the rumor is that SharePoint Designer will be free. Randy also mentions that the entry has made it to wikipedia: http://en.wikipedia.org/wiki/Microsoft_Office_SharePoint_Designer

SharePoint Designer, Free as in Beer
SharePoint Designer will be a free download as of 1 April 2009
Get SharePoint Designer For Free

At least it gives us something to look forward to in addition to the April Fool's Jokes :)

SharePoint Silverlight Web Parts and Resources

Check out the walkthroughs and demos from Ian Morrish's site: SharePoint Silverlight Demo

Silverlight BluePrint for SharePoint

Another nice explanation of creating Silverlight applications for SharePoint in VS using the extensions can be seen on Andrew Whitechapel's blog.

Saurabhd Dasgupta works for Microsoft Consulting Services and posted these great articles:
An approach towards implementing information entry forms using Silverlight and SharePoint Part 1 and Part 2.

How to Create a Silverlight Web Part in ASP.NET for Use in SharePoint Server 2007

Silverlight webpart for SharePoint by Shantha Kumar

Simon's BinaryJam Silverlight Photoviewer Web Part

Kirk Evan's Hosting Silverlight in a SharePoint Webpart

Randy Williams: Tips For Writing Silverlight Web Parts in SharePoint: Part 2
Tips For Writing Silverlight Web Parts in SharePoint: Part 1

Silverlight Web Part in SharePoint

Friday, March 20, 2009

How to Use SharePoint Discussion Boards in Outlook 2007

Via SharePoint Solutions Blog: http://sharepointsolutions.blogspot.com/2008/11/how-to-use-sharepoint-discussion-boards.html

Let's face it, we all live and work in Outlook so this is a great way to bring discussion activity to your inbox (outside of using alerts).

The walkthrough explains:
  • How to view your discussion board in Outlook
  • How to reply to discussions (posting back to SharePoint)
  • How to start new discussions on your SharePoint discussion board

Microsoft Releases New Themes for MOSS

via Randy Drisgill: Microsoft has release new themes for MOSS. Check out Randy's blog for screenshots:
http://blog.drisgill.com/2009/03/microsoft-released-10-new-sharepoint.html

Microsoft Download Link

Automatically resizing Sharepoint Page Viewer Web Part to its content

Check out this nice tip from Baris Wanschers: Automatically resizing Sharepoint Page Viewer Web Part to its content.

Using Microsoft Excel with SharePoint 2007

Nice article and tip for end users which is often overlooked is the ability to export a SharePoint list into Excel. Here's a nice write-up on how to do this. Using Microsoft Excel with SharePoint 2007

I would like to point out one major error in the article: "You can't use Excel to edit the data that's stored in SharePoint. That's because the SharePoint data is linked to Excel through a Web query file. In this particular scenario, a Web query file facilitates only one-way operations."

This isn't true at all. The authors of the article fail to mention the List Toolbar which does offer the ability to Synchronize your SharePoint list within Excel. You have to have edit rights to the list in order to write back to the list.

In Excel 2007
You can add the 'Synchronize List' option to your Quick Access Toolbar by clicking the Office Button -> Excel Options (bottom right) ->Customize -> Change the first dropdown to Choose Commands from All Commands and locate the Synchronize List option. Click Add. Now the shortcut will appear at the top of Excel next to your save, undo, and redo changes.

Note you can also click the small arrow next to the Quick Access Toolbar and select More Commands.

Don't you love how intuitive Excel 2007 is! (note the sarcasm)

In Excel 2003
Just enable the List Toolbar by View->Toolbars - List

One key point the article does make is the inability to apply formatting. In order to do that, you'll need to create separate sheets in your Excel workbook and use lookup formulas to the data.

Wednesday, March 18, 2009

No MOSS Required: Free Web CMS Built on SharePoint Services

Here's a pretty interesting concept that I thought the community would appreciate:

No MOSS Required: Free Web CMS Built on SharePoint Services

CompleteSharePoint.NET was built by Tommy Segoro, a Practice Lead working at L7 Solutions in Perth, Western Australia. It is currently a beta solution. Released on CodePlex in October of last year, CS.NET has been downloaded over 519 time to date.

CompleteSharePoint Functionality
It is said to have some, but not all, of the same functionality as MOSS — SharePoint Server 2007. Some of these features include:

  • Custom base publishing content type (named CompleteSharepoint.NET Article Page)
  • Custom site actions menu
  • Custom administration pages located in _layouts
  • Custom controls such as page editing toolbar
  • Custom field controls (eg. publishing page content field using FreeTextBox)
  • ASP.NET VirtualPage to treat page layout as if it's a compiled .NET page
Example of CS.NET http://www.bmuu.com.au

Read more at the source...

Tuesday, March 17, 2009

SharePoint 14 Buzz!

Check out the latest SharePoint Buzz on SharePoint 14.

More Articles:
SharePoint 14, SharePoint 2010 or SharePoint 2012. The next version is a long way off by any name
Wonder What's Coming in Next Version of SharePoint?
SharePoint vNext – Rumours, Speculation and Confirmed Features
SharePoint 14: Everything We Know
SharePoint Conference 2009
Arpan Shah's Interview and Answers regarding '14'
No SharePoint 14 for you this year
Joel Oleson is writing a SharePoint 14 Book

MSDN Magazine: 10 Best Practices For Building SharePoint Solutions

http://msdn.microsoft.com/en-us/magazine/dd458798.aspx

This article discusses:
Taking advantage of built-in SharePoint capabilities
Deploying SharePoint solutions
Creating testable code
Branding SharePoint for scale and maintenance

Custom Auditing in SharePoint - Document Download and List Item Counts

So you're interested in item counts and downloads by users? Have you read up on Audit Logs? Well for those on devs working on WSS, Ted Pattison has a great article entitled "Office Space: Custom Auditing in SharePoint" which includes a code download located on MSDN Magazine.

MOSS Ratings Module

Pilothouseconsulting has a pretty cool module to allow for ratings. Check it out at their site: http://www.sharepointrating.com/Pages/sharepoint_rating_home.aspx

After a quick registration you can gain access to the .wsp and to the installation instructions.

NearPoint for Microsoft Office SharePoint Server 2007

Santa Clara, Calif .– March 17, 2009 — Mimosa Systems, a leader in next-generation email and file archiving solutions, today announced that it has extended its enterprise email and file archiving solution, Mimosa NearPointTM, to offer complete content archiving, data protection and e-Discovery support for Microsoft Office SharePoint Server 2007. Mimosa NearPoint for Office SharePoint Server 2007 provides the industry with an extensive content archive solution that delivers enhanced information management capabilities to address critical requirements for storage optimization, recovery, information access, and e-Discovery in a single offering.
Continue at source...

Mainsoft links Microsoft SharePoint, IBM Jazz

In partnership with IBM, Mainsoft on Tuesday will ship an integration package that links Microsoft's SharePoint collaboration platform and IBM's Rational Jazz system for application lifecycle management, enabling business users to have their say in application development.
Continue at source...

Microsoft SharePoint Developer Challenge

Here is an opportunity for you to win great prizes by sharing your knowledge and breadth of experience with Developers in the SharePoint Developer Forum.

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/threads/

From March 1st, 2009 to May 31st, 2009 there will be three contests and 5 monthly prizes given. You can win an Xbox 360, a Zune 120GB , or a 7” digital frame!

For more information, including eligibility and entry requirements, see official rules at http://blogs.msdn.com/pandrew/pages/microsoft-sharepoint-developer-forum-challenge-official-rules.aspx.

Monday, March 16, 2009

How to use a URL parameter to filter a Data View Web part in FrontPage 2003

This works for MOSS as well...

Insert a Data View

To add a Data View to your Web, page follow these steps:

1.Click the position on the page where you want your Data view to reside.
2.On the Data menu, click Insert Data View.
3.Click the data source that you want to use for your view.
4.Click Insert Data View.

Modify the parameter binding location

To modify the Data View to accept data from a URL, follow these steps:

1.Open the page in FrontPage 2003.
2.At the bottom of the edit window, click Code.
3.On the Edit menu, click Find.
4.In the Find What box, type ParameterBinding Name="filterParam", and then click Find Next.
5.Find the Location attribute in this line.
6.Replace the current Location attribute value with the following: "Postback;Connection;QueryString(Param)" Where Param is the parameter in the URL query string that you want to pass to the Data View filter (i.e. default.aspx?Param=MyValue).
7.At the bottom of the edit window, click Design.
8.Add a filter to the Data View. To do so, follow these steps
a. On the Data menu, click Filter.
b. Click Click here to add a new clause.
c. Select the Field Name that you want to filter on.
d. For the Value to compare against, click [Input Parameter].
9.Save the Web page.