Tuesday, October 11, 2011

BizTalk BAM Request Technical Assistance Email Alert

I am still not heavily invested in SCOM and needed a quick and easy way to set an email alert anytime a user requested technical assistance from BAM portal.By default, the Request Technical Assistance functionality creates an entry only in the Event Viewer of the BizTalk Server where BAM portal is hosted.
Below is the code snippet required to add the technical assistance request to event log:

BufferedEventStream eventStream = new BufferedEventStream(connstring, 0);
eventStream.AddReference("My Activity", ActivityID, "BizTalkService", "Biztalk Service ID of this message:" + messageID, messageID);
eventStream.AddReference("My Activity", ActivityID, "MessageId", "Biztalk Message ID of this message:" + messageID, messageID);

The above code snippet helps write to the event log when a user submits request technical assistance on BAM portal.It writes EventID 1000 with the source BAM Web Services as shown below:













Now we need to attach a custom task to this event in event log.
Here is how we can achieve it :
1. Open Event Viewer, browse to Custom views
2. Create a custom view with the properties below:


3. Under Actions, select Attach Task To This Event
4. This will open the wizard to Create a basic Task, follow the wizard to create the task with the action to Send an email.
5. This will enable sending a blank email whenever the event above is logged. But we need the event details in the email.
6. Then i came across this little gem : Wevtutil.
7. I used the blog here to achieve the desired functionality of adding the content of event log as attachment to the email.
8. This is how my batch file looks like:
del "C:\temp\bamquery.txt"
wevtutil qe Application "/q:*[System[(EventID=1000)]]" /f:text /rd:true /c:1 > "C:\temp\bamquery.txt"
9. Finally the task under Server Manager shows the task with 2 actions:













That's it! Now every-time a user requests technical assistance on BAM portal an email is sent to the support personnel with the description and BizTalk Message ID.

Thursday, October 6, 2011

Saving TFS username and password

On your VM/Dev Environment:
• Start Menu->Control Panel
• Credential Manager
• Add A Windows Credential->
• Type in your internet/network address as your TFS server address, and username and password of your TFS account.



No more annoying login prompts from TFS.

Wednesday, May 4, 2011

BizTalk 70-595 Study Resources

I have started preparing for exam 70-595: Developing Business Process and Integration Solutions by Using Microsoft BizTalk Server 2010.
Being BizTalk 2006 R2 certified i don't expect much changes in the current exam. 
But i'll find out soon, at-least sooner than the 2nd shot offer expires :-) 

Here is the list of resources that I'll be using to prepare for Exam 70-595

  • Virtual Labs: Give that Hyper-v a run for its money!
  • Videos : A series of BizTalk How do I videos, great for beginners.
  • Training Kit :  A must download for any BizTalk developer
  • BizTalk Hotrod: Full of excellent articles from BizTalk MVP's
Happy BizTalking!

Wednesday, March 2, 2011

Linq union on anonymous types

Recently in my project, i was trying to do a LINQ union on two anonymous types. The compiler didn't seem to be happy with it. Here is what i was trying to do:
var query = (from t in taskRepository
                         join s in stepRepository on t.TaskID equals s.ID
                         where t.UserID == 420
                         select new{ID = t.ID,DisplayText = t.DisplayText,ReviewStepID = null
                         })
                       .Union
                       (from rs in reviewStepsRepository
                        where rs.ReviewTypeID == 2
                        select new{ID = null,DisplayText = rs.ReviewName,ReviewStepID = rs.ID
                        })
                       .OrderByDescending(o => o.ID);
With some research, ended up creating a class with ID,DisplayText and ReviewStepID
 public class MyTask
          {
                public int? ID { getset; }
                             public string DisplayText { getset; }
                             public int? ReviewStepID { getset; }
           }
And, the happy LINQ query looked like below:
var query = (from t in taskRepository
                     join s in stepRepository on t.TaskID equals s.ID
                     where t.UserID == 420
                     select new MyTask() { ID = t.ID,                                            
                                          DisplayText = t.DisplayText,
                                          ReviewStepID = null  
                                       }) .Union 
                                         (from rs in reviewStepsRepository
                                          where rs.ReviewTypeID == 2
                                          select new MyTask() { ID = null, 
                                                                DisplayText = rs.ReviewName, 
                                                                ReviewStepID = rs.ID })
                        .OrderByDescending(o=>o.ID); 
Happy LINQ'ING!!!

Thursday, February 10, 2011

C# POCO Entity Generator

C# POCO Entity Generator is a T4 template to generate persistent ignorant entities from an Entity Data Model.
For a complete walk-through refer ADO.NET Team Blog

Thursday, September 23, 2010

BizTalk 2010 -Free Developer Edition

I am super excited about this. A freely down-loadable version of BizTalk 2010 available here.
More information on msdn blog.

Wednesday, September 1, 2010

Table Looping and Table Extractor Functoid in BizTalk

In my recent project I had two requirements for mapping
1.    Map fixed number of elements from source to repeating elements in the destination message.
2.    And Map only if  the value in one of the element exists

Solution: Table Looping and Table Extractor Functoid

Here is a good blog post on using Table Looping and Table Extractor functoid that I referred.
http://hestia.typepad.com/flatlander/2007/01/mapping_fixed_e.html

In order to satisfy the requirement number 2 above I used the Not Equal functoid and connected it to the table looping functoid. Under Configure Table Looping Grid used the output from Not Equal functoid as Column 1 and checked the gated checkbox.

The configure table looping grid looks like below

Friday, July 23, 2010

Getting Received File Name in BizTalk

I wanted to store the name of the file that was received at the Receive port in BizTalk.
So, I went ahead and used the following in the expression shape to get the filename from the message property:

strFileName= MyMessage((FILE.ReceivedFileName)

But the property above returns the filename with complete file path.

And thats where System.IO namespace comes into the picture.
The handy GetFileName method below does the parsing for you, and returns the filename sweet!

strFileName = System.IO.Path.GetFileName(MyMessage(FILE.ReceivedFileName))

Happy BizTalking!