InfoPath 2010 and TFS Source Control

So in their wisdom it seems you can no longer do InfoPath development in Visual Studio with the new versions. Here's a little snippit from the infopath blog showing how to do Source Control with InfoPath 2010, code behind and TFS. Should be fun, just hope those files don't go out of sync...

 http://blogs.msdn.com/b/infopath/archive/2010/06/10/using-tfs-for-source-control-in-infopath-2010.aspx

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

SharePoint on SSD, or should that be steroids?

I came across a blog post  today by Christophe Fiessinger, he outlines a performance comparison between running SharePoint VMs on a Seagate Momentus 7200.3 and a Samsung SSD SATA 3.0Gb/s (Solid State Drive). The warm up time for the web applications were between 2 and 10 times quicker, now that's a lot of wasted time cut out from a developer's day or waiting in a demo situation.

Then, I also spotted the following from Doug McCutcheon with a video clip on youtube and links to discounted Dell laptops for demoing. Looks good, hopefully they'll make the deals available in the UK too.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

JQuery - Getting data from a SharePoint List

As part of the series of articles, we will look at retrieving some data from SharePoint.

For this example, we will look at getting data from a list, in this case a simple Announcements list, and put the data from that list into a web part on a page. (I appreciate that this could be done several other ways, but it will serve the purpose on this example)

Before doing any custom script, we will need to make a reference to the core JQuery script files. If you have access to the server, you can put the files into a convenient folder in the LAYOUTS directory, or you could upload into a document library.


To start, we will put a Content Editor Web Part onto a page. Once added, we will now add the following..

[code:html]

<script src=”/_layouts/examplescripts/jquery-1.3.2.js”></script>
<script language = “javascript”>
</script>
<a href="#" onclick="GetAnnouncementData()">Test</a>
<ul id="AnnouncementData"></ul>

[/code]



In the above, we have a reference to the jQuery library, a script container, a link to enable us to manually test and an empty ul. (Note – don’t try clicking the link yet – we haven’t defined any functions)


The jQuery library can be downloaded from here.


Our Announcements list will contain the default Title Body and Expires columns. We will use the lists.asmx web service to retrieve data from our list, that we can then display.


To start, we will add a new function into the Content Editor part, which we will call GetAnnouncementData. The first part of the function will define  the SOAP packet that gets passed to the lists.asmx service. (For full details of the options available, the details are available on MSDN
Our packet is as follows. We have defined the list name and the fields to retrieve

[code:xml]

<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
   <soapenv:Body>
    <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
     <listName>Announcements</listName>
     <viewFields>
      <ViewFields>
        <FieldRef Name='Title' />
        <FieldRef Name='Body' /> 
        <FieldRef Name='Expires' />
      </ViewFields>
     </viewFields>
    </GetListItems>
   </soapenv:Body>
  </soapenv:Envelope>

[/code]

Note that the bold item above is where we are defining which method form lists.asmx to use

So now our script will look as per below.

Next, we will connect to the web service. JQuery has built in functions to provide this. We will add the following to our function...

[code:html]

jQuery.ajax({
  url: "http://mossgj/devsite/jquery/_vti_bin/lists.asmx",
  type: "POST",
  dataType: "xml",
  data: soapPacket,
  complete: processResult,
  contentType: "text/xml; charset=\"utf-8\""
 });

[/code]

You can see from the above that we are referencing the lists.asmx web service. (you will need to change the URL to your server).

The  data: soapPacket is instructing the function to pass our packet to the web service.
The complete: processResult tells the function to call another javascript function and process the data returned.

Our script will now look as below


(Note that if you try to run the script at this point, it will fail as we haven’t yet defined the processResult function)

Now we can add the function to process the result. Above our closing script tag, we will add a new function...

[code:html]

function processResult(xData, status) {
  alert(xData.responseText);
}

[/code]

This is going to read the data returned and show a message box with the complete package. If you save and close, then click you test link, you should get a message box with the complete returned data, similar to the following

Now we will read individual rows. Into the processResult function, add the following...

[code:html]

jQuery(xData.responseXML).find("z\\:row").each(function() {
alert($(this).attr("ows_Title"));
});

[/code]

This will read each row returned and call a local function. The function will read the ows_Title attribute and get the data. After clicking our test link, we should now see a second message box with the announcement title.

Next, we are going to remove the alerts and ask jQuery to add heading to our empty ul for each announcement. Replace the alert($(this).attr("ows_Title")); for the following...

[code:html]

$("<li>" + $(this).attr("ows_Title") + "</li>").appendTo("#AnnouncementData");

[/code]

This line is asking jQuery to append an <li> item for each row. The function is building the html and appending it to the item with an id of AnnouncementData.

The part of the function $(this) is referencing the current row returned. The .att(“ows_Title”) is reading the value of the Title field (note that the lists.asmx web service prefixes the field with ows_). Finally, the .appendTo is asking jQuery to append the html to an element with an id of AnnouncementData (see jquery selectors for detailed instructions on how to select items by title, class or id)

If you now click your test link, you should see the list item appear.

Finally, we are going to ask jQuery to do all of the above automatically, as soon as the page is ready. Just above our closing script tag we will add the following...

[code:html]

$(document).ready( function(){
GetAnnouncementData();
});

[/code]

This jQuery function tell the page to run our GetAnnouncementData function as soon as the page is ready. After saving our content editor web part, we should now see a list of all of our announcement titles.

Obviously this is a relatively simple example. The next post will expand upon this and show how we can return a subset of data and make the things more dynamic.

Completed Content Editor Web Part source

[code:html]

<script src="/_layouts/novotronix/jquery/jquery-1.3.2.js"></script>
<script language = "javascript">
function GetAnnouncementData()
{
var soapPacket = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
   <soapenv:Body> \
    <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
     <listName>Announcements</listName> \
     <viewFields> \
      <ViewFields> \
 <FieldRef Name='Title' /> \
 <FieldRef Name='Body' /> \
 <FieldRef Name='Expires' /> \
      </ViewFields> \
     </viewFields> \
    </GetListItems> \
   </soapenv:Body> \
  </soapenv:Envelope>";
jQuery.ajax({
  url: "http://mossgj/devsite/jquery/_vti_bin/lists.asmx",
  type: "POST",
  dataType: "xml",
  data: soapPacket,
  complete: processResult,
  contentType: "text/xml; charset=\"utf-8\""
 });
}

function processResult(xData, status) {
 jQuery(xData.responseXML).find("z\\:row").each(function() {
$("<li>" + $(this).attr("ows_Title") + "</li>").appendTo("#AnnouncementData");
});
}

$(document).ready( function(){
GetAnnouncementData();
});

</script>
<a href="#" onclick="GetAnnouncementData()">Test</a>
<ul id="AnnouncementData"></ul>

[/code]

Currently rated 4.0 by 3 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

JQuery within SharePoint

We have started to do a lot of work with JQuery to simplify the development process. For those that have not come across JQuery before, it is  " a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript ". The ability to select multiple items on a page with a single line of script is great. For deployment, the library is simply a single  .js file that needs to be put onto the server and referenced on a page.

Aside from the core JQuery library, there are hundreds of plugins (additional script files) such as JQuery UI.

As a starting point, look at Jan Tielens article.

One of the exciting things for me about using this technology is the ability to use on hosted, or shared SharePoint servers (where as a developer you cannot add .dll files, features or solutions). To implement jQuery on a page in this scenario, we could upoad the library (jquery-1.3.2.js) into a document library, add a Content Editor Webpart onto a page then edit the webpart to reference the file and start using it. Imagine, with a Content Editor Web Part and a few script libraries, we could implement a tabbed style webpart, loading data from our lists :)

I'm planning on putting a short series of JQuery articles and links here over the coming weeks

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Sharepoint 2010 Sneak Peak

The release of Sharepoint 2010 is on the horizon and the community are starting to get excited about the potetnial new functionality coming along.

Have a look here for some sneak peak information and videos of what is coming through

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Content Query - across sites

A previous post indicated about using search to aggregate data. Whilst an acceptable approach (though with some limitations?) another is to go down the route of providing a custom Data Source


Todd Baginski & Andrew Connell have presented and posted information on how to do this - the Content Monster Web Part. don't be put off by the name (those who have seen Todd present can appreciate the left field naming!)

The article has been posted on MSDN and the slide desk from TechEd also

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Remember that the XSLT select is case sensitive...

I was customising a people search result web part this week and couldn't figure out why the mobile phone field was not rendering in the results. I could see it was in the AD properties, was making it through user profile import and then helped it through to managed metadata in the search results, I even checked the raw XML for the search results which showed it there as well. So I was down to checking my XSLT, I had camel cased the name of the field in my select code, as is my habit with coding to make it easily readable, but the XSLT was looking to match the case returned by the search results which was all in lower case.

A quick crrection and refresh and they all appeared as they should. Another little puzzle solved...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Using [Today] or [Me] in SharePoint calculated columns

If you try this in the browser you will get a message alon the line of Calculated columns cannot contain volatile functions like Today and Me'. At this point you go D'Oh!

But.... you can !!!

Before creating your calculated column you will need to create a column called Today or Me (depending on the calculation you want to create). Once this has been created, SharePoint lets you use the [Today] or [Me] functions in the calculation.

This example shows how to create an age calculated column.

[code:c#]

1. In your SharePoint list, create a column, title = DOB, type = Date, format = date only.

2. Create a column, title = Today, type = text.

3. Create a column, title = Age, type = calculated, calculation = DATEDIF([DOB],[Today],"Y")

4. Delete the column titled 'Today'

Now add a new item to the list. Set the DOB date (to somewhere in the past!) and save. The Age should have now been correctly calculated in Years.

[/code]

Note that once you have deleted the Today or Me column, if you try to edit the calculation in the future, SharePoint will complain again. However, you can simply create another column (Today or Me), edit your calculation, then Delete teh today / Me column again.

Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

owssvr.dll - Beware of multiple selection lookups

owssvr.dll can be used in InfoPath projects to provide filtered or cascading drop down lists. Use an XML datasource - the syntax is http://yourserver/yourweb/_vti_bin/owssvr.dll?Cmd=Display&List={guid}&XMLDATA=TRUE.

However, beware if your list contains a lookupfield that allows multiple selections. If you have this, then the above syntax will return an invalid XML, or a blank data set.

List contains lookup field(s) with single selection - syntax works.
List contains lookup field(s) with multiple selection - syntax fails.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

SharePoint Best Practices Conference UK - Day 2

The conference continues to inform and inspire...  Today I started off with Eric Shupps’ session on Custom Site Definitions, very entertaining but also very informative, he took us through packaging up our site definitions, the pros and cons of SPD and even some places where it is good – rapid prototyping of a master page before building it for real into a solution, so often internally we tend to only use it for DVWPs.

Next up was Maurice Prather with Secure Coding for The Administrator, it’s amazing the ongoing banter between dev’s and admins . We took a look at Secure Code, what does it mean?

·         The practice of writing code that can withstand malicious attacks

·         Secure code is Robust Code

Maurice expanded on this and then took us through the extra protection that SharePoint puts in place for us, stopping code from doing what it shouldn’t, but also the cases where Full trust can creep in and prevent these safeguards from working. Watch out for changes to PageParserPaths settings in your web.config files.

Neil Hodgkinson on Patching SharePoint – I thought I would know most of the content of this session, how wrong could I be? Neil gave us a really thorough tour of Hotfixes, Cumulative Updates and Service Packs. I hadn’t realised that the Revision number in a build number, e.g. the 1000 part of 12.0.6219.1000, had any meaning beyond just an arbitrary number, but it does:

1000 – Service Pack

30xx – Private build – you really should not be running these in production

5000 – Hotfix or CU

500x – COD Build

He also clarified the differences between Microsoft’s minimum supported build, recommended build and the latest and greatest build and how these affect the type of response you will get from PSS.

Building High Performance Solutions on Moss 2007 or should that be how do I cut down the bandwidth that Moss eats when we use it for Internet facing websites? Andrew Connell gave us some good solutions touching on your site topology for location of secured items, “customised” pages came up once again, reducing the page payload, how to speed up the CQWP and instant improvements with the art of IIS HTTP compression. A  slip on who should be in the kitchen, whilst explaining that you should just crank up the compression level to start with, will his wife hear about it though, did it make it to twitter?

The final session I sat in on was the IW Open mike session, and heard my favourite quote for the day, in answer to a question about the size of content DBs Rob Foster said “if you let content DBs grow bigger than 100GB then you run out of hours in the day to do the daily backups” to which the reply came “That’ll be a limitation of the solar system then!”.

I can’t believe it’s the final day tomorrow, it’s gone very quick and no sign of flagging. Just need to choose where to eat tonight...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

 

Dilbert of the day