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.

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.
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!
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.
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:
If you have entered your Account ID and Account Key, then select the Refresh button.
Pick your Silverlight application and click Ok.
Now just
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.
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. :-)
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:
- Can ColdFusion and ASP.NET co-exist? Yes they can, in fact here are some resources that may make this process a little easier:
Additional resources:
-
-
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.
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!
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.
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
- Rename the Root node to EmailText
- Create one Child Field Element named Text with a Data Type = xs:string
- Promote the Text element as a "Distinguished Field" property.
EmailSchema.xsd should appear as follows:

- Create another Schema called AdmissionApp.xsd
- Rename the Root node to Application
- 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:
* Ensure all of the Child Field Elements in both schemas are set to "Distinguished Fields" as follows:
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
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:

* 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
- strStudentID
- XMLDOM
- Type = System.Xml.XmlDocument
* The Orchestration View should appear as follows:
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
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 receiving 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:
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:
- 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:
- Create a new Send Port called SendEssayToWSS
- Type = Windows Sharepoint Services
- Send pipeline = XMLTransmit
* Send Port should appear as follows:
- 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:
- 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:
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:
- 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:
Hopefully this was helpful and will save some time! :-)
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:
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":
- 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.
- 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!
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:
- 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.
- Open SQL Server Management Studio and grant the 'NT AUTHORITY\NETWORK SERVICE' account to the Role Membership of db_datareader and db_datawriter.
- 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!
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.)
Here I’ll give you a quick introduction to LINQ using Visual Studio 2008. Click here to learn more about LINQ in general, otherwise download a 90-day trial Visual Studio 2008 (if you are a student you can download the professional edition for FREE) and fire it up!
First we will look at some very basic LINQ to SQL query using code and the “Linq Relational Designer”, and then we’ll do another example to show you a code/query-free way of doing the same thing using the LinqDataSource.
Linq to SQL (via code and Object Relational Designer)
1. Open Visual Studio 2008 and create a new ASP.NET Web Application (here I’m using C#, but you could just as easily use VB.NET)
a. File-->New-->Project-->Visual C#/Web-->ASP.NET Web Application
Once the project is loaded, we need to first add a database to the project (I am assume that you have SQL Server 2005 Express Edition installed and running… it should have installed with Visual Studio 2008 by default, unless you selected otherwise).
Now I’ll walk you through creating a sample database for this example or use your own existing database for the rest of this example.
2. Right-click the “App_Data” folder and select Add-->New Item
3. Once the Add New Item windows opens select Data/SQL Server Database and name it Students.mdf as follows:
You should now be able to view you database in the “Server Explorer” window as it is below. Now we can start creating your database.
4. Right-click Tables and select Add New Table.
5. Define your columns as follows, be sure to make the StudentID column as an Identity field incrementing by 1.
6. Save your new table as “Students” and then populate it with some fictitious data…
Now we can add a Linq to SQL Class…
7. From Solution Explorer, right-click you LinqDemo web application and select Add-->New Item-->Linq to SQL Classes
8. Name it LinqToStudents.dbml and click Add.
9. The Object Relational Designer should open.
10. From Server Explorer, drag and drop you Students table that you just created into the left pane of your designer surface. It should appear as follows:
11. Save All and Build for good measure…
12. Back to the Default.aspx page let’s Drag and Drop a DataGrid server control from the Toolbox on to Designer View. (auto format it if you want, but don’t configure any datasources at this time).
13. Right-click anywhere on the Default.aspx page and select “View Code”, this should open the Default.aspx.cs class file.
14. Add the following code to the Page_Load event.
|
LinqToStudentsDataContext linqStud = new LinqToStudentsDataContext();
var allstudents = from stud in linqStud.Students where stud.StudentID != null select stud;
GridView1.DataSource = allstudents; GridView1.DataBind(); |
15. Now you can click F5 (to run in Debug mode) or Ctrl + F5 (to run without the debugger), if you just click F5 for the first time you might get the following Information Windows letting you know that its modifying the Web.config file for you to allow debugging. Just click OK.
Your application should start up in Internet Explorer and display all of the data from your Students database table in the GridView control.
Albeit a basic example, you have just completed your first Linq To SQL application. CONGRATZ!
Linq to SQL (via code and Object Relational Designer)
Now that we did it the “hard” way (not really), let’s take a look at an even easier way to Linq our GridView control to a SQL table.
1. Using the same project and Default.aspx page in the previous example. Let’s first DELETE all the code you just added to the Page_Load event of the Default.aspx.cs class file and then Save and Close that file.
2. From your Toolbox, drag and drop the LinqDataSource server control (under Data) anywhere onto the Designer View of your Default.aspx page.
3. You can now select “Configure Data Source” from the LinqDataSource you just added as follows:
4. Once the “Configure Data Source” window appears you can the LinqDemo.LinqToStudentsDataContext option from the “Chose your context object” dropdown, and select Next.
5. On the next screen, just accept the defaults and click Finish.
Back to the Default.aspx Designer View… now we can bind the GridView to our newly created LinqDataSource.
6. Select “LinqDataSource1” from the Chose Data Source dropdown list of your GridView control as follows:
7. Save and Run (F5)
Internet Explorer should open and display data from your database if everything was wired up successfully.
Consider this a pre-post... I received a lot of questions in regards to the integration of VS 2008 and SQL 2008. As of the current date SQL 2008 was just released as a CTP while VS 2008 has already be made publically available. The main things that folks are realizing is the lack of SQL 2008 project templates in VS2008 as well a database validation and other DB Pro tools in support of SQL 2008. I will post a link to some workaround information that should be available on MSDN shortly, but note that this integration "IS" coming... an update to Visual Studio 2008 will be available in conjunction with SQL 2008 when it ships, if not sooner.
I have created two sets of step-by-step instructions. The first is for someone who may be already somewhat familiar with using ADAM and ADAM tools, the second is fo