Microsoft All-In-One Code Framework 2012 January Sample Updates

A new release of Microsoft All-In-One Code Framework is available on Feb 6th.  We expect that its 8 new code samples covering typical programming scenarios in Windows Azure, Directory Services, Hyper-V, TFS, WDK, and Windows SDK would ease your development work.

image

You can download the code samples using Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates.

If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage https://1code.codeplex.com/.

 

--------------------------------------------

New Windows Azure Code Samples

image

Configure SSL for specific page(s) while hosting the application in Windows Azure (CSAzureSSLForPage)

Download: https://code.msdn.microsoft.com/CSAzureSSLForPage-e844c9fe

The sample was written by Narahari Dogiparthi – Escalation Engineer from Microsoft.

While hosting the applications in Windows Azure, developers are required to modify IIS settings to suit their application requirements. Many of these IIS settings can be modified only programmatically and developers are required to write code, startup tasks to achieve what they are looking for. One common thing customer does while hosting the applications on-premise is to mix the SSL content with non-SSL content. In Windows Azure, by default you can enable SSL for entire site. There is no provision to enable SSL only for few pages. Hence, Narahari has written sample that customers can use it without investing more time to achieve the task.

 

Change AppPool identity programmaticall​y (CSAzureChangeA​ppPoolIdentity)

Download: https://code.msdn.microsoft.com/CSAzureChangeAppPoolIdentit-27099828

The sample was developed by Narahari Dogiparthi – Microsoft Escalation Engineer too.

Most of customers test their applications to connect to cloud entities like storage, SQL Azure, AppFabric services via compute emulator environment. If the customer's machine is behind proxy that does not allow traffic from non-authenticated users, their connections fail. One of the workaround is to change the application identity. This cannot be done manually for Azure scenario since the app pool is created by Windows Azure when it is actually running the service. Hence, Narahari has written sample customers can use to change the AppPool identity programmatically.

 

--------------------------------------------

New Directory Services Code Samples

image

Write / add SPN to user or computer account in AD (CSDsWriteAccou​ntSPN)

Download: https://code.msdn.microsoft.com/CSDsWriteAccountSPN-95c31397

Developed by Shaleen Thapa – Microsoft Support Escalation Engineer, this sample application demonstrates how to write/add Service Principal Name (SPN) to any user or computer account object in Active Directory. This sample must be run on domain environment and under the Domain Admin privileges.  You can execute this sample by creating the exe via Visual Studio but it must be running under the domain admin credentials. Also this code must be running either on Domain controller or any one of the member servers.

 

Get User Group Membership in AD (VBGetUserGroup​InAD)

Download: https://code.msdn.microsoft.com/VBGetUserGroupInAD-a94dc080

Developed by Shaleen Thapa – Microsoft Support Escalation Engineer, this sample application demonstrates how to perform a search on the user’s group membership in Active Directory. This demonstrates the recursive looping method. Also it shows how to get the Object SID for the group.

We are using System.DirectoryServices namespace to perform a search on AD. We will be passing the distinguishedName of the domain with the username whose membership we would like to fetch.
 
Once we found the user, we will read the memberOF attribute’s value. It is one of the possibilities that the group can be member of another group as well; in this case we would need to do a recursive looping.

 

--------------------------------------------

New Hyper-V Code Samples

image

Clone Hyper-V VM Settings (CSHyperVCloneV​M)

Download: https://code.msdn.microsoft.com/CSHyperVCloneVM-81c4d648

Developed by Jithesh Nair – Microsoft Support Escalation Engineer, this sample demonstrates how to create VM from an existing VM template without copying the VHD file.

The existing methods of cloning VMs include exporting/importing the VM configuration along with VHD. If the VHD size is larger this method of cloning takes too much of times. There are scenarios where the customers wanted to creates VMs programmatically from an existing template. This sample demonstrates how one can use WMI and C# for cloning VMs without copying VHD.

 

--------------------------------------------

New TFS Code Samples

image

Add CheckOut Event to TFS (CSTFSAddCheckO​utEventType)

Download: https://code.msdn.microsoft.com/CSTFSAddCheckOutEventType-673d0536

Developed by Ruiz Yi – Sample Writer of Microsoft All-In-One Code Framework, the sample demonstrates how to enable checkout notification in TFS2010.  In TFS2010, when a user sends a Check out (PendChanges) request to server, the server will send a PendChangesNotification before the items are checked out. If we subscribe this notification, we can do following things:

  1. Deny the request.
  2. Fire the custom CheckOut event.  NOTE: As this notification is sent before the items are checked out, we can only know someone is trying to checkout some items.

 

--------------------------------------------

New WDK Code Samples

Virtual Volume Driver (WDKVirtualVolu​me)

Download: https://code.msdn.microsoft.com/VirtualVolume-83334efd

Developed by Bart Bartel – Microsoft Senior Escalation Engineer, this is the Virtvol sample driver. This driver basically creates a nonpaged pool and exposes that as a storage media. User can find the device in the disk manager and format the media to use as FAT or NTFS volume.

 

--------------------------------------------

New Windows SDK Code Samples

List process type information for all running processes (CppCheckProces​sType)

Download: https://code.msdn.microsoft.com/CppCheckProcessType-1f81439d

Developed by Amit Dey – Microsoft Software Development Engineer, this sample code lists process type information for all running processes. like:

  • Is a Console Application or Is a Windows Application
  • Is a Managed Application or Is a Native Application
  • Is a .NET 4.0 Application
  • Is a WPF Application
  • Is a 64 Bit Application or Is a 32 Bit Application

image

 

If you have any feedback, please fill out this quick survey or email us: onecode@microsoft.com