Welcome to MSDN Blogs Sign in | Join | Help

Jeff Nuckolls {Application Platform and Development Tools}

Here you'll find a little of everything as it relates to the Microsoft Application Platform (Biztalk, Visual Studio Developer tools, SQL Server, Windows, .NET development/architecture, etc...). I may even touch on WSS/MOSS from time-to-time. While my blogs are widely applicable to all verticals, I'm dedicated to the Education vertical (K-12 and Higher Education).
SQL Data Services in Education (Overview)

Having to host, manage, monitor, and scale databases comes at a cost.  In Education there is a almost a new need to host a new database daily with often unpredictable growth and scale requirements.  Image you want to post student achievement reports for K-12 or IPEDS reports for Higher Education or any other data for consumption by your in-house applications or the public.  It would be nice to host this information in a pay-as-you-grow “cloud database” such as SQL Data Services (SDS).  (A “cloud database” just refers a database hosted across a fabric of servers in the internet.  In this case SDS is Microsoft’s cloud database offering based on SQL Server technologies across a world-wide fabric of servers managed and secured by Microsoft.)

You can have on-campus applications/systems accessing and updating this data that is hosted in the cloud.  This database is easily accessible via industry standard REST and SOAP based interfaces.

I have recorded this podcast prior to the public announcement of SQL Data Services at PDC in October 2008, but still very applicable toward the IT and economical benefits of this solution for Education.

Marine Corps Scholarship Foundation

I’m a retired US Marine Corps veteran of foreign wars, so when I bought this bottle of “Jarhead Red” wine the other day, I was touched by the underlining benefits.  The proceeds go toward the Marine Corps Scholarship Foundation who provide educational assistance to the children of fallen Marines.

Created by Marines for the children of fallen Marines for education scholarships!

If you’d like to learn more about this foundation, make a donation, or receive scholarship benefits visit www.mcsf.com.  If you just want to enjoy a nice glass of wine and know that the proceeds went towards a good cause, it’s called “Jarhead Red”.

Software plus Services in Education (Overview)

With already tight budgets in Education, these hard economic times add an extra burden that force IT decision makers to be ever more creative to offset costs and turn IT cost centers into IT enablers for the Business of Education as well as the Teaching and Learning process. 

In this podcast I cover the broader impact of Software + Services across the vast IT and economic challenges faced by both K-12 and Higher Education.  In later podcasts I will drill down into more specific technologies, solutions, and scenarios; however if you have questions or requests for details in any area, please comment or email and let me know!

I recorder this podcast a few months back, before the Azure Services Platform was publically announced at PDC in October 2008.  While you can register for more current and upcoming webcasts/podcasts at www.educationwebcasts.com, the message here is still very applicable.  In summary I discuss the benefits of Software + Services in Education. 

Hyper-V error: "failed to remove snapshot" when deleting...

Interesting little error I got while attempting to Delete Snapshot Subtree in Hyper-V Manager.  I was able to delete every snapshot, but the first one in my tree which would then throw this error message ('MySnapshot' unable to remove snapshot...).  It did not appear in Event Viewer, just the message window and it appears that (so far) I'm the only one to come across this as there is no mention of it on the blog-o-sphere or internally at Microsoft, so it was a bit difficult to diagnose.  That just goes to show that I must have been doing something really wrong!  :-)  In fact I was... the problem was that I accidentally created 2 VMs referencing the same VHD (it would be nice if the 'New Virtual Machine Wizard' would have caught this up front).  Once I fixed this the error message no longer appeared and I was able to delete snapshots freely.

BTW... in case anyone else struggles with what exactly 'Delete Snapshot Subtree' does.  It should probably be renamed to 'Flatten Snapshot Subtree' or 'Merge Snapshot Subtree' because that is exactly what it does... merge and flatten snapshots in the subtree, it doesn't technically delete any of the changes you did in those snapshots, in fact it merges them and flattens them into the parent snapshot or VHD whichever is parent to the snapshot you select when you click 'Delete Snapshot Subtree'.  For example, if you wanted to do the following, then selecting 'Delete Snapshot Subtree' on snapshot1 would merge/flatten all subtree snapshots into the VHD in case you wanted to burn it to DVD or put it on a fileshare... you don't have to include the n# GB of snapshots, just the all-inclusive VHD.

clip_image002

Unit Tests with Visual Studio 2008 (screencast)

Test Driven Development (TDD) has long been advocated as a "best practice" in software development.  Without picking apart the details with this theory, I'll just summarize the concept:

  • prior to jumping in with both feet, writing functional code, start with stubbed out methods/functions/classes/etc... (you might use Class Designer for this part)
  • second, create a test harness that aligns with the functional requirements... these should test for "expected" results and compare them with "actual" results returned from the functional code (class/method/etc...)
  • finally start adding code to your stubbed classes/methods... and refining this code until your tests harness receives all "expected" results

Creating these test harnesses can be a cumbersome task and seem to take time away from the valuable development time.  Visual Studio can automate a majority of this for you saving you tons of time without bolt-on 3rd party tools, and most importantly recover that valuable development time "without" sacrificing quality code!

Instead of rambling, I recorded a quick 7 minute screencast to get you started in Unit Testing with Visual Studio 2008:

Note: This just touches the surface, but will hopefully prove a decent introduction.

Web Tests in Visual Studio 2008 (screencast)

If you are interested in testing your web applications, Visual Studio offers a great way to do this without bolt-on or expensive 3rd party tools.  Auto-record, configure, and even generate coded versions (C# or VB) of your web tests, then reuse with/without Load Tests.  You can also add Data Sources (databases, CSV files, and XML files), Validation rules, and Extraction rules to your web tests.

Here I have provided a short screencast to demonstrate "some" of the features for creating Web Tests with Visual Studio 2008:

Enjoy!

Stream Silverlight apps in your blog created with Live Writer...

Here is a cool plug-in for Live Writer from James Clarke (http://www.clarkezone.net/default.aspx?channelid=fe2866cb-00b9-4bff-bb11-1b3a88708a84).

Notice I can now just select "Silverlight Streaming Application" from the Insert menu option.

image

If you have a Live ID (or wish to create one), you can get up to 10gb of FREE space to host your Silverlight videos/apps at http://silverlight.live.com.  When you create an account here you will receive an Account ID and Account Key (required for the following step), be able to upload your Silverlight video/apps, so you can reference insert them as follows:

image

If you have entered your Account ID and Account Key, then select the Refresh button.

Pick your Silverlight application and click Ok.

 

Now just image your blog, that is all there is to it!  :-)

Oh, BTW... if you are looking for a super cool tool to record your screencasts, check out Community Clips at http://communityclips.officelabs.com.

 

Changing Item-level permissions in a Sharepoint List (WSS 3.0) with Elevated Privileges

Most blogs, books, articles, etc... provide some nice sample code, but they all assume that the user is logged on to Sharepoint as a Site Admin or someone with "Full Control" privileges. :-) 

What if you need to do something to the currently logged on user (which is NOT a Site Admin with Full Control) that requires elevated permissions... such as changing the user's item-level permission on a document they just added to the List.

Your knee jerk reaction is to steal a commonly published workaround for running code with elevated permissions by using...

SPSecurity.RunWithEleveatedPrivilege(delegate(){....//add your elevated privileged code here... });

The problem is that you have just changed the user context to Sharepoint\System, but you need it to be the actual logged on Domain\UserName, so you can change/lookup/remove/add/etc... that particular user's Group/Role Assignment affiliations and/or permissions.

So here is some sample code (that does NOT assume the logged on user has "Full Control" permissions already, although its ok if they do), that overrides the ItemAdded event handler and does some work requiring elevated permissions, but with the actual user context instead of Sharepoint\System.  It first checks if the user is in a particular Group, then based on that will remove their Group affiliations, and ultimately change their permissions ONLY on the file that they just added to the Document Library (this same code example applies to any Sharepoint List).  Note that I added a LogEvent method for basic debugging, but as a best practice I would use the Sharepoint Tracing log.


public override void ItemAdded(SPItemEventProperties properties)
{
    this.DisableEventFiring();
    base.ItemAdded(properties);

    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
        using (SPSite _site = new SPSite(properties.WebUrl))
        {
            using (SPWeb _web = _site.OpenWeb(properties.RelativeWebUrl))
            {

                SPUserToken userToken = _web.AllUsers[properties.UserLoginName].UserToken;
                if (bIsInGroup(properties.WebUrl, properties.RelativeWebUrl, userToken, "Nuckolls University Professors") == false)
                {
                    LogEvent("================Changing Permissions==============");
                    SPListItem _item = _web.Lists[properties.ListId].GetItemById(properties.ListItemId);

                    _item.BreakRoleInheritance(true);

                    SPRoleAssignmentCollection sr = _item.RoleAssignments;
                    for (int i = sr.Count - 1; i > -1; i--)
                    {
                        sr.Remove(i);
                    }
                    LogEvent("=================Removed All Roles=================");
                    SPUserCollection users = _web.SiteUsers;
                    SPUser student = users[properties.UserLoginName];

                    SPRoleDefinition readerRoleDefinition = _web.RoleDefinitions.GetByType(SPRoleType.Reader);
                    SPRoleAssignment studentRoleAssignment = new SPRoleAssignment(student as SPPrincipal);
                    studentRoleAssignment.RoleDefinitionBindings.Add(readerRoleDefinition);
                    _item.RoleAssignments.Add(studentRoleAssignment);
                    LogEvent("================Permissions Changes================");
                }
                else
                {
                    LogEvent("This user is in the 'Nuckolls University Professors' group");
                }
                    _web.Dispose();
                }
                _site.Dispose();
            }
        });
    this.EnableEventFiring();
}

private bool bIsInGroup(string siteCollURL, string siteRelativeURL, SPUserToken userToken, string strGroupName)
{
    try
    {
        LogEvent("executed bIsInGroup");
            //Since we need to get site information in context of the "User" (ie. Domain\Steve")
            //instead of the user with elevated previledges (ie. Sharepoint\System), we are
            //creating a new Site object with the "UserToken" and evaluating the "User" with
            //a particular Sharepoint group.
            using (SPSite contextSiteColl = new SPSite(siteCollURL, userToken))
            {
                using (SPWeb contextSite = contextSiteColl.OpenWeb(siteRelativeURL))
                {
                    SPGroup userGroup = contextSite.Groups[strGroupName];
                    if (userGroup != null)
                    {
                        LogEvent(String.Format("Is user in group = {0}", userGroup.ContainsCurrentUser.ToString()));
                        if (!userGroup.ContainsCurrentUser)
                        {
                            return false;
                        }
                        else
                        {
                            return true;
                        }
                    }
                    LogEvent("userGroup = null");
                    return false;
                }
            }
    }
    catch (Exception exception)
    {
        LogEvent("Error checking if user is in a particular group: " + exception.Message.ToString());
    }
    return false;
}


private void ChangeItemLevelPermissions(string user)
{
    LogEvent("We should change this user's permission because they are NOT a professor: " + user);
}

private void LogEvent(string debugMsg)
{
    StreamWriter sw = File.AppendText(@"C:\HomeworkListLog.txt");
    StringBuilder sb = new StringBuilder();
    sb.AppendFormat("[{0}] {1}", DateTime.Now.ToString(), debugMsg);
    sw.WriteLine(sb.ToString());
    sw.Close();
}

 

I hope this will save you time!  And if you've struggling with this for a while, as many others have, then I suggest you should bookmark this blog and get some sleep.  :-)

ColdFusion to ASP.NET Migration

When considering a migration from ColdFusion to ASP.NET, you have several options to consider, I’ve touched on just a few here...

 

Migration options:

  • Re-write… which is really more like drag-and-drop and configure properties than it is re-writing code
  • Build on top of Sharepoint – you might find that it makes more sense to leverage Sharepoint as your development platform (which is based on ASP.NET already) vs. building from scratch… especially since it includes a majority of the functionality that you may need in your new application
  • Use 3rd party tool to run your Coldfusion code in .NET such as BlueDragon from New Atlanta (some of the webcasts provided below talk about Migration using Blue Dragon below)

 Interoperability:

Additional resources:

  • Oldie,  but goodie whitepaper about ColdFusion to ASP.NET migration: http://msdn2.microsoft.com/en-us/library/aa479305.aspx
  • Free Webcasts:
    • Intro to ASP.NET for ColdFusion Developers: Adding ASP.NET to Your Repertoire
      Speaker: David Churvis, Productivity Enhancement
      We'll show a simple yet real world code comparison between ColdFusion and ASP.NET, so developers can sink their teeth into something more than lecture and demonstrations of assembling drag-and-drop elements. We have two identical applications - one built in ColdFusion and one built in ASP.NET - named Nile.com (a fictitious bookstore) that illustrate these comparisons nicely.
    • Introduction to ASP.NET for ColdFusion Developers: Building an ASP.NET Application
      Speaker: David Churvis, Productivity Enhancement
      We'll build the application starting from a blank form, and use a few strategically pre-built items to speed things along and keep the viewers' interest. The idea is to build a small application with all the proper validation, exception handling, and the like layered in as we go along, comparing each topic with its equivalent in ColdFusion. This will give the experienced ColdFusion developer a clear idea of exactly what is involved in building a real world application from the ground up - the only difference is size.

While no migration is easy, I hope this helps you get started.

Migrating from ASP to ASP.NET

Here I have compiled a list of resources to assist anyone interested in making a migration from classic ASP to ASP.NET.  If you wish to skip the details below here are a few summarized pointers.

  • In my humble opinion the easiest approach (using migration wizards) are NOT always the best idea (and sometimes not nearly as easy as you might think), so I would typically recommend re-writing your apps with the following considerations:
    • Re-writing your classic ASP apps in ASP.NET doesn't alway mean "RE-WRITE"... you will quickly find that much of the functionality, UI, navigation/menus, validation rules, authentication/authorization, etc... can be done via drag-and-drop and/or property setting/configuration setting.
    • Start with the data access layer and security modules of your existing ASP apps.  (Before you go out and start writing your own from scratch, try leveraging some of the code we've made available for you designed with best practices in mind from our Enterprise Library, Application Blocks.)
    • Migrate your "Include files"... these will include global UI elements (header, menus, footer), global functions (javascript validation, data access functions, other VB Script functions)
      • Your global UI HTML markup can be migrated into ASP.NET MasterPage files.
      • Your global functions can be migrated into .NET Class Libraries (if the functionality isn't already made available via Server Controls... in fact I'd check here first)

The rest of this blog will provide further details and resources; however I'd also encourage you to checkout this webcast: http://www.asp.net/learn/videos/video-32.aspx...

ASP to ASP.NET 1.x Migration

While there are tools for migrating from ASP to ASP.NET 1.x, you would still need to open and migrate the ASP.NET 1.x version of your site in Visual Studio 2008 to then migrate it to ASP.NET 3.5.  While this may be helpful, there will still be some code rewrites required… the migration tools don’t get everything.

 

1.       Download and Install the ASP to ASP.NET Migration Assistant

a.       The migration assistant is 6MB. We recommend that you save it to your local machine before installing it. After completing the installation, follow the instructions in the 'Getting Started' document (go to Start->All Programs->ASP to ASP.NET Migration Assistant->Getting Started)

b.      Download the ASP to ASP.NET Migration Assistant

2.       Download the ASP to ASP.NET 1.x Migration Guide

a.       The ASP to ASP.NET 1.x Migration Guide provides whitepapers, code samples and other resources to help you migrate your skills and applications from ASP to ASP.NET. If you have questions or feedback on the Migration Assistant.

b.      Download the ASP to ASP.NET 1.x Migration Guide

3.       Download the ASP to ASP.NET Migration Assistant Training

a.       This sample application is part of the Migration Assistant best practices guide. After completing the installation, follow the instructions in the 'ASP to ASP.NET Downhill Bikes Migration' document (go to Start->All Programs->ASP to ASP.NET Migration Training)

b.      Download the ASP to ASP.NET Migration Assistant Training
Download the Migration Assistant best practices guide

4.       Review the ASP to ASP.NET 1.x Migration Assistant Best Practices Guide

a.       The Migration Assistant best practices guide walks you through the migration of an ASP sample application to ASP.NET v1.x using the Migration Assistant. The guide then describes how to migrate optimize the migrated application by taking advantage of the features of ASP.NET.

b.      Download the ASP to ASP.NET 1.x Migration Assistant Best Practices Guide

ASP to ASP.NET 2.0 +

I would definitely watch these videos on Tips, Trick, Gotchas, and best practices for migrating your classic ASP site to ASP.NET 2.0 (it is still very applicable to migrating to 3.5 as well, just keep in mind that there are some enhancements in 3.0 and 3.5 that you may consider beyond whats available in 2.0.  Either way these video are applicable.

 

1.       Migrating from Classic ASP to ASP.NET 2.0 (Part 1 of 2)

2.       Migrating from Classic ASP to ASP.NET 2.0 (Part 2 of 2)

 

Best Practices for .NET Development

There are several links of this launch site for Best Practices, including the plug-and-play reusable modules that we talked about for developing your ASP.NET web architecture and Enterprise Libraries that you can plug into your ASP.NET apps and start taking advantage of out of the box or customize to fit your specific needs:

http://msdn2.microsoft.com/en-us/practices/default.aspx

 

Quick Tutorials, Learning Videos, and Labs

These include short learning videos for everything from ASP.NET 3.5 to Visual Studio 2008 features.

·         www.asp.net

·         www.learnvisualstudio.net

·         www.teamsystemrocks.com

·         http://msdn2.microsoft.com/en-us/bb188199.aspx

·         Learn Visual Studio 2008 – Portal site

·         Visual Studio 2008 Virtual Labs

o   Try Microsoft Visual Studio 2008 in a virtual lab and learn more about accessing relational data using Language Integrated Query (LINQ) to SQL or how Visual Studio 2008 integrates with .NET Framework 3.5. Virtual labs are simple, with no complex setup or installation required.

·         SQL Server 2008 Virtual Labs

o   Test drive Microsoft SQL Server 2008 in a virtual lab. See why SQL Server 2008 is at the heart of a comprehensive data programmability platform that enables you to access and manipulate business-critical data from a variety of diverse devices, platforms, and data services across the enterprise.

·         Windows Server 2008 Virtual Labs

o   Try out the latest version of Windows Server in a virtual lab. Discover how Windows Server 2008 provides a solid foundation for all of your server workload and application requirements while also being easy to deploy and manage.

 

I hope this helps you along the journey to .NET!

 

 

Biztalk POP3 Adapter and WSS Adapter Example

After some extensive research I could not find a good example of how I could receive an Email via the POP3 Adapter for Biztalk Server 2006 R2 that completely parsed out the header content (To, From, Subject, CC, etc...) and the Body (I don't parse the attachments in this example, but here is a sample that does a great job of parsing multiple attachments, thanks to Stephen W. Thomas for posting it.).

* For this article I make a general assumption that you already have a working knowledge about the Biztalk for creating and deploying a basic Biztalk application.

Scenario:

College Admissions process requires that a prospective student submit an Essay as part of their application for admittance to the University.  Here the student will be submitting their essays in the body of an email.  Instead having someone in the Admissions office monitor a huge inbox, we can automate the process of by parsing out the email and submitting it to a Sharepoint List.  For this first example that is as far as we'll take it, but the idea is that once anything is submitted to a Sharepoint List... Sharepoint workflows can be started, staff from the Admission Office can easily search/edit/export these essays, they can be automatically be correlated with other application artifacts (ie. Transcripts, Application Info, Financial records, etc...) based on the application ID or student email to ultimately create a single "student profile" once everything has been received for a particular student.  (I'll demonstrate the rest of these other pieces in a separate example.)

 

Setup a custom List in Sharepoint (WSS or MOSS):

(Details about setting up and configuring Sharepoint and Biztalk are beyond the scope of this example.)

Here I have created a custom List called "Essays for Student Admission Applications" with the following Columns:

  • Changed the Default "Title" Column name to Submitted By
  • Essay Response (Multiple lines of text)
  • Application ID (Single line of text)
  • Date Submitted (Single line of text)

* I left the defaults for Created By and Modified By as is.

clip_image002

Create a new POP3 Mailboxes and setup the Outlook client:

* Here we are assuming that you have already installed/configured POP3 and SMTP Services or your will be leveraging an existing POP3 mail server (ie MS Exchange Server).  (The installation/configuration of POP3/SMTP Services is beyond the scope of this example.)

  • In this example I installed POP3/SMTP on my local machine and configured it to use my local domain (called nuckolls.edu)
  • Add a new Mailbox to be used by Biztalk (you must know the password of the account associated with this mailbox)
    • Added a mailbox associate with a user account (called ProcessApplication@nuckolls.edu)
  • Add a new Mailbox to simulate the Student (you must know the password of the account associated with this mailbox)
    • Added a mailbox associate with a user account (ie. jeff@nuckolls.edu)
    • Create a new Account Profile in Outlook or Outlook Express to send and receive email as this Student. (Steps for this were omitted, assuming this was a reasonably simple step... just make sure it works, by send/receiving email or checking the C:\InetPub\mailroot\Mailbox\nuckolls.edu\YourMailbox.mbx)

Create a new blank Biztalk Application project:

  • Name the Project TestPOP3
  • Right-click on the TestPOP3 project in Solution Explorer and select Properties
  • In the Project Properties window ensure you have done the following:
    • Common Properties/Assembly:
      • Assembly Key File = (assign your *.snk key file... if you haven't already created it, create one using the VStudio command prompt and sn.exe -k C:\MyKey.snk)
    • Configuration Properties/Build:
      • Application Name = TestPOP3
      • Restart Host Instances = True

 

Create the initial Biztalk application artifacts (Schemas):

In this example we will need two schemas, one for the inbound email message (we will call EmailSchema.xsd) and one for the outbound Sharepoint message (we will call AdmissionApp.xsd).

  • Create a new Schema called EmailSchema.xsd
    1. Rename the Root node to EmailText
    2. Create one Child Field Element named Text with a Data Type = xs:string
    3. Promote the Text element as a "Distinguished Field" property.

      EmailSchema.xsd should appear as follows:
      clip_image006
  • Create another Schema called AdmissionApp.xsd
    1. Rename the Root node to Application
    2. Create the following Child Field Elements all with a Data Type = xs:string and promote all of them as "Distinguished Field" properties:

      AdmissionApp.xsd should appear as follows:
      image 

      * Ensure all of the Child Field Elements in both schemas are set to "Distinguished Fields" as follows:
      image

 

Add a (Flat file disassembler) Pipeline component:

This will be used to help parse out the header and body elements of the text-based email we will receive from the POP3 Adapter.

  • Add a new Receive Pipeline component to your Biztalk project called GetEmailText.btp
  • Add a Flat file disassembler to the Disassemble shape on the pipeline designer.
  • Assign the Document Schema property of the Flat file disassembler = TestPOP3.EmailSchema

 

image

 

Create a Biztalk Orchestration:

This orchestration represents the automated Business Process of receiving an Essay as part of a larger Admissions Application process.

Add an Orchestration:

  • Right-click on TestPOP3 project in Solution Explorer and Add a new Biztalk Orchestration
  • Name it EmailProcess.odx

    * Your Solution Explorer window should now appear as follows:
    image

 

* Before we start adding/configuring shapes to the Orchestration Designer... let's first open the Orchestration View window and define some Messages and Variables that we will later use within our Orchestration:

 

Orchestration Messages and Variables:

  • Select View-->Other Windows-->Orchestration View (otherwise it should already accessible on the tab next to the Solution Explorer window)
  • Right-click Messages and create the following Messages:
    • In
      • Message Type = TestPOP3.EmailSchema
    • Out
      • Message Type = TestPOP3.AdmissionApp
  • Right-click Variables and create the following Variables:
    • strEmailAddress
      • Type = System.String
    • strStudentID
      • Type = System.String
    • XMLDOM
      • Type = System.Xml.XmlDocument

* The Orchestration View should appear as follows:
image

Orchestration Workflow/Process Designer

Back to the Orchestration Designer we can now start adding some shapes and configuring some properties that will ultimately define our workflow process.

  • Add a Receive shape
    • Active = True
    • Message = In
  • Add a Construct Message shape
    • Message Constructed = Out
  • Drag a Message Assignment shape into the Construct Message shape we just added above
    • Expression = (add the following to the Expression Editor)

      XMLDOM = new System.Xml.XmlDocument();


      //NOTE: The following xml can be easily generated by right-clicking on the EmailSchema.xsd file and selecting Generate Instance
      //IMPORTANT: The following line of XML should all be on a single line, its on several lines here just for reading purposes only!!!
      XMLDOM.LoadXml(@"<ns0:Application xmlns:ns0=""http://TestPOP3.AdmissionApp""><StudentID>StudentID_0</StudentID>
      <AppDate>AppDate_0</AppDate><SubmittedBy>SubmittedBy_0</SubmittedBy>
      <EssayResponse>EssayResponse_0</EssayResponse>
      </ns0:Application>");

      Out = XMLDOM;
      Out.AppDate = In(POP3.Date);

      //Here we chop of the first 11 characters of the "Subject" (which is "Application")and return the rest as the StudentID
      strStudentID = In(POP3.Subject);
      Out.StudentID = strStudentID.Substring(11);


      //Here we do some string manipulations to remove "<" and ">" from the email adddress...
      strEmailAddress = In(POP3.ReplyTo);
      strEmailAddress = strEmailAddress.Remove(0,1);
      strEmailAddress = strEmailAddress.Remove((System.Int32)strEmailAddress.Length -1);

      Out.SubmittedBy = strEmailAddress;


      Out.EssayResponse = In.Text;


      Out(FILE.ReceivedFileName) = "StudentID" + In(POP3.Subject) + ".xml";
      XMLDOM = null;
      XMLDOM = Out;

      //The following if for debugging purponses only...
      System.Diagnostics.EventLog.WriteEntry("TestPOP3 Debug Complete Msg", System.String.Format("Out Message = {0}", XMLDOM.InnerXml));

  • Add a Send shape
    • Message = Out

 

Create Logical Send and Receive Ports:

  • Drag a Port shape from the Toolbox to the "Port Surface" on the left side of the Orchestration Designer
    • Wizard will start, click Next
    • Name = Port_In, click Next
    • Port Type = PortType_In, click Next
    • Port Binding screen:
      • Port direction of communication = I'll always be receiving messages on this port
      • Port Binding = Specify Later
    • Click Next, Finish
  • Drag another Port shape from the Toolbox to the "Port Surface" on the right side of the Orchestration Designer
    • Wizard will start, click Next
    • Name = Port_Out, click Next
    • Port Type = PortType_Out, click Next
    • Port Binding screen:
      • Port direction of communication = I'll always be sending messages on this port
      • Port Binding = Specify Later
    • Click Next, Finish

 

Assign Logical Port Operations with Send and Receive shapes:

  • From the Port_In port we just created, Drag the green "Port Connector Line" to the Receive shape
  • From the Port_Out port we just created, Drag the green "Port Connector Line" to the Send shape

 

* Your Orchestration should now look as follows:

image

 

Build and Deploy your Biztalk Application:

At this point we are ready to build, deploy, and test our application...

  • Right-click on TestPOP3 and select Build (resolve any errors)
  • Right-click on TestPOP3 and select Deploy (resolve any errors)

 

Create Physical Biztalk Port and Define Orchestration Bindings:

Once you have successfully been able to Build and Deploy your Biztalk application, you will find it available in the Biztalk Server Administration console under Applications.

  • Open up the Biztalk Server Administration console
  • Drill down into Applications -->  TestPOP3
  • Create a new Receive Port called ReceivePOP3 (accept default settings)
    • Create a new Receive Location called ReceivePop3Loc
      • Type = POP3
      • Receive pipeline = GetEmailText
        * Receive Location properties should appears as follows:
        image
    • Configure the POP3 Adapter:
      • Mail Server = (The name of your mail server or local machine name if you install POP3/SMTP locally)
      • Authentication Scheme = Basic
      • Password = (The password of the ProcessApplication@nuckolls.edu account or account your using to be monitored by Biztalk)I
      • Polling Interval = 5
      • Polling Interval Unit = Seconds
        * POP3 Adapter properties should appear as follows:
        image
  • Create a new Send Port called SendEssayToWSS
    • Type = Windows Sharepoint Services
    • Send pipeline = XMLTransmit
      * Send Port should appear as follows:
      image
    • Configure the WSS Adapter:
      • Adapter Web Service Port = 8088 (This is the port that your WSS/MOSS site listens on)
      • Destination Folder URL = Lists/Essays%20for%20Student%20Admission%20Applications
      • Namespaces Aliases = ns0="http://TestPOP3.AdmissionApp"
      • SharePoint Site URL = http://btsmoss:8088/
      • Column 01 = Submitted By
      • Column 01 = %XPATH=//ns0:Application/SubmittedBy%
      • Column 02 = Essay Response
      • Column 02 = %XPATH=//ns0:Application/EssayResponse%
      • Column 03 = Application ID
      • Column 03 = %XPATH=//ns0:Application/StudentID%
      • Column 04 = Date Submitted
      • Column 04 = %XPATH=//ns0:Application/AppDate%
        * The WSS Adapter properties should appear as follows:
        image
  • Configure the Orchestration Bindings
    • In the Orchestrations folder under TestPOP3 in the Biztalk Server Administration console...
      • Double-click TestPOP3.EmailProcess and select Bindings in the properties window
        • Host = BiztalkServerApplication
        • Port_In/Receive Ports = ReceivePOP3
        • Port_Out/Send Ports = SendEssayToWSS
          * The Orchestration Binding properties should appear as follows:
          image

 

Run and Test your Application:

Finally we are ready to test our application...

  • Right-click on TestPOP3 in the Biztalk Server Administration console and select Start
  • Click Start

Open your email client (Outlook or Outlook Express):

  • Create an email
    • To = ProcessApplication@nuckolls.edu
    • Subject = Application9959 (You can use any # following "Application"... ie: Application1234567890, recall our Orchestation parses out the first 11 characters of the Subject line, to return only the Application ID that follows... or StudentID as it is referred to in the schema)
    • Body = (Type in some essay response text here to be submitted as part of the admissions process.)
      * Your email should appear as follows:
      image
  • Click Send

Confirm the message was sent to Sharepoint:

  • Open up your Sharepoint site to the custom List we created earlier (ie. http://btsmoss:8088/Lists/Essays%20for%20Student%20Admission%20Applications)
    * You should see the message appear in the "Essays for Student Admission Applications" List as follows:
    image

 

Hopefully this was helpful and will save some time!  :-)

Visual Basic 6.0 IDE goes out of support

In just 1 week from today, on April 8, 2008, the Visual Basic 6.0 IDE will no longer be supported.  If you haven't converted all your apps to .NET shame on you (I mean that in a pure-poor-humor sort of way, in fact it's widely recognized that migrations aren't always straight forward, each migration strategy may differ depending on several variables... prior planning and a knowledgeable consultant is my best advice), but don't freak out... Microsoft will continue to support the VB 6.0 runtime for all existing application in all the next versions of the Windows OS including Windows Server 2008 and Vista.  However; who knows how many years the runtime will be supported, so you might want to start considering a migration plan, if not for supportability concerns, then to take advantage of the performance, security, power of the .NET Framework and the productivity of Visual Studio 2008.  (Click here for more information about Visual Basic 6.0 life-cycle and mainstream support.)

 Technical References for Migration:

Webcast:

Books:

Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET w/accompanying CD-ROM
Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET w/accompanying CD-ROM
Upgrading Visual Basic  6.0 Applications to Visual Basic .NET and Visual Basic 2005 (Patterns & Practices)
Upgrading Visual Basic 6.0 Applications to Visual Basic .NET and Visual Basic 2005 (Patterns & Practices)
{Get-R-Done!}

Biztalk Adapter for SQL - Issues/Resolutions

Two things that you might encounter while you are attempting to create your schema for your SQL Adapter using the "SQL Transport Schema Generation Wizard":

  1. One thing that seems to be a common problem, is the SQL Transport Schema Generation Wizard diappears or closes unexpectedly right after you have entered your Stored Procedure script or manually added your SQL script and click 'Next'.  This KB article speaks to this known issue and how to resolve it, but it might also be because you have been developing/running other local applications that are holding a connection and/or reading/writing to this table otherwise locking it out.  In this case you could try closing any other open apps (including VStudio) that may be attached to this database.  You might also restart the SQL Service for good measure.
  2. The other issue you may encounter when using the SQL Transport Schema Generation Wizard (perhaps after you've resolved the first issue) is an error message "Failed to execute SQL Statement. Please ensure that the supplied syntax is correct.".  Again this error is referenced in the KB article mentioned above, but there are a couple additional ways to resolve this...
    • Be sure that if your database only accepts Windows authentication only, that you didn't select the 'Use a specific user name and password' on the Data Link Properties pane, instead select 'Use Windows NT Integrated security'.
    • Check the SQL itself and reference this article "Working with the Biztalk Adapter for SQL" for some tips.  I resolved this issue be appends ELEMENTS at the end of my stored procedure as in the following example:

CREATE PROCEDURE SP_GetNewStudentInfo
AS
DECLARE @Process_Date DateTime
SET @Process_Date=GetDate()
Update StudentInfo Set ProcessedDate=@Process_Date Where ProcessedDate is NULL
SELECT StudentID, Lastname, Firstname, Term, GPA, DateofAdmission FROM StudentInfo WHERE ProcessedDate=@Process_Date FOR XML AUTO, ELEMENTS
GO

NOTE:  If you add "ELEMENTS" to the Stored Proc as I did here, it will create the schema representing each column as a "Record" node... if you remove "ELEMENTS" it will create the schema representing each column as an "Attribute" node (which may be best if you plan on promoting any of those columns for routing purposes or to inspect their values within an Orchestration). 

Hope this helps!

ASP.NET Error Message: Login failed for 'NT AUTHORITY\NETWORKSERVICE'

If you are developing against a local SQL Server 2005 database in Visual Studio you may not notice this error message until you attempt to access an ASP.NET page that attempts to read or write to your database from an external client (or browser not launch via VStudio)... the reason is because VStudio runs with elevated administrative previledges on the local dev machine.  While there are several ways to surpress this error, here are a few options you might consider:

 

  1. Modify the Web.config file to impersonate a user that has appropriate previledges for read/write access to your database.
    <system.web>
             <identity impersonate="true" userName="username" password="password" />
    <system.web>

    So you might have noticed that this is a little concerning... putting username/password in the web.config, but you can chose to encrypt this to make it more secure.  Otherwise try option #2.
  2. Open SQL Server Management Studio and grant the 'NT AUTHORITY\NETWORK SERVICE' account to the Role Membership of db_datareader and db_datawriter.
  3. A better option yet would be to force the user to login either via forms-based login or windows-based login and use ASP.NET Membership to control authentication to the site... ensure that appropriate users then are associate with a group that then has reader/writer permission on the database.  See here for details: http://msdn2.microsoft.com/en-us/library/yh26yfzy.aspx

Get-R-Done!

Upgrade TFS from the Trial edition to a licensed copy...

If you were an early adopter and/or just testing out Team Foundation Server 2008 and now want to upgrade to a licensed copy without reinstalling on new hardware see this MSDN article for the appropriate steps: http://msdn2.microsoft.com/en-us/library/ms404852.aspx

(Note if you are a Volume Licensed customer, you may need to call product support because you will not have a Product Key in this case.)

More Posts Next page »
Page view tracker