Posts Tagged ‘Sharepoint’

Adding a news ticker to your SharePoint 2007 site without Flash

Monday, December 1st, 2008

I’ve written up some notes on using jQuery to improve the look & feel of your SharePoint site. This would be especially interesting to anybody trying to develop SharePoint sites using only SharePoint designer.

In the example I upload jQuery to the site (along with a BBC news ticker plug-in) and modify the page to reference jQuery and the plug in, then I modify a data-view to consume a SharePoint list into the jQuery plug-in. Essentially ending up with a nice news ticker web part without the need for Flash, custom web-parts or development.

jQuery can essentially give you Ajax/Flash like advantages without much work on your part. Simply upload the file and start plugging in.

Tags: , ,
Posted in Sharepoint | 2 Comments »


Developing SharePoint 2007 sites from the outside in…

Tuesday, November 11th, 2008

Three handy tips for developing your MOSS site from the outside in:

1. Redirecting using the Content Editor Web Part

The “Content Editor Web Part” described in the web-part gallery as being used “for formatted text, tables, and images” is actually a handy way to embed HTML into a site page. One very handy use is to redirect users to another page , useful when a site has moved.

2. Filtering Data View hyperlinks into a Document View web part

SharePoint Designer allows you to attach a ‘Data View‘ to a SharePoint page.  The standard Data View webpart is actually a rather powerful little feature which can retrieve data from various connectible sources, including other SharePoint lists. Handy if, say, you have a top level site with a list and want to feed/display the data to various sub-sites.

Data Views allow you to display list data in various ways; as text, links or even check boxes and images.

I was asked, as a fairly reasonable request, to create a set of maintainable “virtual folders” in a web part. The user wanted to be able to click on an item in a list and a “document list web part” on the same page would be ‘filtered’ to show the documents in that ‘folder‘. What is actually happening is nothing more than the filtering in the standard list view, but it allows the sub-site manager to choose what appears in the ‘virtual folder’ list, in this case a set of client/customer names.

After tearing my hair out, I eventually figured out that a Data View can be used to display the list items, which appear as links. The links point to the same page as the document list web part. When you choose to display Data View data as hyperlinks in SharePoint designer you will be able to edit the ‘hyperlink options’.

You can choose to view list data as hyperlinks

You can choose to view list data as hyperlinks

After you have set the URL (in this case the very same page) and the “Text to display” as something like {@Title} you can select the ‘Parameters’ button. This is the clever bit, you can simply force the filter parameters into the page url parameters by setting FilterValue1 as the value you want to filter by (for example {@Title} again), FilterField1 as the name of the column you want to filter, and the View to be the GUID of the webpart view in question. If you don’t know the GUID you can find it by filtering the view on the SharePoint page itself and looking in the URL, you should see the parameters exactly as we’re trying to send them. You’ll notice that the GUID is surrounded by curly braces {} when you enter these into the SharePoint designer DataView tool make sure you include them as control characters %7b and %7d otherwise it won’t work.

Editing the parameters of a hyperlink dataview

Editing the parameters of a hyperlink dataview

3. The amazing SharePoint designer “Error reading file” bug

Mmm. SharePoint Designer. Ever had the ‘Error reading file’ problem when trying to open an aspx page? I know I did, and despite Googling; never really found a satisfactory answer.

It seems that occasionally, for whatever reason, SharePoint designer may leave your aspx page with a horrendous amount of white-space which won’t appear in the code view. When loading the page back in, SharePoint designer will simply respond with the very informative error.

The solution is to export it locally as a file, edit it in your favourite robust text editor. Now you can’t simply remove the offending white space and import it back to the server, because it won’t reattach to the layout page, so create a new aspx page in the designer and, in the code view, copy and paste the text from the broken page into the new page. When you’re finished a bit of renaming should be all you need to switch this new page around with your broken page and hopefully it should load up in the designer tool again.

Tags: , , , ,
Posted in Sharepoint | 2 Comments »


Frustrations with Check in/Check out event handlers

Thursday, July 31st, 2008

I wanted to write up some notes about a recent frustration I’ve had with Sharepoint 2007 events. I was asked to develop a (fairly simple) method of replicating the check in/check out event between a master Sharepoint site and several replica sites (Where the Sharepoint data has been replicated using my company’s own software). I’ve implemented a fairly simple system involving an event handler installed on the replica machines and a web service on the master. The concept is straightforward enough, and ensures that users are unable to check out documents that are already checked out elsewhere and that checked in data is up to date (as well as handling version numbers and undo check-out requests!).

The check in/check out system is not the focus of this blog entry. The frustration I spoke of earlier involves the SPItemEventProperties ErrorMessage property which can be set when you override the synchronous/asynchronous event functions.

So I have a class like this:


public class CheckingEvent : SPItemEventReceiver
{…
public override void ItemCheckingOut(SPItemEventProperties properties)
{
// business logic ……
// if something bad happens{…

properties.Cancel = true;
properties.ErrorMessage = “Isn’t this a bit buggy for an enterprise system?”;

;}

..Please excuse lack of indenting, I am still fighting with WordPress to be able to display code in a presentable fashion..

Updating the ErrorMessage property like this would normally display the error message within the browser…nice. Except in this case, checking out, it doesn’t work due to a bug in SharePoint! Instead we are treated to a message box appearing proudly displaying the words “Attempted to read or write protected memory“. Smashing..not..

At the moment, even with all the current service packs installed I can’t get the error message to appear correctly.

Currently the ONLY workaround I have found is to implement:

properties.Status = SPEventReceiverStatus.CancelNoError;


..instead. Which will display the standard error message. “You may not have permission to check out the document or it is already checked out or locked for editing by another user.” which isn’t great, but it at least makes my solution usable until Microsoft fix the bug.

Tags: ,
Posted in Sharepoint | 1 Comment »


Removing SharePoint 2007

Monday, July 7th, 2008

I spent most of the day trying to un-install SharePoint completely from the only half decent development machine available to me.

The problem was that I installed MOSS over a working WSS site that had originally been installed over a working SharePoint 2003 portal site (This has been the only decent development machine available to me for a long time!!) This caused all sorts of horrible things to happen:

  • I couldn’t uninstall MOSS/SharePoint 2007 services from add remove programs (It pretty much ignored me).
  • In an attempt to resolve the above issue I reinstalled IIS, thinking that it would work if I cleared out all the sites and application pools. BIG MISTAKE.
  • In an attempt to fix the above, I ran the MOSS configuration wizard again which fell flat on its face.
  • Attempts to remove the server farm configuration from the command line tools failed. Probably due to the above three points.
  • Attempting to run the installer again failed, probably due to most of the above points.

Anyway, to cut a very long and boring story short. I found this (oh look somebody else using wordpressy-press-press thingy) on the web: Uninstalling MOSS 2007 manually

Basically, shutting down every SharePoint 2007 service left over. Removing a handful of registry keys, and deleting most of the left over directories, should be enough to allow you to run the installer again and start afresh. Blindingly obvious really when I think about it.

Tags:
Posted in Sharepoint | No Comments »