Archives

Archives / 2004
  • Contribute to the earthquake victims

    You cannot have missed it. The earthquake/tsunami have caused so much pain for locals and tourists in the area. Contribute to your favorite help-organisation, they're all working hard at the moment to provide as much aid as possible. Norwegians can contribute to the aid organisations, all listed here. International aid organizations listed at CNN.

  • CruiseControl.NET v0.7 RC-1 Released!

    The team at Thoughtworks have released a new version of their Continous Integration tool CruiseControl.NET. We've currently got CruiseControl.NET running on several of our developmentprojects and welcome this new release. It is really reassuring to see this project moving forward and taking the position as the primary CI tool for .NET awaiting the competition from Microsofts Team System.

  • Make Sharepoint Search available directly in Office 2003

    Every day I find another little productivity enhancement through correct use of Sharepoint. There are a lot of little known integration points between Office 2003 Desktop applications and Sharepoint, and there are also a lot of well-known whoes and problems in the same sphere. I've focused on the problems a lot lately so I'd like to point out a very cool thing.

  • Make Messenger presence information availible in WSS

    When deploying corporate intranets with Sharepoint Portal Server all user information is replicated through profiles from Active Directory. For organisations without Live Communications Server, only users with Microsoft Passport accounts that match their Active Directory email will have presence information availible in Sharepoint.

  • Sharepoint Document Library Change Request #3

    We are progressing on effective document management with Sharepoint with our customers, and we're gaining more and more opportunitites using Sharepoint as a DMS-killer (heavyweight document management system killer). Customers want's a simpler cheaper solution and love the office integration and ease of use. Some features are missing though, and it creates a certain degree of mistrust with customers. True enough, these things are not supported when using file shares either, but I'd like to see them in sharepoint.

  • Common error using the Exception Management Application Block

    I make extensive use of the Exception Management Application block from Microsoft PAG. A common error I usually get when starting up a new project is that I haven't configured the eventlog on the Windows 2003 Server to allow writing to the eventlog for all authenticated users. The error message is:

  • Speeding up Sharepoint Immediate Alerts

    Whenever a user has requested an alert for a list or another object i Sharepoint there is a default delay of 10 minutes. Users are puzzled by not having received an alert when other users tell them that updates have been made to a list or document library.

  • Sharepoint admin UI speaks many languages

    For a while now we have experienced that the sharepoint administration pages suddenly changes language from norwegian (1044) to english (1033). We got a tip from MS support that seemed to have effect instantly. By increasing the number of worker threads for the application pool running Sharepoint Portal Server the language corrected itself.

  • The weirdest thing so far with NAnt

    I just attempted to debug the NAnt build process in one of my companies projects. The devs was pretty frustrated as they'd just started up with NAnt. The error was that the csc task did not compile any of the source for a given project.

  • Register site in Sharepoint programatically

            /// <summary>
            /// Eventhandler that invokes the RegisterInSiteDirectory method. Will only run on the SPS server 
            /// with SPS admin as current identity.
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void button1_Click(object sender, System.EventArgs e)
            {
                Hashtable itemData = new Hashtable();
                itemData.Add("CustomCategory", "SomeData");
                this.RegisterInSiteDirectory("SiteDirectory", "Sites", "Generated Site Name", "Some Description", "http://sps2003base:8080/sites/genepool", itemData);
            }
            /// <summary>
            /// Registers a site in a given site directory and enlists site for search in the same manner as 
            /// the Sharepoint Site Directory Area UI
            /// </summary>
            /// <param name="siteDirectoryAreaName">Name of the Site Directory area.</param>
            /// <param name="siteDirectoryName">Name of the Site Directory List.</param>
            /// <param name="title">Site Title to be used in the list and search entry.</param>
            /// <param name="description">Site Description to be used in the list and search entry.</param>
            /// <param name="siteUrl">Site Description to be used in the list and for crawling.</param>
            /// <param name="itemData">Custom site metadata used in the list and included in portal content search.</param>
            public void RegisterInSiteDirectory(string siteDirectoryAreaName, string siteDirectoryName, string title, string description, string siteUrl, Hashtable itemData)
            {
                SPSite portalSite = new SPSite("http://sps2003base:8080");
                SPWeb siteDirectoryArea = portalSite.AllWebs[siteDirectoryAreaName];
                SPList siteDirectoryList = siteDirectoryArea.Lists[siteDirectoryName];
                
                // Create new item in the list
                SPListItem item = siteDirectoryList.Items.Add();
                
                // Set default and required values
                item["SiteTitle"] = title;
                item["SiteURL"] = siteUrl;
                item["Description"] = description;
                
                // Add custom metadata
                foreach(DictionaryEntry entry in itemData)
                {
                    item[entry.Key.ToString()] = entry.Value;
                }
                
                item.Update();
                // Register the site for search
                Uri siteUri = new Uri("http://sps2003base:8080"); 
                TopologyManager tm = new TopologyManager(); 
                PortalSite site = tm.PortalSites[siteUri]; 
                PortalContext portalContext = PortalApplication.GetContext(site); 
                AreaManager.SuggestDeepCrawl( portalContext, 
                    title, 
                    description, 
                    siteUrl, 
                    "" /* LargeIconUrl */, 
                    "" /* SmallIconUrl */, 
                    "$$$default$$$" /* Index Catalog */, 
                    "$$$default$$$" /* Index Scope */); 
            }

  • Change WebPart Properties through the WSS Web Services API

    I am currently working on WSS Site generation, and one important aspect of this is to set custom WebPart properties after a site is generated. In this case we are generating a WSS team site for MS CRM Opportunity objects. The WSS site is generated based on a template that contains a set of custom WebParts to display and work with Opportunity data from MS CRM.

  • Adding links to MySite from any page in Sharepoint

    On selected portal areas and teamsite pages in Sharepoint you'll get that link "Add to My Links". This link will append an entry of the current url to your MySite "My Links" list. However this feature is not availible on logical locations like the WSS Team Site default.aspx.

  • Displaying Exchange public folders in Sharepoint

    The Sharepoint / Exchange relationship is not exactly mature. I find myself struggeling to explain customers why seemingly simple stuff is kinda hard. A feature that have been requested by nearly all of our customers is to view exchange public folder contents in a Sharepoint site. So far we've done it in a couple of different ways.

  • Customize Outlook Web Access display elements

            private string OwaDisplayScript
            {
                get
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<script language='JavaScript'>function window.onload()");
                    sb.Append("{");
                    sb.Append("var form = document.forms[0];");
                    sb.Append("if( form.document.readyState == 'complete' )");
                    sb.Append("{");
                    sb.Append("var oStyles = form.document.createStyleSheet();");
                    sb.Append("oStyles.addRule( '.tblFolderBar', 'display:none' );");
                    sb.Append("oStyles.addRule( '.trToolbar', 'display:none' );");
                    sb.Append("}");
                    sb.Append("}</script>");
                    return sb.ToString();
                }
            }

  • A crowded unit testing BoF

    This mornings BoF lead by James Newkirk was truly crowded and goes to prove that .NET developers are taking testing seriously. Considering the level of participation in the discussions there might actually have been too many participants as there were no real discussions, more statements regarding to experience summed up and commented by James Newkirk.

  • Sharepoint Portal Architecture and autogenerating WSS site forests

    I've been checking out the Sharepoint content on this years teched, and some of the hands-on labs might be somewhat interesting. My major interest regarding sharepoint these days, however, is how to design the Portal architecture. How do you efficiently design the relationship between SPS and WSS and how can automatic generation of WSS sites support structured growth of the portal.

  • Microsoft CRM Blogs

    A couple of weeks ago I took the Microsoft CRM Customization Certification, probably as the first in Norway. Internally we've been starting up a dog-fooding project and today I started working with a client that are implementing Microsoft CRM in the current project.

  • New version of CruiseControl.NET

    Took me a week to notice, but CruiseControl.NET 0.6.1 is now released. New features include auto-get of VSS source code (man that took me a while to realize was missing from the last release), support for ClearCase plus support for a light-weight integration with devenv (VS.NET) to avoid using NAnt for smaller projects. The devenv feature makes testing kinda hard so they also included possibilities for running NUnit directly aswell.

  • QueryStringPageViewer WebPart for Sharepoint

        /// <summary>
        /// Mads Haugbø Nissen 2003(c)
        /// Objectware AS
        /// Norway
        /// 
        /// http://weblogs.asp.net/mnissen
        /// 
        /// The QueryStringPageViewer provides the same functionality as the regular PageViewerWebPart
        /// but allows providing a selection of querystring parameters from the page that hosts this webpart
        /// to the page viewed in the QueryStringPageViewer.
        /// </summary>
        [DefaultProperty("ContentLink"),
        ToolboxData("<{0}:QueryStringPageViewer runat=server></{0}:QueryStringPageViewer>"),
        XmlRoot(Namespace="http://www.objectware.no/Lawyer/Sharepoint/Webparts/QueryStringPageViewer")]
        public class QueryStringPageViewer : Microsoft.SharePoint.WebPartPages.WebPart
        {
            private string _contentLink = "";
            [Browsable(true)]
            [Category("Content")]
            [DefaultValue("")]
            [WebPartStorage(Storage.Shared)]
            [FriendlyName("The url of the content to show.")]
            [Description("Supply Querystring params to be passed like this: Page.aspx?Param1&Param2&Param3")]
            public string ContentLink
            {
                get
                {
                    return this._contentLink;
                }
                set
                {
                    this._contentLink = value;
                }
            }
            
            protected string BaseUrl
            {
                get
                {
                    int endIndex = this.ContentLink.IndexOf("?");
                    if(endIndex != -1)
                        return this.ContentLink.Substring(0, endIndex + 1);
                    else
                        return "";
                }
            }
            /// <summary>
            /// Render this Web Part to the output parameter specified.
            /// </summary>
            /// <param name="output"> The HTML writer to write out to </param>
            protected override void RenderWebPart(HtmlTextWriter output)
            {
                string url = this.UrlWithQueryStringGet();
                if(url.Length > 0)
                {
                    string name = "QueryStringPageViewer_" + this.UniqueID;
                    output.AddAttribute(HtmlTextWriterAttribute.Id, name, false);
                    output.AddAttribute(HtmlTextWriterAttribute.Name, name, false);
                    output.AddAttribute(HtmlTextWriterAttribute.Width, "100%", false);
                    output.AddAttribute(HtmlTextWriterAttribute.Height, "100%", false);
                    output.AddAttribute(HtmlTextWriterAttribute.Height, "100%", false);
                    output.AddAttribute(HtmlTextWriterAttribute.Src, url, false);
                    output.AddAttribute("ddf_src", url, false);
                    output.AddAttribute("frameBorder", "0", false);
                    output.RenderBeginTag(HtmlTextWriterTag.Iframe);
                    output.RenderBeginTag(HtmlTextWriterTag.Div);
                    output.Write("IFrames not supported by this browser");
                    output.RenderEndTag();
                    output.RenderEndTag();            
                }
                else
                {
                    Control c = new LiteralControl(string.Format("To link to content, <a href=\"javascript:MSOTlPn_ShowToolPaneWrapper('{0}','{1}','{2}');\">open the tool pane</a> and then type a URL in the ContentLink text box with QueryString parameters formatted like this: 'Page.aspx?Param1&Param2'.", 1, 129, this.ID)); 
                    c.RenderControl(output);
                }
            }
            
            private ArrayList QueryStringKeysGet()
            {
                int startIndex = this.ContentLink.IndexOf("?");
                ArrayList queryStrings = new ArrayList();
                if(startIndex > -1 && this.ContentLink.Length > startIndex + 1)
                {
                    string queryStringRaw = this.ContentLink.Substring(startIndex + 1);
                    if(queryStringRaw.IndexOf("&") != -1)
                    {    
                        string[] tokens = queryStringRaw.Split(new char[]{'&'});
                        for(int i = 0; i < tokens.Length; i++)
                            queryStrings.Add(tokens[i].ToLower());
                    }
                    else
                    {
                        queryStrings.Add(queryStringRaw.ToLower());
                    }
                }
                return queryStrings;
            }
            protected virtual string UrlWithQueryStringGet()
            {
                ArrayList queryStringsToPass = this.QueryStringKeysGet();
                string url = this.BaseUrl;
                
                for(int i=0; i < Page.Request.QueryString.Count; i++)
                {
                    string queryStringKey = Page.Request.QueryString.Keys[i];
                    string queryStringValue =  Page.Request.QueryString[i];
                    if(queryStringsToPass.IndexOf(queryStringKey.ToLower()) != -1)
                    {
                        url += queryStringKey + "=" + queryStringValue + "&";
                    }
                }
                
                url = url.TrimEnd(new char[]{'&'});
                return url;
            }
        }
    
    <?xml version="1.0" encoding="utf-8"?>
    <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
        <Title>QueryStringPageViewer</Title>
        <Description>Passes querystring parameters to the page in the viewer.</Description>
        <Assembly>Objectware.Lawyer.Sharepoint</Assembly>
        <TypeName>Objectware.Lawyer.Sharepoint.WebParts.QueryStringPageViewer</TypeName>
        <!-- Specify initial values for any additional base class or custom properties here. -->
        <ContentLink xmlns="http://www.objectware.no/Lawyer/Sharepoint/Webparts/QueryStringPageViewer"></ContentLink>
    </WebPart>

  • Using an XmlPublisher in the ExceptionManagement ApplicationBlock

    I've been using the Microsoft ExceptionManagement ApplicationBlock and I spent some time creating a nice ExceptionXmlPublisher because the one described in the docs has some flaws. Using the xml publisher removes the need to run the EventLog installer to be able to create the eventlog. Having the exceptions in Xml also works nicely in a distributed environment, and with continous integration. I will soon create an XSLT stylesheet to integrate the current runtime exceptions into my CruiseControl.NET dashboard, so developers can monitor what's going on during execution on the development testserver.

  • ExceptionXmlPublisher for Microsoft.ApplicationBlocks.ExceptionManagement

    using System;
    using System.Xml;
    using System.Collections.Specialized;
    using System.IO;
    namespace Microsoft.ApplicationBlocks.ExceptionManagement
    {
        /// <summary>
        /// Summary description for ExceptionXmlPublisher.
        /// </summary>
        public class ExceptionXmlPublisher : IExceptionXmlPublisher
        {
            void IExceptionXmlPublisher.Publish(XmlDocument ExceptionInfo, NameValueCollection ConfigSettings)
            {
                string filename;
                if (ConfigSettings != null)
                {
                    filename = ConfigSettings["fileName"];
                }
                else
                {
                    filename = @"C:\ErrorLog.xml";
                }
                XmlDocument xmlTarget = new XmlDocument();
                FileStream fs;
                if(File.Exists(filename))
                {
                    fs =  File.Open(filename, FileMode.Open, FileAccess.Read);
                    try
                    {
                        xmlTarget.Load(fs);
                    }
                    catch
                    {
                        xmlTarget = new XmlDocument();
                        xmlTarget.AppendChild(xmlTarget.CreateXmlDeclaration("1.0", "UTF-8", "yes"));
                        xmlTarget.AppendChild(xmlTarget.CreateElement("RuntimeExceptions"));
                    }
                    finally
                    {
                        fs.Close();
                    }
                }
                else
                {
                    xmlTarget.AppendChild(xmlTarget.CreateXmlDeclaration("1.0", "UTF-8", "yes"));
                    xmlTarget.AppendChild(xmlTarget.CreateElement("RuntimeExceptions"));
                }
                
                XmlDocumentFragment docFrag = xmlTarget.CreateDocumentFragment();
                docFrag.InnerXml = ExceptionInfo.OuterXml;
                XmlNodeList stackTraceNodes = docFrag.SelectNodes("//StackTrace");
                foreach(XmlNode node in stackTraceNodes)
                {
                    node.InnerXml = "<![CDATA[" + node.InnerXml + "]]>";
                }
                
                xmlTarget.DocumentElement.AppendChild(docFrag);
                
                fs = File.Open(filename, FileMode.Create, FileAccess.Write);
                try
                {
                    xmlTarget.Save(fs);
                }
                catch
                {}
                finally
                {
                    fs.Close();
                }
                
            }
        }
    }
    

  • Developers are Athletes, Architects are Coaches/Managers/Trainers

    Kris Syverstad writes about how developers resemble athletes. Reading his post I felt almost as Kris had been reading my final term paper in methodology from last spring where I used the exact same analogy. I wrote about developers as athletes in the context of higher learning, and how some students are suited for the extreme and some are more comfortable with the regular amount of training.

  • Setting custom WebPart Properties in the dwp file

    I've been developing webparts that use regular ASP.NET Usercontrols as content for a while. Up until now we've simply hardcoded the url to the usercontrol location in the webpart class. Moving towards a more standardized product that must support differentiated deployment envrironments I wanted to place the url to the usercontrol in the webpart dwp file.

  • Building and deploying Sharepoint cab files with NAnt

    Automatically building and deploying cab files for sharepoint is a great efficiency booster. I have previously blogged about my simple, yet effective, autodeployer for sharepoint cabs. This time around I wanted to automate the construction of the cabfile itself and deploying it to the sharepoint testserver. The pseudo code for the build/deploy steps are something like this:

  • NUnit and DirectoryServices

    I've been working a lot with Continous Integration lately with CruiseControl.NET. All was going well and I had a medium sized build process set up. Suddenly the NUnit2 task in the NAnt script for one of my testcomponents started failing in a completely random fashion. The only output in the nunit2 task in nant log displayed by ccnet was <task name="nunit2" /> .

  • International characters on Sharepoint sites

    Have you ever noticed that your international characters, like our norwegian æ ø and å, just seems to disappear completely from Sharepoint pages and other content (ASP.NET UserControls etc) that are hosted in the Sharepoint context. It is related to the globalization settings for the Sharepoint site.

  • Changing WebPart properties

    Some things are just not obvious, or maybe I am just getting spoiled. Well, I just spent a couple of hours trying to figure out why Sharepoint didn't bother to persist my changed WebPart Title property through postbacks. First I thought this was due to my UserControl approach, and was caused by the ASP.NET UserControl beeing routed around Sharepoints ISAPI stuff.

  • New GotDotNet sample posted..

    I've just released a new version of my DataPanel on GotDotNet. Anyone who have ever made a ASP.NET dataentry web form with a lot of textboxes for editing data in a lot of columns know it's a tiresome task. You have to set all the Text properties on load with the column values, and put updated values back on update. Try doing this in 20 fields in 10 dataentry forms.

  • Working with Sharepoint Area Templates

    My last post got too big so I cut it and a small article was the result. I've been working with Area templates the past days and I am sure there are lots left to learn. However, there are no really good resources for this (except a couple of unclear ones on msd2d.com), so I hope it might come in useful for someone.

  • Working with Sharepoint Portal Server 2003 Area Templates

    There are some documentation out there on Sharepoint Portal Server 2003 (SPS) Area Templates. None however gave me the full overview I needed in order to be able to customize my Areas in the ways I wanted. This article sums up lessons learned in working with Area Templates.

  • Sharepoint Goodies

    New Sharepoint stuff seems to popping up (for me) all the time these days. You might have seen them before but just in case. Here's the last hours results:

  • Internal UDDI Implementations

    I am currently working on something on Service Oriented Architectures. Don't know quite what yet, might become an article, might become code. I had a chat with Clemens the other day in relation to this subject and he showed some enthusiasm for the use of UDDI internally. I have for a while been looking for "the missing link" to put all this talk about use of schema, contracts and messaging juiced with dynamic discovery etc.

    A quick browse on MSDN recovered these two articles that I am currently digesting. I feel something is definately coming along in my head on the subject and frankly I can't wait until the idea materializes in code!

  • Employed

    Christmas is completed, totally dominated by jobinterviews ever since I returned from the US on december 15th. I finally chose norwegian consulting firm Objectware as my new, and first real employer.