.NET

Custom code with SharePoint Online and Windows Azure

When I first heard about SharePoint Online at the PDC 2008 I was a bit disappointed that you could not use custom code but had to rely on the built-in functionality and the things you could do with SharePoint Designer (which is quite powerful anyway, especially with jQuery). To read more about SharePoint online, head over to Tobias Zimmergrens blog. But with some clever techniques you can take advantage of the Windows Azure Hosted Services and create your custom code. I will show you how to create some custom code, which normally is done by SharePoint event receivers or timer jobs, using a Worker Role in Windows Azure.

.NET

Web Parts Connections - Introduction

This is the first post in a series on Web Parts Connections. This spring I had a series on Web Part Properties that I think was very successful, they got some good comments and feedback and they get a lot of hits from search engines. Please help me out and evolve this new series of posts with some feedback and questions. What is Web Parts Connections? Web Parts Connections allows you to connect the Web Part server controls so that they can exchange information. Web Parts can either be a consumer and/or a provider. Once you connect a consumer with a provider the consumer starts receiving data from the provider, all this is done on the server side. Web Parts can be constructed in such way that it can have several consumer and provider connection-points, i.e.it can consume or provide information from several different sources. A provider connection-point can have several consumers but a consumer connection-point can have only one provider.

.NET

SharePoint Web Part Event Flow in detail

I have been answering questions on the SharePoint forums at MSDN Forums, and while some are really tricky and interesting, some are really basic beginner mistakes. A couple of questions lately have been about Web Part development and how to and where to create your controls. Most of these is easily solved if you understand how the Web Part event model works. First of all you need basic ASP.NET understanding and know how the Page and Control objects work together, how a postback works etc. But I have even seen somewhat experienced ASP.NET developers failing at this point, probably due to the fact that Visual Studio have a slick interface for editing user controls and ASP.NET pages. When it comes to SharePoint you have no visual aids and you are out on thin water, and this knowledge is crucial.

.NET

Web Part Properties - part 6 - Complex Properties

To end my series of Web Part properties I would like to show how to store more complex values than just strings or integers. What happens if you would like to store a more complex object; an array or a coordinate etc? Editing these properties with the standard generated interface using the WebBrowsable and Personalizable attributes will not work, since it only accepts basic types, shown in part 1. To make these properties editable you have to (almost…continue reading) create an EditorPart, shown in part 2, and control the properties in the SyncChanges and ApplyChanges methods.

.NET

Web Part Properties - part 2 - Editor Parts

This is the second part of the Web Part Properties series. The last post walked through the basics on how to make editable properties on a Web Part. As a sample I used a Web Part that displayed tweets from Twitter - called TweetPart. Using the standard approach, by marking the properties using specific attributes, we made the Web Part editable as we wanted. But the user experience, for editing, was not optimal. First of all the properties we wanted to edit was located in their own category at the bottom, not that easy to find for inexperienced/untrained users. Secondly the properties has dependencies and requires validation.

.NET

Web Part Properties - part 1 - introduction

I thought that I should kick off this new year with a series of posts on how to make your SharePoint Web Parts editable and how to enhance that out-of-the-box Web Part property editing combined with some tips and tricks. This first post may be to most of you SharePoint developers somewhat basic, but I have chosen to start from scratch here. Many of this first post topics are repeatedly asked in the MSDN development forums. The documentation in the SharePoint SDK on this topic is really bad; it just says do this and do that, never why you should do it. Often this makes developers unaware of pitfalls or possibilities.

.NET

PDC 2008: Day 3, the picture is getting clearer

Day three is officially over, I’m pretty tired today after staying up to late yesterday and playing around with the “goods”. I installed Windows 7 and tried it for a while, but to my disappointment I found out that the nice stuff that were shown on the keynote was missing in my release… This morning started with the last keynote of PDC 2008 and it was Microsoft Research that should be in the spotlight. An hour and a half was filled with stuff such as environment and healthcare studies done by MSR, important, but hey – you have an audience of 6.000 programmers/geeks here… The last 20-30 minutes was cool though, they showed up a kids-programming-language called Boku (not only for kids, for me too!) and Second Light an evolution of Surface, where you can project a secondary image onto a surface that is above, yup not in touch with, the surface. Really cool!

.NET

PDC 2008: Day 1 and Windows Azure

Back at the hotel and watching some Monday Night Football (which I could do that in Sweden!). Here is a summary and some reflections on my day. Woke up early and walked down to LA Convention Center and got me some breakfast (tomorrow I’ll eat at the hotel). I tried to get to the keynote hall as early as possible for some good seating. I ended up in 6th row and had a good overview of the stage and the huge screens. As this is my first PDC and first conference of this magnitude I’m really impressed with the size and organization of it all.

.NET

A request to the SharePoint Development Team

Microsoft SharePoint is a great development platform but it have some major areas where it could be improved. As of today you can create mediocre applications using the current SDK (which is not so well documented), but to create great applications you really need to understand how the internals of Windows SharePoint Services really works! I would like to show you an example of how bad the documentation and implementation is with a pretty common scenario.

.NET

Visual Studio 2008 Service Pack 1 available with new devenv.exe icon

Microsoft has now released the final bits of Visual Studio 2008 Service Pack 1 and the .NET Framework 3.5 Service Pack 1, download here. A lot of stuff has been improved such as stability and performance, no need for me to repeat all this since you can find it a gazillion of blogs as well as in the Microsoft Knowledge Base. One improvement I did not read about is that they have fixed/updated the icon of the devenv.exe so you can distinguish VS 2008 and VS 2005 if you are running them simultaneously. The VS 2008 SP1 icon contains a 9 in the lower right corner.

.NET

How to sort XML without XSL in the .NET Framework

I have several times needed a way to sort XML, retrieved from a file or a web service, inline without invoking XSL transformations, which is the most common way to do it as I have seen. The .NET Framework contains the System.Xml.XPath namespace and is available from the .NET Framework 1.1 and up. This namespace contains a number of classes which can improve the performance of your .NET classes when working with XML. Specifically the System.Xml.XPath.XPathExpression contains a method (System.Xml.XPath.XPathExpression.AddSort) to sort the XPath query results.

.NET

Smooth upgrade of .NET XSL transformations from 1.1 to 2.0 or higher

When .NET 2.0 was introduced, quite a long time ago, the whole System.Xml namespace was re-written, due to the poor performance of the System.Xml implementation. Despite the fact that the CLR 2.0 has been around for a few years there are still implementations using CLR 1.x and especially the XSL transformation bits, since that part is completely re-written and marked as obsolete. But note that they are only being marked as obsolete! You can still compile and run most of the code with just a compiler warning. The old .NET 1.1 classes are still in the CLR 2.0, so you can convert your XSL transformations piece by piece and start using .NET 2.0 or even .NET 3.5 since it is based on .CLR 2.0 (read this post by Scott Hanselman to get a better understanding).

.NET

News Reader SDK released - WPF sample

A few months ago I wrote about the Architecture Journal Reader, a great demonstration app for a “occasionally-connected” Windows Presentation Foundation, WPF, application. I asked for source code and more samples like this, and sometimes dreams come true. Today Tim Sneath announced the public availability of a News Reader SDK and a Syndicated Client Experiences (SCE) Starter Kit and source code for it. At the same time the team created a MSDN Magazine reader application using the starter kit. The SCE is built upon the Microsoft Sync Framework and .NET 3.0.

.NET

Using the new ListView control in SharePoint

The Microsoft .NET Framework 3.5 contains a great new ASP.NET control called ListView. When using the ListView control you have much more control over how the output HTML will look like, which I think still is the main problem with the ASP.NET controls. To learn more about the ListView control, head over to Mustafa Basguns blog and read his excellent articles on the control. The ListView control is great when working with SharePoint (WSS3 and/or MOSS 2007) custom pages, since designing SharePoint pages which adapts into the current administration or takes advantage of all the CSS styles demands you to have pretty good control of your HTML.

.NET

Architecture Journal Reader - a great WPF demo

Microsoft has released a new Windows Presentation Foundation demo sample that is a reader application for The Architecture Journal. The Architecture Journal is a quarterly online magazine focused on IT-architecture and contains nice articles and gives you some good reading. It is available online and as PDF (why not XPS?). The Architecture Journal Reader is a WPF sample, very much like the New York Times Reader that was one of the first killer-apps for WPF, that you can use for offline reading of The Architecture Journal.

.NET

.NET Framework Source Code available

The news that Microsoft will be releasing the .NET 3.5 framework libraries source code for everyone. The code is under the Microsoft Reference License (MS-RL) which means that the code is available for you to use as a reference or for debugging, not to modify or extend (if you simplify it…a lot), i.e. it’s not open source. What’s in it for us? Scott Guthrie has all the goodies in his post, where he explains how this release of source code integrates into Visual Studio 2008, and how you can debug into (for example) the ASP.NET framework. Whenever you decide to step in to a .NET Core library or ASP.NET method Visual Studio will download the appropriate source code and allow you to dig in to it deeper.

.NET

Silverlight 1.0 Released

Finally Microsoft has released Silverlight 1.0 - Microsofts new streaming media platform which aims to compete with Adobe Flash. Silverlight is a cross-platform and cross-browser plugin with focus on delivering high performing graphical web interfaces, with support for Windows and Mac OS. Download the final release here. The download page still says Silverlight 1.0 RC , but the RC will automatically update to the final version. For Linux there is a project under the Mono umbrella called Moonlight which will provide a Linux implementation of Silverlight.

.NET

HTTP 403 Forbidden in a SharePoint site when adding members

When I was installing a new Windows SharePoint Services 3 site today I stumpled upon an error I’ve never seen in SharePoint before. It was when I was trying to add new users in the People and Groups administration. It was not a “normal” error page but instead a HTTP 403 Forbidden message was thrown when going to the /_layouts/aclinv.aspx page. This was on a brand new server instance, with everything patched and up to date.

.NET

Open Xml SDK CTP available now

Microsoft has released a CTP for Microsoft SDK for Open XML Formats, which can be downloaded here. The SDK contains a strongly typed library, built on top of System.IO.Packaging namespace, for creating documents based on the Open XML Format. Great, now we don’t have to use the System.Xml.XmlWriter to create Office 2007 documents. Here is a sample on how to write out the number of characters in a Word 2007 document: XmlDocument extendedProperties = new XmlDocument(); using (WordprocessingDocument wordDocument = WordprocessingDocument.Open("document.docx", false)) { ExtendedFilePropertiesPart part = wordDocument.ExtendedFilePropertiesPart; extendedProperties.Load(part.GetStream()); } XmlNodeList characters = extendedProperties.GetElementsByTagName("Characters"); Console.WriteLine(characters.Item(0).InnerText); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; overflow-x:visible;border:0px} .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

Microsoft Expression

Dissecting XPS, part 7 - XPS with .NET 3.0

This part of the Dissecting XPS series will introduce the XPS parts of the Microsoft.NET 3.0 framework and where you should look to get started creating XML Paper Specification documents. Windows Presentation Foundation, WPF The XPS classes is a part of the Windows Presentation Foundation, WPF, and is found under the System.Windows.Xps namespace. The Open Packaging Convention classes, used to manipulate the packages is found under the System.IO.Packaging namespace. To get you started with creating XPS documents with the .NET 3.0 Framework you should read the January 2006 article in the MSDN Magazine by Bob Watson which explains it all. It contains everything you need to know from reading to writing to signing XPS documents.

.NET

Dissecting XPS, part 6 - reading XPS files programatically

The sixth part of the Dissecting XPS series is here and this time we will, finally, look at some code for reading XML Paper Specification [1], XPS, files. I will in the following sample not use the Microsoft.NET 3.0 Framework, which has built-in functionality for reading and writing XPS files [2]. Instead I will do it using .NET 2.0 (you can try it in .NET 1.1 if you like) and an excellent ZIP library called #ziplib [3]. This will show you more of what’s really happening and it will show you how to integrate XPS into applications built using other .NET Frameworks than 3.0 or in Mono or in what ever you like. For instance, you can use Java and the Java Zip packages.

Microsoft

Dissecting XPS, part 1 - The basics

I will in a number of posts try to explain the XML Paper Specification document format, XPS format, that has been developed by Microsoft. I think the XPS initiative is nice from a developer and ISV perspective, since creating and reading XPS documents is easy and supported from various environments. This series of XPS articles will start off with an introduction to the XML Paper Specification and then continue with general support and competitors and then of course some nice introduction on how to use XPS in applications.

.NET

A Cheat sheet of Cheat sheets

Here is a list of cheat sheets for the Windows and .NET platform that I frequently use and I think are of great interest. Visual Studio 2005 Keyboard Shortcut References Visual C# 2005 - PDF grayscale | PDF color Visual C++ 2005 - PDF grayscale | PDF color Visual Basic 2005 - PDF grayscale | PDF color SharePoint and Office stuff CSS Reference Chart for SharePoint 2007 (Microsoft Office SharePoint Server 2007 and Windows SharePoint Services v3) CSS Reference Chart for SharePoint 2003 New Office 2007 User Interface - Word | PDF Web and ASP.NET stuff Microsoft AJAX ClientScript Cheat Sheet - ZIP JavaScript Cheat Sheet - PNG | PDF Other stuff

.NET

XSLT 2.0 in Microsoft.NET?

As you probably already have read by now is that the XSLT 2.0 and XPath 2.0 are now W3C Recommendations. XSLT 2.0 is a really nice step forward in the XML transformation technology, a technique that we base our software on to enable us to produce content for different devices, platforms and targets. XPath 2.0 and XSLT 2.0, in specific, could help us making these transformations much easier without having to use XSLT Extension Objects for some tasks. 

.NET

ASP.NET AJAX 1.0 Released

Finally ASP.NET AJAX 1.0, known as Atlas, is released in a fully supported version. The Download is available at http://ajax.asp.net. Here’s a summary from Scott’s blog: The ASP.NET AJAX 1.0, which is available for free with full Microsoft support, can be extended with the ASP.NET AJAX Control Toolkit - a set of more than 30 controls for ASP.NET. Microsoft also releases the client-side ASP.NET AJAX JavaScript library under the Microsoft Permissive License (Ms-PL) which allows you to modify the library and the server-side code is released under Microsoft Reference License (Ms-RL) so your debugging will be easier.

Microsoft Expression

The year of constant betas

Today I start my two weeks vacation and I thought I should summarize this year. The year of 2006 has been characterized, for me, as the year of Betas and Technology Previews. I have been trying to involve myself as much as possible in the all the goodies flowing out of Redmond. Microsoft has released numerous amount of new applications and upgrades. Internet Explorer 7 The new version of Internet Explorer is the application this year that will have most impact in the short run on users. More standardized and a slicker interface with support of for example blogs.

.NET

Updated: Even better encapsulation of getting a value from XmlNode

I previously suggested a better method for getting attributes for an System.Xml.XmlNode in a response to an post by Marcus. Craig Nicholson highlighted in a comment that the code i provided can be even further optimized. private static string GetAttribute(XmlNode node, string name) { XmlElement elm = node as XmlElement; return (elm == null) ? string.Empty : elm.GetAttribute(name); } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

Microsoft

Microsoft the Panel - what is this?

The Panel is a site, by Microsoft, with projects focused on the Windows Vista Presentation Foundation and XAML. The site will feature applications and source code for these techniques to show how you can design and implement nice applications for Windows and Live Gadgets. Currently there are some Live Gadgets available as well as a nice 3D RSS Reader called UniveRSS. Feeds are displayed as rotating boxes in a “galaxy” in which you can move around. The feeds are retrieved from your Internet Explorer 7 feeds. Register and download it to try it out.

Microsoft

Abandoning Sony-Ericsson in favor of HTC

Yesterday I abandoned my streak of Sony-Ericsson mobile phones which started many years ago. In fact it started when I was studying and working for the summer at one of Ericssons mobile phone assembly lines with the GH-688. Since 1996 I have been using them, except for a short period when my employer forced me to use a Nokia. I was choosing between upgrading my Sony-Ericsson P910i to a Sony-Ericsson P990 or the HTC TyTN. After some consideration I went to the mobile phone store and made a deal with the salesman.

Microsoft

Microsoft.NET Framework 3.0 released

The Microsoft.NET Framework 3.0, or just .NET 3.0, has been released by Microsoft as well as the Visual Studio 2005 extensions for .NET 3.0 and the .NET 3.0 SDK. The downloads are available for Windows XP, Windows Server 2003 and Windows Vista where applicable. The .NET 3.0 is .NET 2.0 extended with new technologies such as Windows Presentation Foundation, Windows Communication Foundation, Windows Workflow Foundation and Windows CardSpace.

.NET

Preventing comment spam using LinkSleeve

I have a lot of problem with comment spam on the blog as well as spamming on the trackbacks and the problem is spread widely over the blogging world. A lot of you turn off comments or have registration or other methods to get rid of the comment spamming. LinkSleeve (SLV - Spam Link Verification) is a link spam solution that checks a text for well-known URL’s in a text and tells if it contains any known spam addresses. This service is provided via an XML-RPC service without any licensing.

.NET

Reset the experimental hive of Visual Studio 2005

When developing applications and/or integrations for Visual Studio 2005 with the Visual Studio 2005 SDK, for example using the DSL Tools, the testing and debugging is done using a Visual Studio Instance that are running with a special registry hive, instead of the normal so you don’t mess up your normal Visual Studio operations. After a while, when you have created a lot of testing applications the Visual Studio interface is bloated with messed up toolbars, menus and templates you will need clear this experimental hive. Fortunatley the VS SDK comes with a utility called VsRegEx.exe which will reset the hive to the original state or to the Last Known Good state.

.NET

Even better encapsulation of getting a value from XmlNode

Marcus writes in his blog how he often ends up with a method that reads an attribute from an XmlNode object. He has optimized his method so that the exception handling will be minimal, since that is pretty expensive. This is a pretty common scenario for me and I have an even better solution, that does’nt involve exception handling at all. private static string GetAttribute(XmlNode node, string name) { XmlElement elm = node as XmlElement; if (elm == null) { return ""; } return elm.GetAttribute(name); } This method uses the C# as operator which cast the XmlNode to an XmlElement, if it fails it will return null instead of invoking exception handling.

Microsoft

Microsoft XPS Essentials Pack

To view XPS files, if you do not have Windows Vista or Microsoft.NET Framework 3.0, you can download the Microsoft XML Paper Specification Essentials Pack Version 1.0. The download contains an XPS Reader, very much like the Adobe PDF reader and an XPS Document writer, which allow you to print to XPS files. There are other goodies in this pack such as: an XPS IFilter that will help you index XPS files, with Windows Desktop Search for example Windows shell handlers for thumbnail views in Windows Explorer The pack requires Windows 2000, 2003 or XP with the latest service packs and Microsoft Core XML Services 6.0. It’s still a beta, but worth a shot.

.NET

Custom search engines - samples

Yesterday I wrote a quick post on Google Co-op and Windows Live Search Macros and i thought that I should provide you with two great samples. Lawrence Liu has set up a custom search on Windows Live Search called SharePoint Community Search. The search focuses on SharePoint related sites and blogs. Gavin Joyce, the man behind DotNetKicks.com, has created a .NET Search Engine using Google Co-op. Gavin invites everyone to contribute with .NET releated sites that should be in the search scope.

.NET

Acronyms Plugin for Windows Live Writer updated and added to Windows Live Gallery

Today the Windows Live Gallery was updated with a plugin gallery for Windows Live Writer and my plugin for Windows Live Writer is updated with a new and improved interface and functionality. The Windows Live Writer team has gone through the plugin and given me good feedback, which now are implemented. Implementation as a simple content source Possible to write your own custom description of an acronym Improved user interface If you want to download it do it here or from the Windows Live Gallery.

.NET

XML Notepad 2006 - what's the fuzz about?

There seems to be some kind of software release frenzy at Redmond right now. Microsoft are spitting out application after application and I don’t mean the two huge ones; MIcrosoft Windows Vista and Microsoft Office (Server) System. Applications, small and big, like Internet Explorer 7, Windows Live Writer, XNA Game Studios, different Microsoft Live applications, Windows Desktop Search and now XML Notepad 2006 are dropping out from the software factory. It’s fun, but it takes me so much time reading and catching up on the releases.

.NET

Anatomy of a blog: What is a ping and how does it work?

During the creation of this site I wanted to know more about how the blog world works behind the scenes. I will make a few articles about my findings in this matter and what I have done to create this blog. The first article will describe on how you inform other sources and parties that your blog is updated. This is done through a Ping. You should ping whenever you have created or updated a post on your feed. Pinging is either done automatically or manually. Manual pinging is done by finding a site with a Ping interface, like http://www.bloglines.com/ping, and then enter the Url to your feed. You can find some more on the Blog Ping List at AYWE

Microsoft Expression

First Impression of Microsoft Expression Web Designer

So, after some installation trouble the Microsoft Expression Web Designer was installed, read more about it in the EWD Discussion group.The Expression Web Designer is for me a new and improved FrontPage more focused on the layout. I made some initial pages/sites and I feel that it works pretty smoothly to work with. The target group for this product is purely front-end/html programmers.The EWD will complement the Visual Studio development but the lack of source control integration is not just irritating - it’s a “application breaker”. I think the usage of EWD when building large and complex projects will not be that high if this is not implmented. I think my company will still be using Visual Studio for editing webpages for a while….I also lack a nice integration with the Expression Graphics Designer, it would be nice to right-click an image and open the EGD editor within EWD! (When is the next CTP/beta/Gold for EGD coming???) But, I think I’ll give it a shot and try to use it some more before I give it my final judgement. Do you agree or disagree?

.NET

Updated ComPlusWrapper class

Here is an updated version of the ComPlusWrapper that I previously published, this one contains a Hashtable for caching the ProgId/Types as well as a method for invoking methods.Please post any comments to the code or any improvments to the class. public class ComPlusWrapper : IDisposable { private static volatile Hashtable s_types = new Hashtable();private static volatile Object s_lock = new Object();private object _ComPlusObject; private Type _type;private bool _IsDisposed = false;