Posts Tagged ‘Development’
Saturday, June 16th, 2007



This demo shows how to enable the InfoPath Form Viewer WebPart and configure it to show your InfoPath forms.

This is the second part of my presentation at the SharePoint User Group UK meeting in Telford.

The presentation covers

  • Adding InfoPath form view as a safe control
  • Enabling the web part in the site collection gallery
  • Adding the web part
  • Useful tip when it errors with a ‘Form Closed’ display
  • Setting the web part properties, and an easy way to find the information

The safe control information referred to in the presentation.

<!– Info Path Demo –>
<SafeControl Assembly=”Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” Namespace=”Microsoft.Office.InfoPath.Server.Controls” TypeName=”XmlFormView” Safe=”True”/>

Monday, May 28th, 2007



Many of you WSS V2 developers will have come across the “1#;Some text” value that lookup fields return. Some of you will have added code to you own utility classes to parse them to give the ID and Field values. In WSS V3 it gets much easier out of the box with the introduction of the SPFieldLookupValue object which will provide the LookupId and LookupValue fields for you.

SPListItem task = SPContext.Current.ListItem;
SPFieldLookupValue lookup = new SPFieldLookupValue((string)task["FIELD NAME"]);
int id = lookup.LookupId;
string value = lookup.LookupValue;

This class SPFieldUserValue is also provided making it easy to get to the User information from User fields liked Created or Modified.

Saturday, May 26th, 2007



It is always good to read little tips and tricks that help make things easier. Today I read two

Configuring IntelliSense with CAML Files When Developing for Windows SharePoint Services 3.0 – by Ted Pattison on MSDN, IntelliSense is so cool!

When developing for Windows SharePoint Services 3.0, you are often required
to create and modify XML files that contain Collaborative Application Markup
Language (CAML). It is recommended that you configure Microsoft Visual Studio on
your development workstation to reference a XML schema file named WSS.XSD so
that IntelliSense works properly when working with CAML-based files.

and Spencer Harbar posted about the new SnagIt addin for Visual Studio Team Edition

Use this new SnagIt output to quickly create images to describe and show
tasks, bugs or design ideas. It’s a quick way to add screenshots to bug reports
with the click of a button. And, it eliminates the hassle of attaching an
image.
http://www.techsmith.com/community/blogcomments.asp?thread=356

Saturday, April 14th, 2007



Spender Harber posted a recent article “Test Driven” SharePoint Development

…a first stab at providing some guidance for those looking to implement SDL approaches to SharePoint, and a call to action for the developer community to adopt “Test Driven” SharePoint development.

I’m in, anyone else?

Tuesday, April 10th, 2007



I am really excited to be working with some recent but very deserving Microsoft MVPs in the form of Ishai Sagi and Liam Cleary on the SharePoint Nested Tasks project.

Ishai has confirmed that Lawrence Liu has asked that the solution is merged with the SharePoint Community Kit, which will help to spread the good work being planned.

This will also be the first project I have worked on with true round the clock coding oppotunities with Ishai in Australia, Liam and I in the UK and others around the globe (sorry project just starting so haven’t had chance to talk to the other team members yet). Hope to meet up with Liam in person as he is presenting at the SUGUK meeting tomorrow night in Manchester.

Sunday, December 10th, 2006



..continued from part 3

Section 9 Playtime – Page 139

The last task is to add a link to each item and remove it from the cart. It is suggested that you do this in a non-Ajax way first and then add the Ajax and the example on http://wiki.pragprog.com/cgi-bin/wiki.cgi/PT-D-4 covers this in detail however I found the following problems.

Not working in JavaScript disabled browser

<td>

<%= link_to_remote “remove”, :url => { :action => :remove_from_cart , :id => cart_item.product} %>

</td>

This line renders the link as an onclick event which will not work if javascript is disabled. This may be a bug in my version of Ruby on Rails where the href=”#” should render the link if javascript is disabled.

<a href=”#” onclick=”new Ajax.Request(’/store/remove_from_cart/2′, {asynchronous:true, evalScripts:true}); return false;”>remove</a>

To resolve this issue I replaced this with

<% form_remote_tag :url => {:action => :remove_from_cart, :id => cart_item.product } do %>

    <%= submit_tag “remove” %>

<% end %>

This produces a form similar to the ones used for the Index.rhtml

If using JavaScript the redirect_to_index will not work, this is because the form_remote_tag (or link_remote_tag) enable XHR request which will not force a redirect of the main browser. This should be written as form_tag (or link_tag) to work without Ajax and updated to use remote once the remove_from_cart.rjs has been created. Generally you will tend to write this in the finished format now that you know how the remote calls work.

 

Friday, December 8th, 2006




continued in part 4…

.. continued from part 2

Iteration D3: Highlight Changes

This error had me stumped for a while, although it did force me to read through and really understand how the code was working. Something I have found a little difficult in Ruby is the debugging. Coming from a .Net background we have been spoilt with the debugging capabilities of Visual Studio, sometimes to the determent of knowing what is actually going on.

The error occurs when added a new product to the Cart. You get two dialog boxes the first gives “RJS Error: [Object Error]” followed by “Element.update(”cart”, …” this error showed the correctly rendered HTML that was inserted into the cart after clicking ok.

The “Highlight” effect was also missing from the cart item. Reason the <tr> tag for the cart item did not have the id <tr id=”current_item”> However the logic here look sound as the highlight did work for adding additional items of existing products. The problem must therefore be in the Cart.rb file which handles the add_product method.

The line @items << CartItem.new(product) should read @items << current_item = CartItem.new(product)

This assigns the newly created cart item to the current_item variable which is in turn added to the cart items.

Friday, December 1st, 2006



First Impression

Wow! That was easy!

After doing the normal Google -> Review -> Google some more process I was left with a long list of things to look at and also some other examples of people who have been down the same path. All of the development was completed on Windows XP SP2 (except the deployment to Linux which was running under VMWare).

  1. Install Instant Rails – This will get you up and running in no time, you don’t need to know anything about Rails or Ruby at this pointOne thing that you will notice if moving from the .net world is that you don’t need to compile it
  2. Read the Instant and follow the short tutorials, this is in the help\index.html directory where you installed Instant Rails
    1. Tutorial 1 – OnLamp.com
    2. Tutorial 1 – OnLamp.com
  3. Consider an Editor – I used RadRails but I’m still looking for something more…
  4. Watch the Screencasts to get a feel for what you should could do and how quickly (once you know Ruby)At this point you may want to purchase a Mac so that you can use the cool TextMate. I have already requested a Mac Book Pro as my next Laptop J
  5. Copy the code, but hand craft it to complete the Putting Flickr on Rails screencast
    This will help you find your way around the environment, debug the application (you will get an Invalid Key error, tip ‘look at the Flickr gem code initialization’)
  6. Purchase the book Agile Web Development with Rails, the second edition is out and fully up to date with version 1.2 of Instant Rails. The book details how to get the vendor version if it is not released yet. This is a really easy book to read, very well written and really does make a difference.
  7. If you enjoy reading and want something a little off the wall you could try Why’s (Poignant) Guide to Ruby, I have found this funny, but difficult to get into – but the Foxes did get the Chunky Bacon into the samples (you need to read it for that one J)
  8. Update Use source control – Subversion will do the trick
  9.  

Subscribe to some feeds Planet Ruby On Rails, Loud Thinking – David Heinemeier Hansson

Going forward I’m looking at improving my html development, I need to stop using tables!, I need to improve my JavaScript (http://script.aculo.us/ ) and I am looking at Unbuntu, MySQL, SQLLite, Lighttpd, Mongrel to name but a few.

Exciting times!

 

 

 

 

Thursday, November 23rd, 2006



Having developed software on the Microsoft platform since VB3 and before I have always like the way that as a developer things just worked, you click install and it does it all. I did flirt with Java before .Net came along; Java had a buzz and was moving on from the then VB6 solutions (and Visual Interdev was just horrible for ASP development).

My traversal into the world of Java was to be short lived, at the time Google had not been conceived and information, blogs and knowledge sharing online just did not happen. I failed miserably at the first hurdle trying to setup my development environment! The need for various versions of each separate component available from different sources was a mile away from the Microsoft bubble that I was used to. I ended my look at Java without even completing the ‘Hello World’ application L.

Now many years later and happily coding in the world of .Net (now in its version 3 flavour) I am starting to look fondly at the open source market again. This had crept up on me as I had started to bring Nant, Ndoc, CruiseControl and other open source products into my previously Microsoft only toolbox. This time my expedition is part of a project we are doing internally that we have the adopted the mantra ‘Embrace Open Source’. We have others this is the only one relevant to this blog posting!. Having done some research we are starting to settle on evaluation of Ruby, more specifically Ruby on Rails. It appears many other developers have gone down or are going down the Microsoft by day, Ruby on Rails by night – and the weekend and sometimes at work – just don’t tell the client!. One example is Netter-on-Rails.

Tomorrow will hopefully be a seminal moment in my software evolution, my thoughts views and progress will appear here to all those 1 or 2 readers that have found this blog J.

 

Tuesday, November 22nd, 2005



A common problem, how do I add Hyperlinks to a list programmatically in SharePoint

The documentation (SharePoint SDK) does give a clue to the answer but no real examples. You will see that the Hyperlink field is a System.String, System.String. It also states below ‘The URL field uniquely consists of two strings separated by a comma and space. One string contains the URL path and the other contains the description used as hyperlinked text.’

Sample code:

   SPSite site = new SPSite(url);
   SPWeb web = site.OpenWeb();
   SPList list = web.Lists[listName];
   SPListItem item = list.Items.Add();
   item["Hyperlink"] = stringUrl + “, ” + stringDescription;
   item.Update();

The important bit is the seperating “, ” (note comma and a space).

Also the hyperlink cannot be relative and must have http:// and is validated to ensure it is a valid hyperlink.

Update: Provided by ThatGuyGreg

Things get easier in MOSS 2007/WSS V3

SPFieldUrlValue linkUrl = new SPFieldUrlValue();
linkUrl.Description = “Whatever”;
linkUrl.Url = anURL.ToString();
anItem["URL"] = linkUrl;
anItem.Update();