Monthly Archives: January 2015

Quick Powershell script for connecting to SharePoint Online/ Office 365

At work, we’ve started working with Sharepoint online/ O365, and it’s a bit tedious to type in the whole connection command each time.

I wanted a simple script that would store the name of our tenant, my username, and would then securely prompt me for my password:

 

Start off 2015 by fixing a messed up edit page in SP2007…

It’s the start of 2015…

Who needs the cloud, SP2013 or even SP2010! It’s time to get sucked into a support issue on a legacy SP2007 site ūüôĀ

One of our legacy SP2007 sites had a custom list with an edit page that got corrupted.

Seems a user might have edited the edit page, and removed the web part that makes the edit page an edit page.

The solution wasn’t exactly quick or easy – I hadn’t worked with SP2007 in a long while and neither did our support engineer at Microsoft.

We ended up solving the issue ourselves. ¬†We have 3rd tier support with Microsoft, which has been great on the 2010 and 2013 side, but in this case the product in question is 2007 and I can’t say I blame Microsoft if all the people who were good at 2007 have moved on to other things by now.

Here’s a rough outline of what we did:

1) The EditForm.aspx page was broken

2) A known good DB backup of the site was recovered in a test environment  Рthis had a good copy of the form.

3) The good working list in the test environment was saved as a template with and without data in the test environment. The STP file was then copied to production

5) In production, in the same sitecollection/subweb, a new empty user list was created, using the template file that was imported from the test environment. One test record was created (ID=1) so that we could validate that the restored, empty,  list worked.

6) SharePoint designer had to be enabled on production Рit was found to be disabled via the onet.xml file for the STS template http://support.microsoft.com/kb/940958

7) Using some of the ideas from this article: http://hightechdave.com/recover-newform-aspx-from-the-dead-in-sharepoint-2007/

8) Editing the HTML of the broken EditForm.aspx in SharePoint Designer 2007, ¬†We copied the webpart section from the restored ‘good’ list over to the ‘bad’ list. Note: this MUST¬†be done in SharePoint Designer – editing the files from explorer will not work because part of this file is stored in the content database.

9) Saved the broken EditForm.aspx list and looked at it – it worked but referenced data from the new ‘good’ list (I had to construct the edit URL by hand, based on the edit url of the restored list, since the edit links on our allitems page were also broken…)

10) Edited the broken EditForm.aspx¬†and also opened the newform.aspx page from the same list (the original list with the problem) in SharePoint Designer’s ‘code/html’ view.

11) Copied the guid from the NewForm.aspx to the EditForm.aspx

12) Saved it and looked at it.

13) Edited the broken EditForm.aspx in SPD and changed the title in the webpart to the name of the list –

14) Saved it and it was fixed.

Note some things that did not work:

The article mentioned using a new GUID – that failed for me.

Also, when I pasted the webpart code in AND changed the list guid AT THE SAME TIME – it did not work. It seemed I needed to save it after pasting in the list, then go back and edit it.

And last but not least, I remember having to change the title on the webpart (via SPD’s html editor) before the webpart displayed correctly. And I think there might be a chance that doing it at the same time as another change didn’t work – for all I know it would have/should have and I just made a mistake when I tried to do it all at once, but it definitely worked when done as described above.

Ok time to get back to 2015 and start working on some SharePoint Online initiatives!

– Jack