RSS Feed

Posts Tagged ‘Microsoft’

Win 7 Live Messenger Task Bar Fix

November 26, 2009 No Comments »

Windows 7 Task barFor those of you ‘lucky’ enough to have already updated to the new Windows 7 then you have probably already noticed the major changes to the task bar. Good or bad, you decide. Personally, I like some of the new functionality that it provides but I also enjoy a slim task bar — similar to that of Vista. Fortunately Microsoft provided a “Use small icons” option in the task bar properties (right-click the task bar and select properties) which makes the task bar a similar size to that of Vista.

Changing the task bar to use small icons, however, does not fix the fact that Windows Live Messenger likes to constantly take up a space in the task bar even when the window is not open. Since there does not currently appear to be an option in Windows Live Messenger to display the program in the system tray, instead of on the task bar, we need to use a simple work around.

WLMCompatibility

First, close any current Windows Live Messenger instances. Then open your start menu and locate the Windows Live Messenger shortcut. Right-click the shortcut and select properties. Switch to the Compatibility tab and check “Run this program in compatibility mode for:” and select Window Vista (Service Pack 2)”. Now start Windows Live Messenger and problem solved. You should now see the Windows Live Messenger icon in the system tray. As you would on Vista, XP, etc.

 

See Code, See CodeRun

June 19, 2009 2 Comments »

Merbla wrote a short post today about a site he came accross, CodeRun. The site is an online code respository, with the added advantage of an online IDE include on the site which allows you to see the code and run / debug it as it is. After signing up with a free account you can create your own projects (AJAX, ASP.NET, PHP and WPFAJAX and ASP.NET also have support for facebook applications) which you can develop, store and run all from their website.

The concept is brilliant — everything from start to go can be done online via your standard web browse (currently only supports Internet Explorer and FireFox) and publishing of your source code is as simple as a right-click and a left-click. Once source has been published other people can freely go and search for source code in the repository and open it directly in the browser, make modifications and run them all from within the browser.

CodeRun Online IDE

However; The actuall implementation of it so fair (while still very impressive) is significantly lacking from a development perspective. Although it is possible to do the majority of thing you can do in Visual Studio, it is a little cumbersome and slow at times and does have a few limitions. For example, there is no toolbar — and therefore no drag and dropping of controls (which Microsoft presentations always seem to contain a lot of ;-).

Although the site seems to be focused on web applications some features are also unavaliable in the online IDE. You do not have the ability to create folders with underscores in them, and there does not seem to be anyway of creating the special ASP.NET folders such as App_Data or App_Themes… not such a big deal. Designer files are not automatically created and if you try to create one an exception is thrown saying the file already exists.

The biggest problem however is the speed. Perhaps it is just my machine or my internet connection, but the online IDE is very slow to use and navigate. Menues and and prompts tend to hang the browser for a couple of seconds before they load and the intellisense (ctrl+space) does not allows function correctly. Code highlighting, although not important or required, is lacking from the Visual Studio equivalent and take a signifant amont of time to process and display.

Copying and pasting from Visual Studio in to the online IDE also seems to be out of question, as it seems to past the text multiple times; Copy and paste from within the online IDE works fine.

All that being said the online IDE is quite feature rich and imitates Visual Studio very well. You are able to apply breakpoints and step through code, attach to processes (only online applications — not system processes), watch variables, etc. There is also an option to open a project from a zip file — which works great, providing you zip the project from the root of the project folder (it must not be under a sub folder).

In the end (as Merbla suggested in his post) something like this teamed up with StackOverflow, for the purpose of displaying simple solutions to problems with working example would be brilliant! However as far as online development goes I think there is a long way to go.

See running example: Hello World!

 

Creating A Simple SharePoint Workflow In SharePoint Designer

February 4, 2009 1 Comment »

This one is a quick and easy one, but is the basis for creating some very useful workflows in for use in SharePoint lists. Firstly you will need a SharePoint website and a copy of SharePoint Designer (a 60 day trial version is avaliable from microsoft) and a list in SharePoint which you can apply the workflow to — for this example I am using a fairly simple Travel Requsition list which is a document library which contains InfoPath documents.

To create the workflow open SharePoint designer and connect to your SharePoint website. Once connected, go to File -> New and select the SharePoint Content tab and select Workflow (blank workflow). You should now be presented with the a form similar to the following. Here you can specify a name for your workflow (each workflow in a site must have a unique name) which list the workflow is attached (associated) to and when the workflow should be triggered. In this case we want to trigger the workflow whenever a list item is added or updated.

New Workflow

The next step is to define the actual steps of the workflow. Although it’s not necessary, the first step that I like to perform is to log a message indicated that the workflow has been initialised and is being performed. Additionally I like to also log a message when each step is starting and when each step has been completed. This logging can be achieve simply by using the action “Log message to the workflow history list”.

For this workflow what we want to do now is send an email to the travel requisition assignee, notifying them of a new request which requires their approval. As the workflow is being triggered when a new item is added, or when an item is modified (to capture updates later) we will need to safe gaurd against the fact that the assingee might have already been sent a notification email (this could also be done using a specific column with a boolean value and updating this column in the workflow). To do this we need to create a workflow status column in our sharepoint list and put a condition around our next workflow step.

To create the required column; In SharePoint create a new column of type “Choice”, on the associated list, and add several workflow statuses. For example, Pending Approval, Approved, Declined, Completed.  Now back in SharePoint Designer, in our workflow wizard, click Add workflow step and in the conditions select Compare [list name] field then set the first field to the Workflow Status column we just created and the equals field to the first value (in this case Pending Approval). This will restrict this step from only being processed if the document is pending approval, i.e. when the form is first submitted.

Workflow - Conditions

A step would be pretty useless if it did not contain any actions, so go a head and create an action to log the task we are about to perform (or don’t :-). The next action we want to perform is to send an email to the approver, to notify them of the new requisition. The action we want is called send an email — select this and then click this message, to specify the message contents.

In the Define E-mail Message screen click the address book button next to the To field. You can now specify who should receive the email address — this can be anyone from Active Directory, a custom email address, a SharePoint user, or in our case a workflow lookup value. To specify a workflow lookup value double click on Workflow Lookup… in the list on the left. The source should be left as Current Item and the field value should be set to the field containing the email address of the person who is going to approve the form.

Workflow - Assign To

After clicking OK twice you should be back at the Define E-mail Message screen, where you can now specify the subject and body. If you wish to make the email a little more personalized you add lookup’s to the body by clicking the Add Lookup to Body button and selecting a field using the same method as when we select the email address. One useful field to add to the body is the Encoded Absolute URL field. This field outputs the complete URL of the form to allow the approver to click this link and directly open the form for completion — instead of having to browse to the site and then search through the list for the new form.

Now we are done! This is a very simple workflow, however it can easily be extended to allow additional tasks to be automated. For example, the next step may be to email the appropriate person based on the actions of the approver — if they approve the requsition it might then notify a line manager of this approval; if they decline the requisition it might notify the person it has been declines; or the approver may not be responsible for this approval and as such delgate the task to some who is responsible. The following image show such example.

Workflow - Extended

Where to next? Complex workflows in Visual Studio, with code behind functionality…

 

Windows 7 Taskbar and Copying Files

January 20, 2009 2 Comments »

Windows 7I think the new taskbar in Windows 7 might be a bit annoying for some users, especially those who still prefer the XP style start menu, however I personally think it has some cool features (even if it takes a little getting used to). I noticed one such feature while copying some files. While the copy dialog is open a progress bar is displayed in the taskbar, although it’s only a small change it’s a pretty cool change.


 

Getting SharePoint Users In InfoPath 2003

December 13, 2008 13 Comments »

Recently I have been doing some work with SharePoint and InfoPath 2003 and one of my tasks was to get a list of SharePoint users in to a drop-down list box in an InfoPath form — sound simple right? Wrong! What should be an easy task is made more complicated due to that fact that the SharePoint web services which return user information do not provide complete definitions of their return types, so InfoPath does not know what it can do with the result.

User / Group information can be retrieved from SharePoint via the UserGroup webservice located at http://yourserver/_vti_bin/UserGroup.asmx — the web method I am going to be using is GetUserCollectionFromSite, but of course you can use which ever method you require.

In order to be able to get the information and use it in InfoPath 2003 we are going to need to create a new InfoPath Form Template in Visual Studio 2005. Before we can do this we need to install the Office InfoPath 2003 Toolkit For Visual Studio 2005, which can be found in your MSDN subscription — or alternatively you can download the InfoPath 2003 Toolkit For Visual Studio .NET (2003) although I have not tested this. Once you have installed the toolkit and created a new project you will be presented with a wizard which will guide you through the processes of setting up the project and you can either base the project an existing InfoPath form or create a new one, either is OK.

The first thing to do now is to set up our reference to the SharePoint web service; In InfoPath go to Tools -> Data Connections and click Add. Select Receive data, on the next page select Web Service, and on the following page enter in the URI to your UserGroup webservice (E.G. http://yourserver/_vti_bin/UserGroup.asmx). On the next page you should be able to select your desired web methods, in this case we want GetUserCollectionFromSite. You can now enter a name for the data connection, I am just going leave it as the default name “GetUserCollectionFromSite”. Underneath the textbox where you can enter in the name there is a checkbox option “Automatically retrieve data when form is opened”, ensure this is ticked (if you do not tick this you can retrieve the manually retrieve the data later by calling the Query() method on the data connection).

Now that we have a connection the SharePoint we need to create a data connection which we can easily use in SharePoint, which will allow us to bind default values or in this example populate a drop-down list box. To do this we are going to create an XML file containing the same format as the return type of the SharePoint web service. In notepad, or your preferred text editor, enter the following:

<?xml version="1.0" encoding="utf-8" ?>
<SiteUsersAndGroups>
    <Users xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">
        <User ID="" Sid="" Name="" LoginName="" Email="" Notes="" IsSiteAdmin="" IsDomainGroup=""/>
        <User ID="" Sid="" Name="" LoginName="" Email="" Notes="" IsSiteAdmin="" IsDomainGroup=""/>
    </Users>
</SiteUsersAndGroups>

Save the file as SiteUsersAndGroups.xml. Back in InfoPath create a new receiving data connection, but this time instead selecting Web service select XML document. On the next page click Resource Files… and click Add… -> select the SiteUsersAndGroups.xml file we just saved earlier and click OK twice. On the next page, once again we are going to leave the data connection name as the default “SiteUsersAndGroups”. This time ensure the Automatically retrieve data when form is opened option is unchecked.

To populate the drop-down list box all we have to do now is double-click on the drop-down list box we want to populate and under List box entreis select the option “Look up values in a data connection to a database, Web service, file or SharePoint library or list”. In the Data Connection drop-down select SiteUsersAndGroups. Next to the Entries textbox click the Select XPath button and select the User node. You can now select the attributes we want to display in the Value and Display name fields (the Display name attribute will be the text presented to the user — typically this should be @Name to display the users name). After saving the form we now need to switch back to Visual Studio in order to transfer the data from the web service data connection to the xml data connection.

In Visual Studio open FormCode.cs — by default there should be two methods and two properties: _Startup(…), _Shutdown(), thisXDocument and thisApplication. Although we will not need to use the startup or shutdown methods we will need to use the thisXDocument property.

The first thing we need to do is capture the load event of the InfoPath form. In order to handle InfoPath events methods need to have the InfoPathEventHandler attribute specified. For example our OnLoad event handler is going to look like the following:

[InfoPathEventHandler(EventType = InfoPathEventType.OnLoad)]
public void OnLoad(DocReturnEvent e)
{
    // ... code goes here ...
}

To test if the method is being executed a dialog prompt can be triggered by calling thisXDocument.UI.Alert(“Hello World”);. When the InfoPath form loads a standard dialog box should be displayed saying “Hello World”.

Now that we have an entry point for our code we need to read the data returned from the SharePoint web service, stored in the GetUserCollectionFromSite data connection, and copy it in to our SiteUsersAndGroups data connection which we are binding to the drop-down list. As all of the data is returned in XML format, as is the case with all InfoPath data sources, we are going to need to use XPath to retrieve the data. The first step is to get an XPathNavigator we can use to perform out XPath query, in order to do this we first need to take the DataObject from thisXDocument and place it in to an XmlDocument and from the XmlDocument create a navigator.

XmlDocument userCollectionFromSite = new XmlDocument();
userCollectionFromSite.LoadXml(_thisXDocument.DataObjects["GetUserCollectionFromSite"].DOM.xml);
XPathNavigator siteUsers = userCollectionFromSite.CreateNavigator();

If you look back at the xml file we created earlier you will notice that the Users node is under the http://schemas.microsoft.com/sharepoint/soap/directory/ namespace. Along with this namespace InfoPath data connections are placed under the http://schemas.microsoft.com/office/infopath/2003/dataFormSolution namespace. In order to access these namespaces in our XPath query we need to create an XmlNamespaceManager.

XmlNamespaceManager manager = new XmlNamespaceManager(siteUsers.NameTable);
manager.AddNamespace("dfs", "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution");
manager.AddNamespace("tns", "http://schemas.microsoft.com/sharepoint/soap/directory/");

Our actual XPath query, to get the nodes we are interested in, is going to look similar to the follow:

XPathNavigator allUsers = siteUsers.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromSiteResponse/tns:GetUserCollectionFromSiteResult/tns:GetUserCollectionFromSite/tns:Users", manager);

Now that we have the all of the users (and groups) returned from the SharePoint web service we simply need to load the xml in to the SiteUsersAndGroups data connection as follows:

thisXDocument.DataObjects["SiteUsersAndGroups"].DOM.loadXML("<SiteUsersAndGroups>" + allUsers.OuterXml + "</SiteUsersAndGroups>");

That’s it! When the form is opened the drop-down list should not be populated with the users and groups from SharePoint. The final class should look similar to the following:

#region Using Statement
 
using System;
using System.Xml;
using System.Xml.XPath;
using Microsoft.Office.Interop.InfoPath.SemiTrust;
 
#endregion
 
[assembly: System.ComponentModel.DescriptionAttribute("InfoPathStartupClass, Version=1.0, Class=TravelRequisitionForm.TravelRequisitionForm")]
namespace TravelRequisitionForm
{
    [InfoPathNamespace("xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsf="http://schemas.microsoft.com/office/infopath/2003/solutionDefinition" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tr="http://schemas.microsoft.com/office/infopath/2003/sample/TravelRequest" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD" xmlns:xdUtil="http://schemas.microsoft.com/office/infopath/2003/xslt/Util" xmlns:xdXDocument="http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument" xmlns:xdMath="http://schemas.microsoft.com/office/infopath/2003/xslt/Math" xmlns:xdDate="http://schemas.microsoft.com/office/infopath/2003/xslt/Date" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://www.tarongenergy.com.au/activedirectory" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:ns2="http://www.tarongenergy.com.au/SharePoint" xmlns:ns3="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ns4="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"")]
    public class TravelRequisitionForm
    {
        #region Member Variables
 
        private XDocument thisXDocument;
        private Application thisXApplication;
 
        #endregion
 
        #region StartUp / ShutDown
 
        /// <summary>
        /// Handles the startup procedure.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="doc">The Document.</param>
        public void _Startup(Application app, XDocument doc)
        {
            thisXDocument = doc;
            thisXApplication = app;
        }
 
        /// <summary>
        /// Handles the shut down procedure.
        /// </summary>
        public void _Shutdown()
        {
            // Do nothing
        }
 
        #endregion
 
        #region Event Handlers
 
        /// <summary>
        /// Handles the Load event.
        /// </summary>
        /// <param name="e">Event Arguments.</param>
        [InfoPathEventHandler(EventType = InfoPathEventType.OnLoad)]
        public void OnLoad(DocReturnEvent e)
        {
            // Get all of the Users and Groups from the SharePoint web service connection.
            XmlDocument userCollectionFromSite = new XmlDocument();
            userCollectionFromSite.LoadXml(thisXDocument.DataObjects["GetUserCollectionFromSite"].DOM.xml);
            XPathNavigator siteUsers = userCollectionFromSite.CreateNavigator();
 
            // Add support for the required namespaces
            XmlNamespaceManager manager = new XmlNamespaceManager(siteUsers.NameTable);
            manager.AddNamespace("dfs", "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution");
            manager.AddNamespace("tns", "http://schemas.microsoft.com/sharepoint/soap/directory/");
 
            // Query the user nodes
            XPathNavigator allUsers = siteUsers.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromSiteResponse/tns:GetUserCollectionFromSiteResult/tns:GetUserCollectionFromSite/tns:Users", manager);
 
            // Load the users into the SiteUsersAndGroups connection
            thisXDocument.DataObjects["SiteUsersAndGroups"].DOM.loadXML("<SiteUsersAndGroups>" + allUsers.OuterXml + "</SiteUsersAndGroups>");
        }
 
        #endregion
    }
}

Note: Instead of writing managed code behind the InfoPath form you could write a proxy web service which contains a complete return type in the WSDL, which InfoPath can then use directly; However, note that the SharePoint web services require windows authentication so you will either need to set up a service account to access the web services, or more preferably set up Kerberos to allow authentication to be delegated to your proxy web service.

updated: Fixed typo — web service URL should end in asmx.

 

Xbox 360 Update

November 21, 2008 No Comments »

Another software/firmware update; The NXE (New Xbox Experience) is finally here — simply by connecting to Live everyone should now have been presented with the NXE update. It’s a major overhaul of the xbox interface with a few much loved additional features such as “Install To Hard Drive”.

Head over to the New Xbox Experience website to find out more, or turn on your xbox and start exploring with your new avatar ;-)

 

FIX: Access is Denied 0×80070005

October 30, 2008 No Comments »

Recently I came across the problem where i was occasionally receiving an ‘Access is Denied 0×80070005′ error in the test environment for an ASP.NET application I was developing. After narrowing it down I discovered the error was only ever occurring when a call to the database was being made within the bounds of a TransactionScope(). After a quick search I discovered a thread on the asp.net forums where someone else was having this issue as the MSDTC was not configured correctly.

Applying the same information from the aforementioned thread I soon discovered that the test vs development environments were showing similar results to that mentioned in the thread. In the end the following solution resolved the problem.

Use sc sdshow msdtc on the server to display the current configuration, which should be similar to:

D:(A;;CCLCSWRPLOCRRC;;;S-1–2-0)(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CR;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)(A;;CCLCSWRPLORC;;;NS)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)

Using sc sdset msdtc change the section in red to read as (A;;CCLCSWRPRC;;;WD) e.g:

D:(A;;CCLCSWRPLOCRRC;;;S-1–2-0)(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)(A;;CCLCSWRPRC;;;WD)(A;;CCLCSWRPLORC;;;NS)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)

 

New Kid Coming To The Block: Powerset

September 19, 2007 No Comments »

Powerset Inc, a Silicon Valley company, is developing a new type of search engine which does not function based on the typical Google, Yahoo or Microsoft technique of keywords. Rather it is a natural language search engine, which uses a natural language processing techniques to “read and understand every sentence on the Web”.

Although the company has not released the search engine for use, for public or private testing, they have a Powerset Labs section on their site where invited users can provide feedback on the design of the search engine. Users are also given a peek at technology demonstrations that show off the search engine’s capabilities, which currently for the labs purposes has only indexed Wikipedia pages. At least, that is what they are saying on their blog. You can sign up for the labs at http://labs.powerset.com/, however there is no guarantee that you will get an invite.

There does appear to be a few problems with the site, such as the labs login and extended sign up pages timing out, but I guess these things are expected with a start-up. Especially a start-up which is gathering more and more recognition — Powerset recently presented at TechCrunch40. A video of Powerset presenting at the TechCrunch40 2007 conference can be seen on the TechCrunch20 site.