May 20, 2012

Recover NewForm.aspx from the dead in Sharepoint 2007

Have you nuked your NewForm.aspx  page in Sharepoint WSS/MOSS 2007?   This can happen if you remove the default list web part from the page and save the file.  The problem is apparently that any time you create a custom list form web part, it grabs the latest fields from NewForm.aspx not from the list settings.  Go figure.

So without warning you can totally destroy your NewForm page and also cause problems for every custom form you might spawn off of it.  To save yourself from this disaster (which should not be possible in the first place IMO) follow the instructions below (these instructions were originally posted by David Szabo here):

  1. Open NewForm.aspx and EditForm.aspx in Sharepoint Designer
  2. Copy the code for the ListFormWebPart control from the EditForm.aspx. The code in question reaches from
    <WebPartPages:ListFormWebPart runat=”server” __MarkupType=”xmlmarkup” WebPart=”true” __WebPartId=”{YOUR_GUID}” >down to 

    </WebPartPages:ListFormWebPart>

  3. Paste it into the broken NewForm.aspx, I pasted it right below the Line:<WebPartPages:WebPartZone runat=”server” FrameType=”None” ID=”Main” Title=”loc:Main”><ZoneTemplate>
  4. Within the pasted lines of code look up the lines starting with<ControlModeand

    <FormType

    In the “Control mode” tag replace the “Edit” with “New”, in the “FormType”-Section replace the digit “6″ with “8″.

  5. Before saving, you have to generate a new GUID for the pasted control in your NewForm.aspx otherwise your EditForm.aspx will be broken after saving!!!There are online GUID generators on the internet so you don’t need Visual Studio, e. g.:http://www.somacon.com/p113.php

    Generate a new GUID and asign it to the “__WebPartId” attribute in the very first line of code of your control:

    <WebPartPages:ListFormWebPart runat=”server” __MarkupType=”xmlmarkup” WebPart=”true” __WebPartId=”{YOUR_NEW_GUID_HERE}” >

  6. Look up the <ID></ID>-Tag further below (it was about 27 lines below in my case) and change a random number in the ID, e. g.Before: <ID>g_092cc5f1_f97c_408b_bf66_c7b235af38f9</ID>After:

    <ID>g_092cc5f1_f97c_408b_bf66_c7b235af38f5</ID>

  7. Save your work…and your done!

Thank you to David for posting the solution.  This definitely helped with some issues we had this week.  I really should have known better but I was operating under the assumption that I did not at any point need to use the standard NewForm.aspx page any longer.  What I didn’t realize was that once you overwrite the file it becomes the new site definition.  This means you cannot simply right-click and “reset to site definition” as you might expect.  You might be familiar with this if you have customized your default.aspx page and would like to restore it.

I also didn’t realize that when you make changes to your list they will not show when you re-add the Custom List Form control (see below).

To ensure this doesn’t happen when you create custom forms in Sharepoint 2007  do the following:

  1. Create a copy of NewForm.aspx (or right-click and select New From Existing Page)
  2. Remove or hide the default list web part
  3. From the menu select Insert->Sharepoint Controls->Custom List Form
  4. Select the appropriate list (the defaults should be for a new form)
  5. Hit Okay

Now you just need to make sure that any links pointing to NewForm go to your new page.  But in this way you don’t have to worry about screwing up your NewForm page and any subsequent custom forms you may derive from it.

Alternatively you can indeed customize NewForm and make it work, just make sure you hide the default part rather than deleting it.

Akismet, why it is awesome, and why you don’t need it

WordPress is a fantastic platform.  I use it almost exclusively as my CMS and blog of choice for myself and for my clients.    As it has matured the potential is really limitless as to what you can do with it.  But one of the things you might find once you delve into running your own WordPress site is that you quickly become a target for SPAM.

But have no fear, Akismet is here!   What is Akismet?  Well from the Akismet page you would find it described as such:

Automattic Kismet (Akismet for short) is a collaborative effort to make comment and trackback spam a non-issue and restore innocence to blogging, so you never have to worry about spam again.

Why is this important?  Well you don’t want your hard work to be tainted by spammers and bots.  It makes your site look trashy and if you keep it clean religiously then it just means extra work.  You should be writing not policing comments right?  And you don’t want to give spammers free publicity do you?

Well, the folks at Automattic (the authors of WordPress itself) have made this great little plugin available for free for non-commercial use.  So it goes without saying, you should use it because not only is it effective, it is 100% free in many cases.

But what if you are building a site that is a commercial venture?   Well thankfully they have drawn the line such that you only need a commercial license if you pull in more than $500/month from your blog.  To be honest, this doesn’t really make things clear for those that are building websites, not blogs (I will have to follow up with Automattic on this in the future).

Now don’t get me wrong, the $5/month they ask for a commercial license is totally worth it if you are pulling in that much scratch from your blog.  You will easily save yourself $5/month in headaches by using the service as it is very effective.

So why don’t you need it?  Well, as I said earlier, you most certainly should take advantage of it… but, only if you need it.

If you are using WordPress strictly as a CMS then you may not even want comments or trackbacks.  By default WordPress leaves these features on, so you might quickly find your site deluged with trackback and comment spam even on posts you never linked from your site… yeah those bots are that crafty.  The simple solution (if you don’t need these features) is to disable them.

To make your site spam-proof w/o Akismet head on over to your WordPress admin.

  1. Go to Settings
  2. Ensure next to the Membership heading the checkbox for “Anyone can register” is unchecked.  This means only people you create accounts for can login to the site.
  3. Go to the Settings->Discussion page
  4. Under “Default article settings” you can probably just uncheck all of these, though the most important ones here are the “

Now, you might be wondering… why is this necessary when WordPress by default requires you to approve comments and trackbacks?  Good question, well the reason for me is that I don’t ever want to have to pour over a list of spam and read each entry to determine if it is valid or not.  Depending on the traffic your site has this may or may not be an issue.

For my own blog I do allow both comments and trackbacks… but for my clients who are using WordPress strictly as a CMS I follow the directions above to ensure they don’t have to deal with the extra maintenance.

But if you do in fact use comments/trackbacks on your site, Akismet is invaluable.   Give it a try, you won’t be disappointed.

How to install a beta version of iOS on an iPhone

If you are an iOS (iPhone/iPad) developer you might want to try the latest beta release on your device.  To do so you will need to do a complete restore.  But rather than install the latest available to the public you will want to use the latest beta.  Once you have downloaded and mounted the beta release DMG file head over to iTunes to do the restore.

First make sure you have a backup of your device.  Do it twice if you aren’t sure ;) Also may be prudent to “Transfer Purchases” as well just to be safe. When you are ready just do an ALT+Click on the Restore button in iTunes on the device screen to bring up an option to browse for the IPSW file with the iOS software.  After your device reboots you will want to restore from the backup you made earlier (you made a backup…. right?).

Consumer Reports on the iPhone

The Consumer Reports article slamming the new iPhone 4 is making major waves throughout the media.  The issue has been circulating quite a bit now in the blogosphere but seems to have really made it mainstream now.

I can easily reproduce the issue on my phone.  And it is clear that many people can as well.  I honestly cannot say whether or not I have more dropped calls versus my 3GS or original iPhone.  The bars are obviously changing when the phone is held in the ‘death grip’, but aside from that I cannot really complain.   My service with AT&T has always been poor and I have had many dropped calls in clear skies right smack in the middle of Atlanta long before I got the new iPhone 4.

In any case I think there surely is sufficient anecdotal and more official reports that there is definitely an issue.

So what is new about these latest test from Consumer Reports?   Do they really affect real-world usage? Consumer Reports is largely regarded as an unwavering advocate for the consumer right?

Initially CR wrote a blog post heaping praise upon the device then more recently did a full 180 and jumped on the Pretty Apple Hate Machine.   To me it just screams “look we are relevant!” rather than offering anything new about the issue.  However, it is clear that this really elevated this problem to a much broader audience than even established tech blogs.

Take a look at this post from an engineer with a perspective on the CR testing process.  This is not to suggest that there isn’t an issue or there is no validity to the results of the CR study.

Only time will tell if Apple can really solve this with a software update.  Personally I think Apple will do right in the end… why wouldn’t they?  They have gobs of money in the bank and have worked hard to establish themselves as the pinnacle of modern consumer technology.   Too bad Steve couldn’t just come out and say “we are working on it, please stand by” rather than his one-liner responses that only inflame the masses.

One thing is for sure though regardless of how all this turns out, CR’s report has really catapulted this into the eyes of many more people.  So one has to wonder what on earth is going on over in Cupertino and why they haven’t taken control over the situation.

Update: Check out this article from AnandTech.  Pretty solid analysis from a reputable source.  I love the ‘gold’ tape!  I wonder how long till tape/decal kits for the band will start cropping up?

Update 2: I have installed 4.0.1 and it has definitely resulted in less bars around the house.  Haven’t used it much to see if it changes dropped calls.

Understanding the Sharepoint CAML query

Sharepoint allows you to utilize web service calls to retrieve and manipulate data.  To do this though you will need to be able to write CAML to create your queries.  I found this site pretty useful when it came time to really dig into creating my own custom CAML-based Sharepoint queries.

Google Apps business email hosting with MediaTemple DV server

E-mail is a fundamental part of any business today.  Unfortunately, not all web hosting provides adequate email service.  From SPAM to webmail, there leaves a lot to be desired depending on your provider.

MediaTemple’s DV server is a powerful option for any developer or business.  But the webmail and SPAM prevention just aren’t up to my (or my clients’) expectations.  The default Horde webmail is clunky, renders HTML poorly, and lacks many features that you might expect out of business email.

There are many different options these days for webmail and email hosting.   But what about free?

So this weekend I set out to do a little experiment.  I wanted to try out Google’s business email hosting service.  This has the benefit of not only being free (for the standard version) and comes with the niceties you might already be used to with using Gmail for your personal account.

The premise is to move all aspects of your server’s mail services to Google which will include some changes to your domain’s MX record (and CNAME records).  Keep in mind this could result in a short interuption of service.   The limited amount of effort thus far has proven to be well worth it.

Since I use a MediaTemple DV server for most of my hosting, I sought out some guidance and found some great instructions here.  Be sure to follow it completely as if you do not disable the mail service in Plesk it will not work.

Now as of today I have shiny new mail service, all backed by Google’s infrastructure.  This is hosting-independent, has Google’s famously awesome webmail, and is still accessible on all my devices using the native mail clients via IMAP.

This really is a great option for anyone wanting business class email (and all of the other Google apps).

Update: I have been using this service now for a couple months.  It has worked without a single hitch.  I run all my email through IMAP which keeps all my devices in sync, and don’t get a drop of spam.  I have to say that I highly recommend this to anyone, especially if you aren’t satisfied with your host’s webmail solution.