An Avanade Blogging Community

Welcome to An Avanade Blogging Community Sign in | Join | Help
in Search

John Reynolds' Tech Blog

  • Programmatically complete Sharepoint out of box Approval Workflow

    I have not seen anyone else on the web do this, and I spent a couple days trying to figure this out.
    Given an out of box Sharepoint Approval workflow, I wanted to be able to update the Approval task programmatically, and have the status update to Approved or Rejected as appropriate.
    Simple, right? Not so much. You can't update the task directly, and there is no documentation to speak of on the workflow.
    I compared the extended properties of an approved & rejected task and found out that the internals of the workflow use the following symbols to represent the Approved and Rejected state:
    Approved = "#"
    Rejected = "@"

    Makes perfect sense!!!! Good grief...

    Anyway, here's what you really want: the code.

    SPListItem task = pendingItem.Tasks[1]; // Modify this code to get the most recent task in case an item is edited

    Hashtable data = new Hashtable();

                data["Comments"] = "whoop de do";

                data["PercentComplete"] = 1.0f;

                data["Completed"] = "TRUE";

                data["Status"] = "Completed";

    // Use one or the other

                data["TaskStatus"] = "@";   // Rejected

                data["TaskStatus"] = "#";   // Approved

    SPWorkflowTask.AlterTask(task, data, true);

  • Presenting like Steve Jobs

    I ran across a blog post on http://www.twistimage.com/blog today; it was a link to a YouTube video about presenting like Steve Jobs.

    Most people would agree that Steve Jobs is dynamic, exciting, and entertaining presenter. I always enjoy watching him speak, and this video gives a nice 10,000 foot view of the components that make up the Steve Jobs magic. Many people will never have the personal aura and charisma that Steve Jobs has, but learning how to simplify and streamline presentations, Steve Jobs style, will definitely benefit any business person.

  • Writing with LiveWriter

    I haven't used standalone blogging software before, but wanted to try to consolidate my blog posting, manage posts, and have a nice UI to generate new posts.

    The first software I've tried out is Microsoft's LiveWriter

    Has a nice interface, picked up my Community Server blog and my Blogspot blog with no problems...

    Try it out, it's free!

  • Developer Rules to Live by: Part 1

    I'm just going to aggregate a few of things that I have learned over my short time as a software developer:

    1) Dont join a project that doesnt have a development process in place, or where you wont be able to easily implement one.
    More specifically, I'm concerned with change control. This is the classic scope creep case everyone talks about. Everyone talks about it because it happens all the time, and I have let it happen on my current product. We are in a position where the client is demanding features above and beyond the featureset we initially agreed to, and in a compressed time frame. Because there is no process to manage change and make the cost of change visible to the client, it is now my team's fault if things fall 'behind'.

    Additionally, your team will ALWAYS BE BEHIND if you dont have a change process, because your client will always think up new features. I've even thought up a few and contributed to this problem myself.

    Next time: a simplified version of the mythical man month as applied to software developers.
  • Visual Studio TFS 2008 Build Object Model and Test Results

    Buck Hodges posted a very useful CHM for those of us developing against the new TFS 2008 object model. I was looking for a way to get test data out of the object model, and it is much improved over 2005!

    To get data you need to do the following process:
    1) get an instance of team foundation server
    2) get an instance of the IBuildServer service
    3) retrieve an instance of IBuildDetail associated with the build uri
    4) retrieve an instance of the IConfigurationSummary for the specific platform and flavor desired
    5) iterate over the list of ITestSummary objects in the IConfigurationSummary!

    Here's some sample code to get your test data out of your build, I learned about the 'Information' nodes via the chm, and am very happy with the ability to pull out different types of data without having to perform the check manually myself.

    Happy coding!

    using Microsoft.TeamFoundation.Client;
    using Microsoft.TeamFoundation.Build.Client;
    using Microsoft.TeamFoundation.Build.Common;
    ...
    TeamFoundationServer tfs = new TeamFoundationServer(  TFS_URL, TFS_CREDENTIALS );
    tfs.Authenticate();

    IBuildServer buildSvr = tfs.GetService(typeof(IBuildServer));
    Uri myBuildURI = new Uri("vstfs:///Build/Build/YOURBUILDURI");
    IBuildDetail buildDetail = buildSvr.GetAllBuildDetails( buildURI );
     IConfigurationSummary cfgSum = InformationNodeConverters.GetConfigurationSummary( buildDetail, FLAVOR, PLATFORM);
    foreach( ITestSummary testSum in cfgSum.TestSummaries)
    {
    ...
    }
  • USC Tech Demo - Wii Links

        Thanks to all who came out to the tech talk at USC last night!
    Here's links to the software Mike Jablonski demoed and/or talked about:

    WiimoteLib

    Brian Peek

    Managed Library for Nintendo's Wiimote

    http://www.codeplex.com/WiimoteLib/

     

    Wiimote Drum Kit

    Evan X. Merz

    http://www.thisisnotalabel.com/My-Wiimote-Drum-Kit.php

     

    Wiimote Whiteboard

    Johnny Chung Lee

    http://www.cs.cmu.edu/~johnny/projects/wii/

     

    Wiibrew

    Wii hardware documentation

    http://wiibrew.org/index.php?title=Wiimote

     

    Microsoft Surface

    http://www.microsoft.com/surface/


  • USC Tech Demo - 2/27/08!

    We will be walking through some code from the Video.Show folks. Additionally, Mike Jablonski will be demoing some of the cool WiiMote applications from Johnny Lee

    We will be giving away a couple free WiiMote/Bluetooth development starter kits!

    The demo is at 6:30 pm at USC, Kaprelian Hall #140

    Free food & drink!

    Hosted by UPE Honor Society and Avanade

    For students! Free download of Microsoft VS2008, Server 2003, Expression Studio, and XNA Game Studio

    A great getting started on Silverlight Streaming on MSDN:
    http://msdn2.microsoft.com/en-us/library/bb851621.aspx

  • RSS Dot Net

    Recently, I was on a project which required creating an RSS 2.0 feed using Java, which essentially amounted to mapping our data entities to the appropriate fields in the RSS xml spec. More generally, I want to be able to somehow turn any List of Stuff into an RSS feed easily.

    Lo and behold, in VS2008, WCF has a 'Syndication Service Library' project type, which has entities already created for feeds (and can do RSS 2.0 or ATOM with no problem).

    I decided to create a 'ISyndicatable' interface to tack on to any data entities I might want to make feeds out of, then translate my ISyndicatable entities to SyndicationItem objects when the feed is requested.

    What do you think of this design, what do you do for creating feeds generically?

  • USC Tech Demonstration - Creating a Windows Vista Gadget for Facebook

    Thanks to everyone who attended the Avanade Technology Presentation hosted by the UPE Computer Science Honor Society at the University of Southern California.

    Attached, please find the code and presentation slide deck used at the event

    The code was originally created by Jesse Hsia, Greg Ferguson and Amber Israelsen of Avanade, and used in a technology presentation at UCI as well.

    Win an Ipod Nano (Silver 4GB) - open for current USC students only.

    Download the code from the presentation and improve it, or create a new Facebook application using .Net. Submit your code to me by 12/31/07. Winner will be announced by 1/7/07

    Requirements:

    Be a current USC student
    Make a Facebook application you would want to use!
    Use the Facebook Toolkit
    Use .Net (C# or VB) as the main programming language
    Application can be either hosted in Facebook or standalone-- using Silverlight and/or WPF will definitely give you an edge

    Good luck!

  • Microsoft releases source code of some of the .Net framework

    According to Scott Guthrie's web posting at    http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx

    Microsoft has released the source code to specific .Net Framework components.
    This is intended to allow developers to debug and step into the code of commonly used components and verify there are no bugs in framework implementation.
    Obviously, this code is not free to use in any other software, the license is provided to use the code as reference only.
  • Clearing the Event Log while running under a service account

    I ran into a situation recently where I had a Windows service running under a domain service account, e.g., MyDomain\SvcUser. As part of its operation, the service needed to clear the Event Log after reading its contents. By default, non-administrative accounts cannot clear an event log.
    Granting 'clear' access on an event log to a service account is not as simple as it might sound.
    After reading this post by Rory McCaw, I learned that the permissions are controlled by a custom security descriptor stored in the registry.
    The key is stored here:
    MACHINE\System\CurrentControlSet\Services\EventLog\[CustomLognName]\CustomSD

    This applies to Window Server 2003, apparently the security on the event log has changed from the prior version.

    In the CustomSD key, you will find some long string like this:
    O:BAG:SYD:(D;;0xf0007;;;AN)(D;;0xf0007;;;BG)(A;;0xf0007;;;SY)(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)
    (from Rory's blog)

    The first part is the 'Owner' ACL [ O:BA ], which tells you the Owner is the Builtin Administrators
    The next part is the 'Group' ACL [G:SY], the primary group is the Local System account
    The last, long group is the Discretionary ACL (or DACL) D:(...)(...) which grants discretionary access on a user-by-user basis.
    Each DACL entry is in the form (A;;0x7;;;S-1-5-21-467819145....)
    which is Allow or Deny; then the permissions (for the event log, 0x7 is full control); followed by the SID of the user to be granted/denied the permission.

    To put this information to use, I have created a command line utility that allows one to easily update the permissions on an event log. I will post some code here when I have time to rewrite it. Here are some of the highlights:

    Using the System.Security.Principal namespace

    // Get the account SID
    NTAccount ntAccount = new NTAccount("MyDomain", "MyAccount");
    SecurityIdentifier sid = ( SecurityIdentifier ) ntAccount.Translate( typeof( SecurityIdentifier ) );

    //Open the Security Descriptor from the registry
    // using the Microsoft.Win32 namespace
    string eventLogName = "MyEventLogName";
          string sddl = Registry.GetValue( @"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\" + eventLogName, "CustomSD", string.Empty ).ToString();

    // Omitted: Code to concatenate together the SID and the permission level to update the security descriptor

    //Save back the updated Security descriptor to the registry
    Registry.SetValue( @"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\" + eventLogName, "CustomSD", updatedSDDL );

    So now your service accounts can have full control over an event log without having administrative rights on the computer.

    My unanswered question is this: what class will allow me to manipulate the security descriptor directly? When I attempt to instantiate one of the security descriptor classes like this:

    CommonSecurityDescriptor sd = new CommonSecurityDescriptor( false, false, eventLogSDDL );
    // omitted code to add ACEs to DACL
    sd.GetSddlForm( AccessControlSections.All );

    Trying to convert the security descriptor back to a SDDL string results in some extra stuff in the string:
    Input:
    O:BAG:SYD:(D;;0xf0007;;;AN)(D;;0xf0007;;;BG)(A;;0xf0007;;;SY)(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)
    Outputs:
    O:BAG:SYD:(D;;CCDCLCSDRCWDWO;;;AN)(D;;CCDCLCSDRCWDWO;;;BG)(A;;CCDC;;;S-1-5-3)(A;;CCDC;;;IU)(A;;CCDC;;;SU)(A;;CCDCLCSDRCWDWO;;;SY)(A;;CCDCLC;;;BA)(A;;CCDCLC;;;SO)

    Does anyone know how to manipulate the SDDL correctly via .Net?
  • Repost for the Xbox

    Technorati isn't picking up my post, and i'm running out of time!

    My career manager posted this article about a promotion the Microsoft evangelists are doing for their web expressions tour. Promote the event and get a chance to win an Xbox360! So here's my entry. (and I am currently writing this from the Los Angeles event). I'm stealing the text from Bryant's blog :)

    Microsoft is hosting free Microsoft Web Experience events at the Los Angeles Microsoft office on June 8th and the Denver Microsoft office on June 15th. They will be presenting information on building the next generation user experience on the web.

    They are providing breakfast and lunch, hosting a reception with beer and wine, and attendees are automatically registered in a drawing for an XBox 360 and a Zune that will be given away at each event.

    For more information, visit http://kaevans.sts.winisp.net/Shared%20Documents/webexperience.aspx.

    See you there!

    Technorati Tags: MicrosoftWebExperience

  • T-Mobile Dash Data Connection to Laptop

    It took me a little while to figure out how to share the data connection on the Dash with my laptop. It's not blazing (EDGE ~128k) but it's better than nothing!

    It's very simple, (i'm using Window Mobile 6, but steps should be the same for WM5); go to Start->Accessories->Internet Sharing

    Click connect! That's it! I'm using the USB cable connection for a more reliable connection than Bluetooth, but you can use Bluetooth too.

    Yes, it's simple, but it took a little bit of digging for someone new to Windows Mobile; hopefully this saves someone else a few minutes to figure out.

  • Windows Mobile 6 is here! At least for T-Mobile Dash users :)

    Windows Mobile 6 is confirmed to be released May 4th for the T-Mobile dash (the HTC Excalibur). But of course, you can download it here (queued download, I had to wait about 40 minutes)

    Notably, WM6 comes with Windows Live built-in. The alarm also has a weekday / weekend option. Although not as nice as the multiple alarms of Pocket PC 5.0, it's definitely an improvement.

    The upgrade process was very simple; as long as you have Active Sync installed, just hook up your phone and run the installer. It will take a few minutes and your phone will reboot a couple times. Make sure to backup any important data, as the installation will wipe all your old data off your phone.

  • Passing the MCPD EA; upgrade exam 70-554

    The second time was a charm. On Friday 4/27/07, I passed the 70-554, part two of two in the MCSD.NET upgrade to MCPD EA series. This was my second time taking it as I narrowly missed passing it two weeks ago by about 3 questions.

    The first part of the exam was fairly straight forward for me: 28 questions on "Distributed Applications Development" (70-529) - a lot of questions about WSE 3.0, SOAP headers, and the difference between SoapRPC and SoapDocument encoding. Transcender exam prep worked very well for those questions.

    My trouble came with the second half of the test, "Designing and Developing Enterprise Applications by Using the Microsoft.NET Framework." (70-549) One question described a process and required a flowchart to be filled in for that process. Questions around performance testing require one to determine which performance indicators are relevant, and to infer importance from any subtleties in the problem statement. For example, a question about which methods should be unit-tested on a third party component might mention that "new methods were added, and overall performance has been improved." The developer should infer that this means the components internals must have changed and thus one should unit test all the methods, not just the new ones.
    It is important to read the questions in this second half thoroughly and to consider your answers carefully. There is plenty of time (about 90 minutes for 28 questions), so make use of it and good luck.
More Posts Next page »

This Blog

Post Calendar

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

Post Categories

Syndication