Friday, November 16, 2007

Anonymous InfoPath Forms

So, you're using MOSS and see that it supports Web enabled Infopath forms.. Sweet, a feature that should have been there from the beginning, since InfoPath is useless without it.

If you've thought about using InfoPath, then you've also realized that every user has to have Infopath, and guess what? It doesnt' come with MS Office unless you pay for the super version.

So, how about anonymous infopath forms? You may have seen a few posts around the web about how to do it, but in reality, you can't. And here's the reason:

Infopath uses a forms library to store forms, and they work the same as a document library. Document libraries do not allow you to give anonymous users permission to add documents. You just can't do it.

You can however, create a web service that will accept the form, impersonate, and save the form to the library.


Solution:
There are two parts to this. First, trick the document library to allow you to have a "New" option for anonymous users. To do this, go to the anonymous access page, and look at the URL. See the "DOCLIB" at the end? Change that to LIST and reload the page. Now you'll have the option to check the box for new/edit/delete. Check the new box.

Second, Change you're form to submit to a web service. You'll have to create this service, and it should probably take a File name, and the file content. Maybe later I'll publish the code for this web service.

Custom New/Edit Pages

This is one that I ran into when I first started using sharepoint, but has recently come back.

A co-worker was trying to edit the new/Edit forms, and didn't want certain fields to show up on the form since they were used by some custom workflows/views.

So, how do you edit the forms? FrontPage of course!

Just edit the form, and delete the fields that you do not want to show up? NOPE! If you do this, the fields will end up blank, erasing any data in those fields when the user clicks save.

Instead, you have to edit the html. Find the tag for the row containing the field you do not want to show up, and add:
style="display: none;"


That way, you'll use CSS to hide the rows. They will still be there, but the user won't see them, and hopefully won't edit them. A perfect solution? Not really, but it'll work.

Calculated Date Fields

I've run into an issue with calculated Date fields.
I have a field called "Start Date", and a calculated Field called "Event Date".
The value for "Event Date" is simple: =[Start Date]
Don't ask me why i have two fields that do the same thing, i can't remember anymore.

The problem is this: When i view the fields on a normal sharepoint view, the two fields are the same. When get the fields in a Data View, or in an RSS feed, the "Event Date" field is one day earlier than the "start date"!!!!!

I have no idea what is going on. I could set event date to be equal to Start Date+1, which is OK for Data views and RSS feeds, but will be wrong in the normal SharePoint views. I'm tempted to delete and re-create the field, but I have a sick feeling it'll just break something else.

SharePoint Features and Failures

I've been working with SharePoint for the past 3 years or so, and I've found blogs to be one of the best resources out there. It's time for me to give back. I've been meaning to start one of these up for a while, and today is the day. I've run into one of those SharePoint gotchas, and I need a break from it.

This blog isn't going to be about showing off sharepoint's features. There are plenty of those, and for most people (well, me at least) they aren't that useful. I can figure out how to use the goodies that it gives us. I'm more interested in finding solutions to all the places that SharePoint will fail you.

As a SharePoint consultant, customers ask for solutions, and I think of ways to do things. Often, there are ways to make things work, but because I haven't had the chance to use a feature, I just assume it will work. This blog will be about all the places that features don't work as you might have expected them to.

This blog will also be about random bugs I've found, and hopefully, solutions to those problems. I'd like to be able to go back and post all the things I've found over the past few years, but my brain has blocked some of them out. I'll post new things I find, and anything else I can remember. Stay tuned!