Wednesday, January 27, 2010

A humble tribute to the expense claim form

In this blogpost I will be revealing my probably most popular demonstration yet. Not that it is completely my work. I borrowed ideas from office online, msdn, Paul Culmsee and other great resources out there to fine tune my favourite demo.
The starting point was a tutorial which you can find in the help system of SharePoint Designer and also online
Workflow example: Route an expense report for review
This simple tutorial will take you through the steps of publishing the sample expense report from infopath to sharepoint and show you how to hook up a simple workflow

That little tutorial has since been refined and made into a video
Demo: Streamline business processes with forms and workflows
This Demo shows how the workflow can work and has some great How To articles going into the depths of using different views and hooking up the form with an approval workflow

Finally Paul came up with a great series of articles showing you how to create a custom leave form in Infopath and touches on a favourite topic of mine. The SharePoint Webservices in part 5 of his humble tribute.
http://www.cleverworkarounds.com/

Originally I was planning on publishing a post on how to build and publish an expense claim form. since then I've realised that Paul's post on the leave form really has everything you need in it already and decided to keep it at the above useful links :-)

Tuesday, January 19, 2010

SendEmailNotification not sending emails

This is a tough one. There could be a whole bunch of reasons why your workflow tasks are not sending the OOB emails when a task is assigned. Here are just a few symptoms and their solutions

1) No emails are being sent, not receiving alerts
-Check your SMTP settings in Central Administration. Under Operations you will find Outgoing Email Settings. Make sure that a valid SMTP server is entered there. Either your local machine is running the smtp service which means the local machine name should be there or you are using an external smtp server to send your emails

-Try to connect to the smtp server using telnet on port 25.
a) open up a command prompt
b) type in: telnet smtp.yourserver.com 25
c) If you can connect, type in EHLO or HELO. If any of those give you back useful message your SharePoint Server is able to communicate with your smtp server.
Try sending a test message via telnet:
EHLO
MAIL FROM:someemail@domain.com
RCPT TO:validemail@domain.com
DATA email body
Test email message
.

Done. Make sure to do the CRLF.CRLF bit to send of the message. If it arrives, then you can rest assured that no smtp server config or firewall is blocking your SharePoint server.

Still no emails?
Make sure that the Windows SharePoint Timer Service is set to automatic and is currently in a running state. If that service crashed, or if someone stops it, no jobs will run, including the task emails and alerts.

Still plum out of luck? (been flying too much Air New Zealand lately) Make sure that the user has an email address defined!!! This sounds simple but can be a bitch when using MOSS.
When using WSS, simply click the header where it says Welcome Dude and select Edit my Settings from the dropdown. Add the missing email.
If using MOSS, you will need to update your profile either using your MySite, but if that is not available, go to the SSP Admin site and edit the profile manually there. But beware! Those changes might take some time to trickle down to your different site collections. To speed up the process open a command on the server and type stsadm -o sync
That will kick start the profile sync bewteen the profile store in SSP and the UserInfo Lists in the different SharePoint Sites.

Problem: You still can not see your changes on the userdisp.aspx pages of your site collections. even after executing the sync command and waiting a few moments paitently.
Reason: the user you are looking at is in the system, but not set as active in SharePoint. The only way to activate a user in SP is for that user to log in and do stuff. like adding, editing or deleting list items or documents. So do some stuff and execute the sync command again. That should do the trick.


So now you can see the email address on the user profile page (userdisp.aspx) but still not receiving task emails for your custom workflow tasks...
Maybe you're just impatient. the timer job is set to run every 5 minutes. to speed this up you can change the frequency using stsadm -o setproperty
the property you're looking for is job-immediate-alerts
the value is "Every 1 minute between 0 and 59"
But set that property at your own risk. It will also affect alerts on the farm.



EMail is set, user is active, smtp is behaving and the Timer Service is running, but no emails from your custom workflow.

Solution: First test if you get emails for any OOB workflows like approval and Feedback. If so, then there is an issue with multiple applicaitons using the same task list. I found assigning a new Task list for my custom workflow resolved this issue and SharePoint would send out mails for new tasks as expected. This behaviour is often caused when sites are exported and imported using stsadm. Not all settings are correctly migrated causing this behaviour to crop up. Another reason to be wary of using the export and import functionality in SharePoint to migrate solutions...

Wednesday, January 13, 2010

SharePoint Automation: Sample Install Script

SharePoint Automation: Sample Install Script

I often get asked for a magic wand when it comes to installing SharePoint. I.e. The magic install script that does it all. Instead of spending loads of time blogging about it, I thought I'd send you all to my favourite stsadm expert, Gary Lapointe. He's got a neat script which uses his own extensions in some cases. Especially the createwebapp one which allows you to specify the folder where the iis site will live. This is not possible with the built in extendvs version

Monday, January 11, 2010

Reducing the amount of Views on your Lists

In some cases you will want to create many versions of the same data, simply filtered by one or two values. You might just go ahead and create a dozen views to do this. But often this will result in bad usability as the View dropdown becomes unmanageable, plus you will need to maintain dozens of versions of the same view, should new columns be added or existing ones removed.
There is a simpler way. Create a page that has links to your view with the filter value in the querystring.
I.e. /Lists/MyList/CustomView.aspx?FilterField1=Department&FilterValue1=Finance

You can use up to three Filters this way.

Friday, January 8, 2010

Getting the current User in Infopath

For one of my clients I recently completed a leave form component. Sadly we could not use Infopath as neither the client was consistently installed across the organisation nor did they have an enterprise license. In my research around this topic I did come across a great 7 part article series showing step by step how to create a Leave Form using Infopath. The articles describe all steps in quite some detail and will get anybody going in no time. Once special gem in his series explains how to set the value of a text field to the full name of the currently logged in user using SharePoint Webservices.

a-humble-tribute-to-the-leave-form-part-5


the other articles in the series can be found here (note that they are all over the place)

a-tribute-to-the-humble-leave-form
a-tribute-to-the-humble-leave-form-part-2
a-tribute-to-the-humble-leave-form-part-3
a-tribute-to-the-humble-leave-form-part-4
a-humble-tribute-to-the-leave-form-part-5
a-tribute-to-the-humble-leave-form-part-6
a-humble-tribute-to-the-leave-form-part-7

Sunday, January 3, 2010

Showing Attachments in List Views

Came across this one for one of my custmers. Wants an ability to upload documents to a list item and then show the uploaded docuuments on the list view.
The solution here is to use Attachments and try to get them to show on the view. By default the Attachments field will only give back a true/false value of 0/1, which is only useful for highlighting the fact that there are attachments.
You can build SharePoint Controls into your views and the one you need to show all the attachments as links is the AttachmentField
<SharePoint:AttachmentsField
ControlMode="Display"
ItemId
="{@ID}"
FieldName="Attachments"
runat
="server"/>

The best place to put this control is in your dataviews. Either create one in SharePoint Designer from scratch or convert an existing view into a DataView through righ clicking it in SPD 2007 and choosing "convert to XSLT DataView". Once converted you can add the control to the page.
But beware. When creating it from scratch you will be missing the Namespace directive (xslns) which ensures that the xsl parser does not get confused with your ASP.NET code. Best bet here is to convert a view and have a look at all the xslns entries it puts in there. It will enlighten you.