Quantcast
Channel: The Microsoft MVP Award Program Blog
Viewing all 788 articles
Browse latest View live

MVPs for Office 365: Managing Metadata

$
0
0

Editor's Note: The following is a guest post by SharePoint Server MVP Liam Cleary as part of the MVP Award Program Blog's "MVPs for Office 365" series. After 13 years in the IT industry, Liam's career has taken him from an IT Trainer, to a Developer, Network and Server Administrator, Collaboration Consultant and now works as a SharrePoint Solution Architect for SusQtech in Virginia, primarily working with non-profits and associations. His core focus as a solution architect is to ensure that SharePoint can either natively, or with minimal customization, meet the business requirement. Liam is also a five time SharePoint MVP focused on architecture, but also crosses the boundary into development. He is passionate about all aspects of the SharePoint platform and loves to share the good word. He can often be found at user groups or conferences speaking, offering advice or just spending time in the community. Online he can be found at http://www.helloitsliam.com as well as @helloitsliam on twitter.

One of the biggest questions I get either at a conference, by email or even at client meetings is “How do I use the new Term Store capabilities effectively, within my SharePoint environment”. To answer this question first we need to understand why and how it can be used. Firstly the Term Store can be likened to a filing cabinet within a department. This filing cabinet contains multiple draws, which may contain many document dividers which in turn are used to segment documents into logical groups to ease the storing and finding of them later. The Term Store within SharePoint works in very similar way, we can have various groups, which can contain many Term Sets, which hold many Terms whether a single list or a nested structure. These terms can then be surfaced within Site Columns, Content Types, and Web Parts, used as filters, mapped against user profiles or even surfaced within the search interface as refinements. The purpose of this is not to store the files in logical structures like the filing cabinet but allow objects within SharePoint to be tagged and stored anywhere within the site.  This tagging mechanism will then allow you to create an easy way to find the exact data that you need.

So let’s begin by first looking at the Term Store and walking through creating a basic Taxonomy structure. In order to follow this you will first need to be granted the correct permissions that will allow you to perform the management tasks. This can be done through Central Administration, by navigating the following path, “Central Administration > Application Management > Manage Service Applications”, then clicking on the service application that has a type of “Managed Metadata Service”. Clicking on this link will display the administrator view where you are able to add users to the “Term Store Administrators” using the standard people picker within SharePoint. Simply select the user account from the people picker and add it as a term store administrator. Once you have made the change and saved these permissions you will be able to work with the term store. There are other permissions that can be set at each group and term set level that we will not go through in this post.

So now we have permission let’s start creating our taxonomy. In the left pane of the Term Store management tool, the various groups are listed within a nested format underneath the root level which is the proxy service for the managed metadata service. By default the root node displays with a system group listed. This system group is actually tied to the “Tags and Notes” capabilities within SharePoint 2010, for ad-hoc terms and folksonomy. For this example we are however going to create a new group that will contain our term sets and terms. To create the new group, right click on the root node and select the “New Group” option. We will call the group “Demonstration Taxonomy Group”. Simply type this name in the left panel and press the enter key to save. Now we are able to set properties of this such as Group Name, Description, Group Managers and Contributors. For now we will not change the default values. Now we are going to create the stub nodes for our two term sets that we are going to create. Firstly select the “New Term Set” option from the dropdown menu that is presented upon mouse clicking on the new group we created. Call this first term set “Interests”, repeat the process and create a second term set called “Document Types”. We will now add the following list of terms to each term set by once again pressing onto the term set and selected the “Create Term” menu item. Create the following underneath “Interests”, Sports, Outdoor Pursuit, Music and Technology. Then “Document Types” as the parent term with these as child terms Proposal, Presentation, Project Plan, Meeting Notes, Agenda and Invoice. Once these have been created you should have the following displayed within the term store management tool.

As you might see these terms are very flat and really would not offer any granular choices when assigning this to files within SharePoint, so to enhance the user experience we will modify the list to be the contain further sub terms for each node. For “Sports”, we will add Football, Soccer, Tennis and Baseball. For “Outdoor Pursuits” we will add Mountain Biking, Skiing, Water Rafting and Camping. For “Music” we will add Salsa, Dance, Rock and Jazz. And finally for “Technology” we will add Phones, Computers, Television, Video and Camera. For the sports category, football and soccer can mean the same thing depending where you may live, so to ensure that you can pick the correct category you are able to add other labels that will allow the user to type what they wish but still find the correct term. To add labels, select the term you wish to modify, and then add the required label to the “Other Labels” section.

This process can also be used with different languages, so for example you may want to add the Croatian translation for baseball as a label.

If we wanted to create a new term set for capturing people’s hobbies for example, we would find that some of the terms being used within the interest’s term set may be the same. We do not however want to re-type them and have multiple terms with the same name. To negate this we have the ability to reuse terms across term sets. To do this press the “Reuse Term” option from the menu on the term set. Now we can select the term(s) we wish to reuse. With this approach you can create very complex structures by reusing values from across the many term sets you may have as well as adding specific terms to the set that do not exist anywhere else.

Now that we have our taxonomy defined we are able to use this within site columns, content types, pages, search as well as various web parts for filtering of content. Within SharePoint you are able to consume the term sets and terms within Content Types as well User Profile Properties against the users of the site. We use our newly created taxonomy within a content type and within user profiles. To create a content type navigate to the site with the following URL: http://{siteurl}/_layouts/mngctype.aspx , create the content type you need. Once saved, you are then able to add site columns to the content type, by pressing the “Add from new site column” if you have not already created it or selecting the “Add from existing site columns” instead. For our content type we are going to create a new site column called “Document Type”, set the type as Managed Metadata with the following term set selected.

Our content type now has the “Title” field and the “Document Type” field we just created and added. If we now navigate to a document library within our SharePoint site we can add this content type to the library so that it displays on the library as one of the “New” options. Ensure that the “Allow Management of Content Types” option is set in the library first. (Document Library > Document Library Settings > Advanced Settings). Now we can add the newly created content type to our list. When we upload a new document we get prompted firstly for the content type and then the terms we want to add to the file. 

You are then able to either type and have the control auto suggest items or select the picker icon and browse the term sets and terms that you set within the site column. If we select to create a new document from within the library then we get the following user experience.

Word 2010 loads the properties directly into the user interface where you are able to select the values you wish to store, this is very similar to the web user interface that is native to SharePoint.

So now we have our content type created, document added (more than just this one) and tagged. We will now look at exposing these options within a user profile. Once again you will need to have the specific permissions to do this within the user profile service. This is similar to the approach used for the metadata service we performed earlier. To access the user profile service, access Central Administration > Application Management > Manage Service Applications, then select the one listed with the type “User Profile Service Application”. From here you need to select the “Manage User Properties” link within the People section. This page lists out all of the properties that make up a user profile. You will need to select the “New Property” button from the toolbar. Complete this screen by setting the Name to “DemonstrationInterests”, Display Name to “Demonstration Interests”, Type to String, Length to 25 and then select the “Configure a Term Set to be used for this Property” and then select the “Interests” term set. You will also need to set the Policy settings to “Required”, Privacy Setting to “Everyone”, Allow users to edit the values and then check the “Show on the Edit Details Page” and “Show Updates to the property newsfeed”.

Once completed and saved you can now access your profile page to see how this renders. To access your profile, select the welcome control at the top of the page and select the “My Profile” link that is listed. When the profile renders, select the “Edit Profile” and navigate to the section where this profile property was added, it should be listed in the “Custom Properties” section or whichever section you added it too. Now we can apply interests from the term sets directly against users within SharePoint and search on these later. So now that we have some tagged documents and users profiles tagged with our metadata terms we can perform searches based on these tagged options. Firstly however we are able to filter documents within the libraries and lists using this metadata. The out of the box capabilities allow for filtering within the view, as well as a new feature for 2010, of metadata navigation. The base filtering will list all the possible values that are available to allow for filtering, the caveat is if the managed metadata column is set to multi-value the filtering does not work.

To make use of the metadata based navigation within lists and libraries, access the settings for the library or list and select the “Metadata Navigation Settings” link. You are able to set Navigation Hierarchies as well as Key Filters to display. 

This configuration results in the following rendering within the list view web part.

This allows the users to navigate within a list or library in a way that is similar to folders within a network share.

Once you have all your data tagged and stored, outside of using the direct mechanism to filter as described above, search becomes the best approach to retrieving content. To create a better user experience refinements can be added to the search refinement panel, that will list any terms that have been returned in the search results tom allow for direct filtering of the results. By default it will return tags refinement that will return the term typed and any associated tags.

The refinement panel can be modified to add further categories that will help the end users to narrow the search results and find the results that are being searched for. This is done by modifying the core XML used within the search refinement panel web part. For details visit the following TechNet article:

http://technet.microsoft.com/en-us/library/gg193929.aspx

Even though it mentions FAST Search Server 2010 for SharePoint it also applies to base search in SharePoint 2010.

As you can see there are many ways to use Taxonomy within SharePoint 2010, the real key is defining the list of groups, term sets and terms that are, manageable and make sense within your organization. Once you have created the structure you need, SharePoint 2010 is ready and able to surface them in many ways to create an easy and intuitive user experience.


MVP Talks Hyper-V in Taiwan

$
0
0

Virtualization is a hot topic in Taiwan, and Hyper-V MVP Jerry Zhou is helping drive the conversation in a recent interview with iTHome, one of Taiwan’s biggest online/offline magazines. Jerry talks about his recent books, Hyper-V R2 Virtualization Technology Cluster and Hyper-V Virtualization Technology 101, describing how Microsoft Hyper-V enables more advanced capabilities to businesses.

While there are quite a few books available that discuss VMware vSphere in traditional Chinese, Jerry’s books are some of the few that help IT pros understand the benefits of deploying Hyper-V Server 2008 R2.

Through his blog and his books, Jerry has committed himself to helping the community increase IT efficiency and agility through Hyper-V. “Businesses will benefit if they know how to implement Hyper –V as a reliable and optimized virtualization solution, improving server utilization and reducing costs,” he explained.

You can see Jerry’s interview here:

http://www.ithome.com.tw/itadm/article.php?c=68849

http://news.pchome.com.tw/magazine/report/ct/iThome/5155/131100480002268075007.htm

And find his books here:

ISBN: 9789868689206 http://findbook.tw/book/9789868689206/basic

ISBN: 9789866382376http://findbook.tw/book/9789866382376/basic

MVPs for Office 365: Establishing Calendar Sharing between Office 365 Customers

$
0
0

Editor's Note: The following is a guest post by Office 365 MVP Loryan Strant as part of the MVP Award Program Blog's "MVPs for Office 365" series. Loryan Strant is passionate about the cloud and the opportunities it brings. Having with spent most of his 15 year career in IT delivering on-premise business productivity solutions, he founded Paradyne in early 2010 to focus on BPOS and more recently Office 365. Loryan was one of the first people in the world (that didn’t work at Microsoft or Nortel) to be certified on Microsoft OCS 2007. His passion for productivity means that he is constantly making use of the latest Microsoft offerings to further enhance the way his customers do business. Loryan frequently shares tips & tricks on his blog http://www.bpossibility.com, as well as regularly posting on Twitter (@strant).

As I personally have a passion for human productivity and the ability for people to communicate and collaborate more effectively, one of the features I’m extremely excited about with Office 365 is the ability for customers (or ‘tenants’) to be able to share calendar information between each other.

Sharing calendars isn’t a new thing, and individuals have been able to do this on a case-by-case basis previously. In Exchange Online this behaviour is actually allowed by default (you can turn it off with a policy).

What I’m going to focus on here is the ability for entire organisations to ‘federate’ and share calendars. This allows customers/suppliers/partners to work together more closely especially when scheduling meetings as it negates the need for people to call/email each other and discuss when they should book the appointment in.

This functionality is done from the PowerShell console, so our first step is establish our Office 365 tenant administrative credentials :

$cred = Get-Credential

The next step is to establish a remote PowerShell connection to Exchange Online:

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection

This can sometimes take a few moments, so be patient.

After the connection has been established we need to import the PowerShell commands to our local session:

$importresults = Import-PSSession $s

This process can take a few minutes and may even time out, so make sure it completes successfully before continuing further.

Now we can start getting into the guts of Exchange Online and have fun! The first step is to actually allow customizations to occur on our tenant, by way of a simple enough command:

Enable-OrganizationCustomization

Our final step is to actually establish the relationship between tenants. The following command will establish the relationship from your tenant to the remote tenant, but is only one way. This means that after performing the next command your calendars will be accessible by the other tenant (but not vice versa yet):

Get-FederationInformation -DomainName <other domain>.com | New-OrganizationRelationship -Name "<company name>" -FreeBusyAccessEnabled $true -FreeBusyAccessLevel AvailabilityOnly

The previous command will only share Free/Busy information. If you want to share that as well as other calendar information (eg. subject, location) then replace AvailabilityOnly with LimitedDetails.

Repeat the above on the remote tenant to set up bi-directional calendar sharing.

If all goes well, you should just be able to add the remote user as an attendee to your meetings and see at least their Free/Busy, such as the following screenshot between myself and fellow Office 365 MVP Brett Hill:

MVPs Bring Together Hundreds of Developers to Hack Kinect and Build Games in Sydney

$
0
0

By Nick Ellery, MVP LEAD, Australia

This summer a handful of Australian MVPs banded together to deliver the ‘Developer!Developer!Developer! Sydney’ event in Sydney, Australia. ‘DDDSydney’, as the event soon came to be known, was a two-day developer event that not only featured sessions on some of the latest dev tools and practices around, but which also rocked so hard that it actually tilted the earth a little further on its axis (just a little bit though, don’t freak out).


Organized by MVP Lewis Benge (blog / twitter) and attracting 280 attendees, the event featured four tracks of solid gold developer content delivered by both MVPs and other community leaders. Day one focused on some great breakout sessions in a theatre-type format, while day two was where things really got interesting (for me, anyway). Day two was the Kinect and Windows Phone Mango Dev Day!

The Dev Day was a way to get people to start playing with and thinking about Kinect and WP7 Mango development. It was an important, and very useful, way to teach developers new skills and get them using them immediately. The Kinect element featured a half day of training on the non-commercial Kinect SDK, delivered by Lewis and Windows Live MVP Bronwen Zande (blog / Twitter). This training was followed by a challenge to attendees to build something cool using what they’d learned about the SDK. Some of the resulting applications included a Tetris-style game that required you to contort your body to fit through puzzle pieces as they approached you on-screen, a quick-draw Western-style game (just like Wild Gunman, but without the NES light gun and the crazy Marty McFly Nikes) and a jukebox controller for Windows Media Centre which allowed you to control and select music using your body movements. After the judging was finished, the gunslinger app took home top honours. Keep in mind these were all working prototypes built in around two hours!


*Picture of the gunslinger app. Photo by MVP Bronwen Zande, used with permission.


*Picture of the body Tetris app. Photo by MVP Bronwen Zande, used with permission.

The Windows Phone Mango component of the Dev Day, delivered by our omnipresent Windows Phone Development MVP Nick Randolph (blog / twitter), was a similar concept. The aim of the day was for attendees to learn as much as possible about the Windows Phone 7 API, build an application, and win prizes. Applications developed on the day include apps that help you avoid parking tickets, apps that help you find public toilets, and an app that helps you find great Mojitos. My vote went to the Mojito app, but alas the judges did not share my enthusiasm for the delicious combination of white rum, lime and mint: the developer of the anti-parking ticket app took home first prize and an AR Drone.

In all, the day was very successful and saw a lot of training delivered on some cutting edge developer topics. A big “thankyou” must go out to all the below MVPs who were involved and made the day so successful (as well as to the other presenters and @Mrslewisbenge).

An extra special “Thanks” should go out to Lewis Benge for his leadership in promoting and organizing the event, and to developer whiz-kid and Internet Explorer MVP Aaron Powell for all of his work both behind the scenes and presenting at the event. Special mention must also go out to Bronwen Zande and Nick Randolph for hosting the Dev Day sessions.

If you’d like to keep up to date with what MVPs from the Oceania region (Australia, New Caledonia, New Zealand) are doing on Twitter, follow the ANZ MVPs Twitter list.

MVPs for Office 365: Microsoft Dynamics CRM – Building Consistency into Free Form Text Fields

$
0
0

Editor's Note: The following is a guest post by Dynamics CRM MVP Jerry Weinstock as part of the MVP Award Program Blog's "MVPs for Office 365" series. Jerry is the Business Development Manager at CRM Innovation. Jerry has been working with CRM since the 1.2 release in 2003. CRM Innovation builds Email, Marketing and Event Management solutions for Microsoft Dynamics CRM. Twitter: @crminnovation

In Dynamics CRM there are in a few core entities where the Primary Attribute field is a nvarchar Text field that the user must complete. These fields are system required and you are unable to edit them to change their type. Additionally, since they are required fields the record cannot be saved until it contains some data. The fields do not lend themselves to a consistent data entry format due to the nature of them being free form text fields.

For example, in the grid view shown below for the Opportunity entity the first column represents the Topic field in the form, which is the primary field. While this allows the CRM user great flexibility in data entry, it all but eliminates any possibility of easy sorting or filtering.

While Free Form Text Fields provide significant advantages they fall short in being able to serve up the information to the user in an organized presentation.

Text Field Advantages –

  • adapts to any situation – users can enter anything they want that is relevant to the record
  • very descriptive relevant data – they can be verbose

Text Field Disadvantages –

  • Sorting – no organized format enforced so it’s nearly impossible to sort
  • Filtering – common terms or spelling are not enforced
  • Scanning – data can’t be presented in subgroups which makes it hard on the eyes
  • Irrelevant – users can enter anything they want which can often include unnecessary info

If we look at a few of the Core Records in the CRM system, some lend themselves to free form text entry and others have primary fields that could benefit by consistent data formatting.

The ones that lend themselves to building in data consistency are Case and Opportunity.  The solution is to insert some Jscript in the OnLoad and OnChange events for the entity so that we can concatenate data from other fields into the primary key field.

For example in the Opportunity entity if we concatenate ID Status (a custom field) and Potential Customer into the Topic field you get this view in the record.

After implementing the concatenation you then end up with a grid view that is easily sortable, scanable and if necessary filterable.

Implementing the same type of concatenation in the Case entity builds a “Customer – Subject” consistency into the Case Description Field. In this example, the concatenated field is set to read only so that user cannot edit the description.

Then you get consistent view of open cases in the grid view as follows:

Moving away from the core CRM records this technique can be applied to the Recurring Appointment activity by concatenating the Engagement Type (custom field) and the Required Participant.

The Jscript code to write for the concatenation is not that extensive, a snippet is shown below. Note the line of code in Red. That line is necessary in the Case example above where the concatenated field is set to read only. Without the ForceSubmit, the concatenation result will only be displayed but not saved to the field when the record is saved.

So in review there are a lot of advantages to managing the data that goes into some of the system required fields in the CRM system to pre-fill them in via concatenation to provide uniform, consistent, and highly scannable records. It will make records that are outliers jump off the screen and likely improve user efficiencies in entering data.

I have shown one way to do this using Jscript which gives you immediate results, the Workflow Process in CRM is another way to accomplish it, albeit with a slight delay as Workflow is processed in the background.

In Major Gamer Magazine, Mark Libman Answers the Question: What the Heck is An MVP?

$
0
0

Xbox MVP and OzBoxLive’s executive producer Mark Libman earned a full-page spread in this month’s Xbox 360 Magazine Australia/New Zealand, where he describes what it means to him to be an MVP.

He recounts his trip to the recent MVP Global Summit. “I met MVPs from other products such as Windows and Microsoft Office, but also fellow Xbox MVPs from around the globe. This is the moment that changed my life!” He calls meeting Frank O’Connor (343 Industries), as well as  Microsoft’s Aaron Greenberg, Larry Hryb, and other employees who inspired him to start his site, “a very humbling experience.”

The article features photos of Mark and fellow Xbox MVPs at the MVP Global Summit.

You can also take a look at Mark and some of his fellow gamers talking about being an MVP when we caught up with them at Summit!

MVPs for Office 2010: The Beauty of Transitions in PowerPoint 2010

$
0
0

Editor's Note: The following is a guest post by PowerPoint MVP Glenna Shaw as part of the MVP Award Program Blog's "MVPs for Office 2010" series. Glenna Shaw has over 14 years of experience creating data visualizations in the form of presentations, project management tools, dashboards, demos, prototypes and system user interfaces.  She is a Certified Project Management Professional and an active member of the PowerPoint Community.  Also known as the PowerPoint Magician, Glenna is the author of the popular PowerPak for PowerPoint series, an innovative collection of lesson and educational game templates. 

My MVP brother, Glen Millar, can frequently be heard to say how much he doesn’t like transitions. So I, like any true sibling, love them and always have.  So much so I even wrote articles about how to fake 3D transitions in PowerPoint 2003, create a scrolling effect in PowerPoint 2007 and create pan and zoom effects in PowerPoint.  With the release of PowerPoint 2010, I was thrilled to see I no longer need to fake it.  My very favorite new feature is that transitions play correctly in all directions.  You now have the ability to move forward and backward through your slideshow and your slides will transition appropriately.  No more need for extra slides to compensate.

I’m especially fond of the new Dynamic Content transitions.  When PowerPoint 2010 was first released I found them a little confusing and even complained that they weren’t really transitions but full slide animations.  That was before fellow MVP Troy Chollar showed me a slide he had created using a Dynamic Content transition.  Wow, was I hooked!

Dynamic Content transitions are essentially a two for the price of one transition.  The background does a fade transition and the content changes simultaneously using the transition you choose.  This means if your background is the same on your slides it will look as if your content moves independently on and off the screen.

There are seven options for Dynamic Content; Pan, Ferris Wheel, Conveyor, Rotate, Window, Orbit and Fly Through.  With a little experimentation of the options for direction and timing you can create something really special.

I recently had a friend deliver a keynote presentation on Cloud Computing at a major conference.  By using Dynamic Content transitions and alternating two cloud backgrounds I created a presentation that looked as if his content tumbled and flew through the clouds.  The result was light and airy and perfectly suited to his topic.

I’ve put together a presentation that demonstrates some of the transitions in PowerPoint 2010.  You can download it from my public SkyDrive.   You’ll notice it’s a zip file.  This is to force you to download it and play it in PowerPoint 2010.  Sadly, transitions do not play in the PowerPoint Web Apps.

All the transitions in PowerPoint 2010 are pretty spectacular and offer amazing potential for the creative slide show designer.  Now if MS would just add a Page Turn transition and remove that bounce from the Pan transition I would be content.

MVPs Help Others Play Hard at Rehabilitation

$
0
0

There are a lot of stories right now about developers using  Xbox Kinect technology to create a whole range of innovative designs and solutions (for an example, see this post about MVPs in Australia “hacking” Kinect). MVPs in Korea, however, recently contributed to community in a different way—offering their expertise in Xbox Kinect to give people with severe disabilities the opportunity to use the Xbox 360 with a Kinect sensor to enjoy sports games they never imagined they’d be able to play.

It started with the gift of an Xbox Kinect from Microsoft Korea to the Korean Institute of the Disabled for Independent Living. The folks at the Institute saw the rehabilitation possibilities offered by the technology and came up with the idea for a contest. Microsoft MVPs, including Xbox experts, volunteered as event staff to help contestants.

The result of the contest went far beyond anything either Microsoft Korea or the Institute expected. From bowling to boxing, the participants became immersed in the games, competing enthusiastically surrounded by the audience and volunteers cheering and applauding.

In the end two Xbox 360 consoles were awarded as prizes: one to an organization supporting people with disabilities and one for an individual winner who showed outstanding effort. The prizes were awarded by an amazing man who lies in bed operating a computer with his eyes, and who has just graduated Yonsei University.

Congratulations to all the participants—and a special thank you to the MVPs who continually step in and exemplify the spirit of community!


MVPs for Exchange Online: Calling Exchange Online PowerShell Cmdlets from C#

$
0
0

Editor's Note: The following is a guest post by Exchange Server MVP Mike Pfeiffer as part of the MVP Award Program Blog's "MVPs for Exchange Online" series. Mike Pfeiffer has been in the IT field for over 13 years, spending most of his time as an enterprise consultant focused on Active Directory and Exchange implementation and migration projects. He is a Microsoft Certified Master on Exchange 2010, and a Microsoft Exchange MVP. You can find his writings online at http://www.mikepfeiffer.net , where he blogs regularly about Exchange Server and PowerShell-related topics.

One of the great things about Exchange Online is that it provides many of the application development capabilities that are available through an Exchange 2010 on-premises environment. This is made possible mainly through the functionality provided by Exchange Web Services (EWS). Just take a look at the developer resources for Exchange Online on the Exchange Server Developer Center. Many of the technical articles showcase the EWS Managed API, which provides the ability to send e-mail messages, create inbox rules, search mailbox folders, and much more, through managed code.

In addition to using EWS, we can also build applications that utilize the Exchange Management Shell cmdlets on servers in the cloud, and this provides even more automation capabilities and the ability to perform administrative tasks. Just like the on-premises version of Exchange 2010, Exchange Online can be managed with remote PowerShell, and the cmdlets can easily be called from a .NET application. In this article, I’ll take you through the process of building a simple console application written in C# that will invoke Exchange cmdlets in the cloud. Other than Visual Studio, PowerShell v2 and an internet connection are the only prerequisites. In these examples, we'll be using Visual Studio 2010 on a Windows 7 machine, which has PowerShell v2 installed by default.

Creating an Application

The first thing we’ll need to do is start Visual Studio 2010. Go to File > New > Project, or press Ctrl+Shift+N to create a new project. Select the Console Application template, type a name for your application (I’ll use o365Shell), and click Ok.

Before we start writing code, we need to do a couple of things. First, we’ll need to add a reference to the System.Management.Automation.dll assembly. In the Solution Explorer, right click on your project and click on Add Reference:

Under the Assemblies tab, click on Browse:

On a Windows 7 machine, the System.Management.Automation.dll assembly is located in sub-folder under %windir%\assembly\GAC_MSIL\System.Management.Automation. Locate this file and click on Open:

That will take you back to the Add Reference screen where you can click on Add:

When viewing the Solution Explorer, you should see that the reference has been successfully added to the project:

Finally, we’ll add some namespace references to the top of our Program.cs file:

using System.Management.Automation;

using System.Management.Automation.Remoting;

using System.Management.Automation.Runspaces;

using System.Collections.ObjectModel;

using System.Security;

Connecting to Exchange Online

At this point, we’re ready to write some code. All of the following examples should be added within the Main method of your application. Since we're making a connection to a remote server, we'll obviously need to authenticate before we can start running commands. This first code sample will create an object instance of the PSCredential class. This will store our username, and a password encrypted with the SecureString class. Make sure you replace the username and password provided with one of your Microsoft Online Portal Administrator accounts:

string userName = "admin@uclabs.onmicrosoft.com";

string password = "P@ssw0rd";

 

System.Security.SecureString securePassword = new System.Security.SecureString();

 

foreach (char c in password)

{

    securePassword.AppendChar(c);

}

 

PSCredential credential = new PSCredential(userName, securePassword);

Next, we'll create an instance of the WSManConnectionInfo class, which will provide the connection information that is required to create and connect to the remote runspace. We'll use our PSCredential object from the previous step to authenticate to the cloud:

WSManConnectionInfo connectionInfo = new WSManConnectionInfo(

    new Uri("https://ps.outlook.com/powershell"),

    "http://schemas.microsoft.com/powershell/Microsoft.Exchange",

    credential);

 

connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;

connectionInfo.MaximumConnectionRedirectionCount = 2;

There are a few interesting things to point out here. Notice that we’ve used https://ps.outlook.com/powershell as the endpoint Uri, along with setting the MaximumConnectionRedirectionCount property of the connectionInfo object to a value of 2. This will allow us to establish a connection to the initial Exchange Online endpoint, and then be redirected to the appropriate Exchange Online server for our Office 365 tenant.

Running a Cmdlet

Now that we've created our connectionInfo object, we'll use it to create a runspace on a remote Exchange Online server. The following code will open the runspace and invoke a cmdlet:

using (Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo))

{

    runspace.Open();

 

 

    using (PowerShell powershell = PowerShell.Create())

    {

        powershell.Runspace = runspace;

 

        //Create the command and add a parameter

 

        powershell.AddCommand("Get-Mailbox");

        powershell.AddParameter("RecipientTypeDetails", "UserMailbox");

 

        //Invoke the command and store the results in a PSObject collection

 

        Collection<PSObject> results = powershell.Invoke();

 

        //Iterate through the results and write the DisplayName and PrimarySMTP

        //address for each mailbox

 

        foreach (PSObject result in results)

        {

            Console.WriteLine(

                string.Format("Name: {0}, PrimarySmtpAddress: {1}",

                    result.Properties["DisplayName"].Value.ToString(),

 

                    result.Properties["PrimarySmtpAddress"].Value.ToString()

                    ));

        }

    }

}

This code runs a single command; Get-Mailbox, with just one parameter. Basically, we're asking for a list of user mailboxes, excluding other types such as discovery and resource mailboxes, by setting the RecipientTypeDetails parameter to UserMailbox. The command output is stored in a PSObject collection, and it will provide access to multiple properties for each mailbox returned by the command. When we run the application, we iterate through each PSObject result and write out the DisplayName and PrimarySmtpAddress property values for each mailbox. The output should look similar to the following:

Running Multiple Cmdlets in a Pipeline Command

So, what about stringing multiple cmdlets together to build a one-liner? Well, this only requires a few slight modifications to our previous example. What we want to do is add multiple Command objects for each cmdlet we want to invoke. The following code disables the ActiveSync protocol for all the users in the cloud using a pipeline command:

using (Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo))

{

    runspace.Open();

 

    using (PowerShell powershell = PowerShell.Create())

 

    {

        powershell.Runspace = runspace;

 

        //First command

        Command getCasMailbox = new Command("Get-CasMailbox");

        powershell.Commands.AddCommand(getCasMailbox);

 

        //Second command and parameter

 

        Command setCasMailbox = new Command("Set-CasMailbox");

        setCasMailbox.Parameters.Add(new CommandParameter("ActiveSyncEnabled", false));

        powershell.Commands.AddCommand(setCasMailbox);

 

 

        //Invoke our one-liner

        powershell.Invoke();

    }

}

This time we're not retrieving any output, we're just modifying a setting for each mailbox. One of the ways you can build a pipeline command is to simply add one command at a time to the PowerShell object instance. Each time you use the AddCommand method, it's like you're adding a pipe character at the end of a command when you're working in the shell. Each Command objects Parameters property has an Add method, and you can tack on individual parameters one at a time, along with their associated values. The previous code sample accomplishes the same result as the following shell one-liner:

Get-CasMailbox | Set-CasMailbox -ActiveSyncEnabled $false

Remember, there's no limit to the number of cmdlets you can chain together in a pipeline command. This provides a lot of flexibility if you are developing an application that needs to automate administrative tasks in the cloud. I'd recommend testing commands like these in a remote PowerShell instance. Once you've determined the syntax is correct and everything works, move into Visual Studio and start writing code.

Dealing with Errors

Let's take our previous example a step further and add some error handling:

using (Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo))

{

 

    runspace.Open();

 

    using (PowerShell powershell = PowerShell.Create())

    {

        powershell.Runspace = runspace;

 

        //First command

        Command getCasMailbox = new Command("Get-CasMailbox");

 

        powershell.Commands.AddCommand(getCasMailbox);

 

        //Second command and parameter

        Command setCasMailbox = new Command("Set-CasMailbox");

        setCasMailbox.Parameters.Add(new CommandParameter("ActiveSyncEnabled", false));

 

        powershell.Commands.AddCommand(setCasMailbox);

 

        try

        {

            //Invoke our one-liner

            Collection<PSObject> results = powershell.Invoke();

 

            if (powershell.Streams.Error.Count > 0)

            {

 

                //Write command errors

                foreach (ErrorRecord error in powershell.Streams.Error)

                {

                    Console.WriteLine(error.ToString());

                }

            }

        }

        catch (RuntimeException ex)

 

        {

            //Write execption message

            Console.WriteLine(ex.Message);

        }

    }

}

There are basically two types of errors we might need to deal with when invoking cmdlets from C# — command errors and exceptions. As you can see from the updated code sample, we're checking the Streams property of the PowerShell object to see if any command errors were generated. The errors we find in here will be related to invalid logic, or errors related to using bad parameter values. We've also added a try-catch block used to capture any exceptions thrown by our command. Any syntax errors, or calls to non-existent cmdlets, can be handled in the catch block.

Keep in mind that many of the on-premise cmdlets you're used to may not be available in the cloud. For example, server based cmdlets, such as Get-ExchangeServer, will not be visible since Exchange Online is a hosted solution. Take a look at the Reference to Available PowerShell Cmdlets in Exchange Online to get an idea of which cmdlets are available to you in the cloud.

Xbox MVPs Come to Seattle to Play at PAX!

$
0
0

Last weekend, Xbox MVPs were out in full force at the Penny Arcade Expo (PAX) in Seattle. This three-day game festival for tabletop, videogame, and PC gamers offered a host of dedicated tournaments and freeplay areas. Gamers could also take in panel discussions, a weekend-long HaloFest event, and an exhibitor hall filled with booths displaying the latest from top game publishers and developers. Many Xbox MVPs attend this event because of the amazing content and opportunity to network with other people who know their stuff when it comes to games.

So, what does a day of an Xbox MVP at PAX look like? To find out, we pulled together some of the blog and twitter posts from MVPs at the event—now you can experience the excitement for yourself!


MVPs post on PAX: Take a look!

MVP Zach Wigal @zachwigal

Gamers Outreach collects game donations for troops and raises money for charity initiatives during HaloFest – HaloFest Recap -Read more

 

MVP Chris Brown @leftybrown

Married Gamers Podcast #222- Infinite Respawn: How Gaming Can Keep and Save Relationships -Read more

 

MVP Ed Webb @kinecticon

Kinecticon PAX debrief – Back from PAX, a little Halo and a lot of prognostication -Read more 

 

MVP Nick Puleo @nickpuleo

Co-Optimus Review – Borderlands 2 Eyes on Impressions -Read more

Co-Optimus Impressions and Interview  – Renegade Ops Impressions and Interview -Read more

 

MVP Daylon Furlough @deaconmvp

Unscripted 360 Review - Batman: Arkham City, Hands on at PAX -Read more

Unscripted 360 Review – Battlefield 3, Exclusive Hands on report Furlough -Read more

Unscripted 360 Review - Get Warped on Warp -Read more

Unscripted 360 Review – All Zombies Must Die!...better them than me! -Read more

Unscripted 360 Review – Ears on with Plantronics X95 and 777 -Read more

Unscripted 360 Review - Check out the Halo Fest invitation and cake! -Read more

 

Our #FF MVP Twitter Feed for PAX: It’s just like you’re there!

Day 1

NickPuleo

There's a few  people waiting to get in. #pax

DjDATZ

Well well SeaTac, we meet again finally.

Dangerdoll

Sooooooo many games , so little time :-/ #PAX

NickPuleo

Free Halo Mega Blocks sets at Halo Fest. #pax

NickPuleo

I think I'm more excited for the new Counter-Strike game than I realized. The booth is just

packed and the game looks great.

litheon

Made it down to PAX. Checking out Halo Fest right now.

NickPuleo

Renegade Ops is going to be a ton of fun in co-op. Love the destruction.

litheon

Waiting in line for Dance Central 2. Looks like they have more songs that the last time I played it!

NickPuleo

Dance Central 2 has slap bracelets for swag. So awesome.

litheon

They're giving these slap bracelets away at the Dance Central 2 booth.

litheon

Forza 4 is looking and playing great. If you're at PAX you should check it out. The line is virtually

non-existent.

DjDATZ

At the @XboxSupport panel, but I'm worried about my Xbox 360 being broken! Ha! #trolling

litheon

Just rocked some GoW3 Horde mode. It plays great, really stoked on it to come out next month.

DjDATZ

And a minute after that tweet, @XboxSupport mentions trolls. Uh, #winning.

NickPuleo

Getting some serious playtime with BF3. Can't wait for this.

NickPuleo

At the Sarcastic Gamer extra life party. Then?

NickPuleo

Back at the room. Decompressing.

 

Day 2

NickPuleo

Nice breakfast view.

NickPuleo

Just got a ton of great footage of con goers answering questions about co-op games.

DjDATZ

Just played Warp, definitely a game to look out for on XBLA!

Dangerdoll

About to school @johnnystorm73 on some Dance Central 2!! #PAX

NickPuleo

At a Creole restaurant with the #cogpax folks.

Dangerdoll

Wow!! Day 2 PAX is done. What a day! :-D

litheon

Called it an early night due to a long day, but pretty stoked on a final day of PAX

epicness tomorrow.

 

 

Day 3

 

Dangerdoll

I l<3ve to dance! Thanks to ALL of my gamer family 4 cutting a rug with me. It's

always a pleasure to see you :-D #PAX

Dangerdoll

Day 3, LET'S GO!!!! :-D #PAX

litheon

Made it to PAX before the expo hall opened. I'm pretty sure this is the first time

I've done that in 4 years of coming to PAX.

DjDATZ

Damn, Borderlands 2 looks like it's gonna be an awesome game!

DjDATZ

Made it to @PoDog. Now to see what all the fuss is about...

litheon

Super awesome flight! Played Munchkin, talked Gears, Halo, and CoD with some

fellow PAX attendees!

DjDATZ

Up and leaving our hotel. Sadface that PAX Prime is already over. :(

DjDATZ

Already missing everyone from PAX. :( Wish we could just do a week long gamesfest

where everyone could just enjoy eachother's company.<3

Dangerdoll

W00tz! PAX11 was such a blast. Thanks to all involved in making it so. Huggles to all

my gamer fam & friends. #youfolksrock #Nowboarding

 

 

 

Did You Miss This Top MVP Guest Post On SharePoint Governance?

$
0
0

Editor's Note: Before we kick off our MVP Developer Series starting next Monday we'd like to pause and celebrate one of our most popular guest posts from our previous series. The following is a re-post of guest post by SharePoint Server MVP Kanwal Khipple on June 13, 2011 as part of the MVP Award Program Blog's "MVPs for SharePoint" series.

Kanwal Khipple, is a Principal SharePoint Architect for BrightStarr. Kanwal focuses on designing adoptable solutions using SharePoint.  Kanwal lives in Toronto, Canada and you can find him tweeting, buzzing and blogging on his personal blog. Connect with him on LinkedIn to learn how you can quicklystart getting ROI for your SharePoint Intranet.

Be sure to check in next Monday for new content from our MVP Developer Series!

Congratulations, your company adopted SharePoint! You are now one of the hundred million plus licensed users that are using SharePoint within your organization. In one form or another, many of you reading this blog are now responsible for maintaining SharePoint.

As Uncle Ben said, with great power comes great responsibility. The same is true for SharePoint: as the adoption of SharePoint increases within your organization, it can get out of control if proper governance is not in place.

Follow along as I go through practical SharePoint Governance Tips for Everyone:

What is Governance?

In order to understand what Governance is, it’s important to know its origin - the word governance comes from the Latin word to steer.

Governance is the set of policies, roles, responsibilities, and processes that guide, direct, and control how an organization's business divisions and IT teams cooperate to achieve business goals.

The goal of this post is to help you understand how leveraging SharePoint features effectively can help you govern your SharePoint site. Here are my tips on how to steer (govern) your SharePoint environments to stay on course. These tips leverage out of the box features and assist you in implementing Governance in SharePoint 2010.

Rethink Folders and Leverage Metadata

Folders are a familiar way to organize documents especially if you’ve used file shares or even your local hard drive. The problem with file shares is that we all have our own approach for how documents should be organized. When migrating their file shares to SharePoint, many organizations inadvertently don’t rethink their use of Folders and leverage Metadata.

The problem with folders is that you are assuming you know today how you want to see your content tomorrow. You are also forcing one structure of organizing documents. Instead, consider using SharePoint columns – otherwise known as metadata.

Metadata is often described as data about data. Here’s how I like to explain metadata:

Take a good look at your favourite book’s cover. The Front cover usually includes
the title of the book, sub-title, publisher, author(s) as well as an image to
describe what the book is about. At the back of the book you will have a
summary of the book as well as some review quotes.

This usually provides you a 10,000 foot high view of what the book is about. As the front and back cover, together provided you enough information about the book to make a purchase.

Out of the box, SharePoint automatically captures the following metadata for you:

  • Created By – the authenticated user that created the document in SharePoint
  • Modified By – the authenticated user that last modified the document in SharePoint
  • Created (date time stamp) – the date and time when the document was created
  • Modified (date time stamp) – the date and time when the document was modified

Take this a step further and capture additional metadata from users when they upload and work on documents.

How to Create a New Column

Here’s how you go about creating metadata for your document library:

  1. Browse to your SharePoint document library
  2. From the Fluent Ribbon, click on Library Tools > Library toolbar
  3. Click on Create Column in the Manage Views group

 

4. In the Create Column dialog box, specify the Name, Type as well as Additional
    Column Settings

You can repeat these steps to capture additional metadata about each document that is uploaded. Users will be able to quickly filter document libraries based on this metadata and for popular filters you will be easily able to create views for everyone to use. This will help everyone understand the document contents whether they have worked in your organization for the past 20 years or just joined. The goal really is to improve findability.

Metadata is better for organizing as it allows you quickly see what content is
available, gives users the ability to filter / sort on the fly, create views with the Group By option as well as improves search engine results. And that’s just the beginning.

Simplify SharePoint Management

There’s a fine line you have to walk between allow your employees working freely or putting too many restrictions on the level of access they have. Many organizations, provide their users the ability to create their own site collections for collaborating on a project together by giving them self service features. With SharePoint 2010, you now can configure notifications and automatic deletion of site collections that are not being used.

Follow these steps to configure to Site Collection Use and Auto-Deletion settings:

  1. Log in as a Farm Administrator to SharePoint Central Administration
  2. Click Application Management link

3. In the Application Management page, within the Site Collections
    section, click Confirm site use and deletion.

4. In the Site Use Confirmation and Deletion page, within the Confirmation
    and Automatic Deletion Settings
section, you have the following options:

Configure Email Notifications - Select or clear the Send e-mail notification to owners of unused site collections check box. . If you select this check box you can configure how frequently you want to send
notifications:

Type the number of days (minimum of 30 days and a maximum of 365 days) after the site creation or after the site usage is confirmed

Configure Email Notification Schedule - Specify a daily, weekly, or monthly schedule for e-mail notifications. The default schedule is daily. You can also specify the exact time (default time is 12:00 AM) to run the check for the site usage.

Configure Automatic Deletion - Select or clear the Automatically delete the site collection if use is not confirmed check box.

If you select this check box, type the number of notifications (default is 28 notifications) to send before the site collection is deleted.

Additionally, with SharePoint 2010 Service Pack 1 (SP1) being released at the end of this month, you will want to check
out the new Site Recycle Bin functionality which will allow administrators to quickly and easily recover site collections and sites accidentally deleted by their owners in a process similar to that of the Recycle Bin we have for Lists, Libraries, and Documents. If you can’t wait for the end of the month, then consider downloading the open source project SharePoint Site Recycle Bin.

What Are Your Practical SharePoint Governance Tips?

Creating columns to leveraging metadata appropriately and configuring site collection use and auto-deletion settings are some of my favourite practical Governance tips. To keep this post concise, I have posted a few more practical SharePoint Governance tips on my blog.

The good thing is that governance does not have to be complicated, it’s the little things that can make the difference. Your governance plan will organically grow over time. It’s a set of rules that your organization will manage over time.

Now I’d like to ask you, are you already using these SharePoint features? If so, what’s your experience. For the benefit of everyone reading this blog, what are your favourite practical SharePoint tips? Comment below!

Governance Resources

New Book Brings Together More than a Dozen MVPs

$
0
0

A new book on discovering and understanding the Microsoft .NET 4 Framework has special meaning to our community. Real World .NET 4 and C# is a collaborative project created by real-world experts—in fact a whopping 15 MVPs contributed to its making.

 

Each MVP wrote a chapter, drawing from a particular area of expertise to provide valuable information on using various .NET 4, C# 4, Silverlight 4, and Visual Studio tools in real world applications. They cover topics such as Windows Presentation Foundation, Silverlight 4, Windows Communication Foundation, ASP.NET performance, and the entity framework.

Here’s an inside peak at the contents:

  • ASP.NET and jQuery, by C# MVP David Giard
  • ASP.NET Performance, by Visual Basic MVP Bill Evjen
  • Ethical Hacking ASP.NET, by Sharepoint MVP György Balássy
  • How to Build Real-World Silverlight Applications, by Silverlight MVP Gill Cleeren
  • Silverlight: The Silver Lining for Line-of-Business Applications, by Silverlight MVP Jeremy Likeness
  • JumpStart …., by Silverlight MVP Daron Yondem
  • MVVM Patterns in Silverlight 4, by Client Application Development MVP Kevin Grossnicklaus
  • Windows Phone Codenamed “Mango for Silverlight Developers, by Silverlight MVP Alex Golesh
  • Pragmatic Services Communication with WCF, by Windows Azure MVP Christian Weyer
  • Securing WCF Services Using the Windows Identity Foundation (WIF), by Development Security MVP Dominick Baier
  • .NET Parallel Programming with Task Parallel Library, by BizTalk MVP Jeff Juday
  • The WF Programming Language, by retired Solutions Architect MVP Vishwas Lele
  • Practical WPF Data Binding, by C# MVP Christian Nagel
  • Driving Development with User Stories and BDD, by ASP.NET\IIS MVP Scott Millett
  • Unit Testing, by Caleb Jenkins ASP.NET\IIS

Congratulations to all the contributors!

 

Using MVC as a REST Service that is Accessed by jQuery/JavaScript

$
0
0

Editor's Note: On September 13, 2011 Microsoft will kick off its  first ever Build event. To toast this, the MVP Award Program blog will run a special developer series for the next few weeks for our MVP Mondays. The following is the first of this series, a guest post by Visual FoxPro MVP John Petersen.

John has been developing software for 20 years,starting with dBase, Clipper and FoxBase + thereafter, migrating to FoxPro and Visual FoxPro and Visual Basic. Other areas of concentration include Oracle and SQL Server - versions 6-2008. John is the Philadelphia Microsoft Practice Director for CEI America (www.ceiamerica.com), a Microsoft Gold Partner. From 1995 to 2001, he was a Microsoft Visual FoxPro MVP. Today, his emphasis is on ASP MVC .NET applications. He is a current Microsoft ASP .NET MVP. John was a co-author of Visual FoxPro Enterprise Development from Prima Publishing with Rod Paddock, Ron Talmadge and Eric Ranft. He was also a co-author of Visual Basic Web Development from Prima Publishing with Rod Paddock and Richard Campbell. In 2004, John graduated from the Rutgers University School of Law with a Juris Doctor Degree. He passed the Pennsylvania and New Jersey Bar exams and was in private practice for several years.  Read John’s developer blog or follow him on Twitter.

You have heard it before that ASP MVC is “inherently RESTful.” But what exactly does that mean? In this blog post, I’m going to quicklyintroduce you to what REST is, why ASP MVC is “inherently RESTful” and how to retrofit your ASP MVC applications to expose their RESTfulness. To illustrate the concepts, I will be using the NerdDinner exemplar ASP MVC application that is available on CodePlex.com: http://www.nerddinner.codeplex.com/. The client used to demonstrate these capabilities will be simple HTML pages using jQuery. You can download jQuery from http://www.jquery.com. As of this post, the current released version is 1.6.2 which can be found at http://code.jquery.com/jquery-1.6.2.min.js.

What is REST? 

REST stands for Representational State Transfer and it is a method for retrieving content from an HTTP endpoint. REST is not new having been around since HTML 1.0. The World Wide Web itself is the largest REST example. A server is at rest, waiting for a request. A client invokes a request from a resource that is identified by a Uniform Resource Locator (URL).  At that moment, the server is no longer at rest as it invokes the actions that are defined in the URL. The request is processed and returned to the client. The server goes back to its restful state.  REST’s most notable feature is that it is stateless. In other words, each call has all the necessary information for the server to process the request. These kinds of requests are known as HTTP GET requests. This is not to say the server can’t hold and manage state. We do this all of the time with sessions in IIS. Most of the time, when we make requests, the response is a combination of HTML markup, CSS, script (JavaScript/jQuery) and data. It’s all combined and presented in a browser, whether it is on your desktop, laptop, tablet or phone. If this is the only way to present your information, several limitations result. For one thing, you data presentation is locked into a specific implementation. It’s still RESTful, but from a separation of concerns standpoint, you have the classic monolithic application problem wherein your application is difficult to maintain, is not flexible, not amenable to change, etc. It’s far better to tease your application apart and a good way to start is to expose endpoints that just serve data. Let’s examine the Nerd Dinner application to see how we can achieve that goal.

ASP MVC and Nerd Dinner

If you have worked with ASP MVC, you are likely aware of the Nerd Dinner application which highlights the major features of ASP MVC. The problem domain is simple, we can create events for people to attend and people can RSVP. Creating and RSVP’ing to a dinner requires that you be logged into the application. Authentication is beyond the scope of this post. Matters concerning authentication will be addressed in a subsequent post. In this post, we will concentrate on two functions the Nerd Dinner Application supports: finding dinners near a certain locale and finding all upcoming dinners. The following illustrates the Nerd Dinner Application’s ability to find all upcoming dinners:

In MVC parlance, the Dinner Controller’s Index() action is invoked. The following is the code for that action:

The /Dinners/Index action returns a view that is made up of zero or more dinners. If no parameter is passed, a view that contains a paginated dinner list is returned. Just like Bing, this is a RESTful call. But what if all we want is the data? It would be nice if we could pass a URL like this: /dinners.json. As it turns out, some of this functionality is already in Nerd Dinner. If you review the search controller, you will find a GetMostPopularDinners action. In that action, you will find code that reformats the dinner model into a new structure and serializes the data as jSON. To give the Dinner’s controller that capability, we will copy the private jSonDinnersFromDinner method (with a slight modification) into the Dinners Controller (this of course is not DRY! I’ll leave it to you to refactor!!!)

Adding a Route

What an ASP MVC application can respond to is dictated by what is contained in the routing table – which is hydrated in the global.asax file. In order for Nerd Dinner to recognize the .json extension, we need to add the following code in the RegisterRoutes function in the Global.asax file: 

Now, the application will recognize /dinners.json. Further, this route will not interfere with the other routes that are already established. We haven’t yet modified the controller, so the same view will still be rendered. Let’s fix that up now.

Modifying the Controller

First, let’s add a slightly revised version of the private JsonDinnerFromDinner method to the Dinner Controller:

Instead of having the dinnerid as the URL, we will use the full address. Remember, this data may be consumed by a page that is not part of the same domain. In jQuery/JavaScript example that follows, the Nerd Dinner MVC Application is going to be treated as an HTTP endpoint – just like Bing. We need to outfit the data accordingly.

Now that we have the ability to format the dinner object properly, let’s turn to the Dinner Controller and add a new JsonDinners Action:

The new route allows the ASP MVC app to respond to the /dinners.json request. The new JsonDinners() action supports that request. Note, there is a check to make sure the request is in the form of /dinners.json and not /dinners/JsonDinners. In the event the latter form is used, the controller will simply redirect to the index action. Now, when /dinners.json is invoked, the following data stream will be returned:

[{"DinnerID":71,"EventDate":"\/Date(1318719600000)\/","Title":"Philly
Code Camp Nerd
Dinner","Latitude":0,"Longitude":0,"Description":"Nerd
Dinner to celebrate another successful code
camp","RSVPCount":1,"Url":"http://localhost:48202/71"}]

Accessing MVC Data with jQuery/JavaScript

With a RESTful endpoint that serves up data, let’s put together a simple page that consumes the data:

In this example, the MVC application is being treated as an endpoint. jQuery is loaded from the Microsoft Ajax CDN. Once jQuery is loaded, we can then invoke jQueyr’s getJSON() method. Not the URL that is passed: http://localhost:48202/dinners.json. That is the new endpoint we created in the Nerd Dinner application. There are no parameters being passed (but we could easily outfit the method to handle parameters). The third parameter is a call back function. In this example, the jQuery each() function is invoked to cycle through the dinners. For each dinner, a link (wrapped in a p tag) is created and is appended to the dinnerData div. 

Clicking a dinner link will invoke the Dinners Controller Details action, passing the dinner id that was used to construct the link. So then, how far can we go with this? The simple answer is that you can go as far as you want. With an exposed RESTful data endpoint, the dinner data can be more easily consumed by other applications. A good example of where this already occurs in the Nerd Dinner application is the facility that loads the map when the Nerd Dinner page first loads. The best way to understand what is going on is to add a few break points to the NerdDinner.js file located in the /Scripts folder. The following illustrates where you will want to place the breakpoints.

This scenario is not much different than the first example. A request is made which renders jSON data. In this particular case, a POST as opposed to a GET is used. Like the first example, jQuery is used to cycle through the data. In this example, the data is used to apply the map points. When you hover the mouse over a point, details regarding that event are displayed.

Conclusion

As you have learned, ASP MVC is inherently RESTful and it is relatively easy to set your applications up to take advantage of that feature. Even if you didn’t do so from the start, because of ASP’s MVC architecture, it is not difficult to retrofit your applications to expose endpoints that serve up data in either jSON or XML format. Once your application  serves up data in this way, technologies like jQuery and JavaScript can leverage that data. Further, it comes easier for other applications to consume your application’s data. Another good example of a RESTful API is Bing. Check out the Bing Developer Center: http://www.bing.com/developers. Applying these same concepts, jQuery and JavaScript can easily consume the Bing search results. In an upcoming post, I will discuss how to retrieve/update secured data that requires you to be authenticated.

BUILD Day #1 in Review According to MVPs

$
0
0

BUILD: Day 1

Yesterday was the first day of Microsoft’s BUILD conference in Anaheim, California. Thousands attended in person and many more tuned in online to see the detailed preview of the next major Windows release codenamed “Windows 8.” Since nobody knows the real-world impact of Microsoft products on the community like MVPS—we’ve started gathering a sampling of their blog posts and tweets as they experience BUILD. Take a look!

Blogs

Mike Halsey: Windows Expert MVP

Windows 8 Developer Questions Answered

Windows 8, Much More than Metro

 

Jeremy Likness: Silverlight MVP

Windows 8 and Build Day 1 Keynote Thoughts

 

Michael Crump: Silverlight MVP

Bullet Points from Build-Day 1 and my thoughts

 

Ward Bell: Silverlight MVP

The BUILD Report #1: Sinfosky Keynote

 

Rob Zelt: ASP.NET\IIS MVP

Build Windows- Now We Know

 

Laurent Duveau: Silverlight MVP

The Wait is over

 

Chris Klug: Silverlight MVP

Build Windows Keynote Thoughts

Build Windows Day One Done and Dusted

 

Aidan Finn: Virtual Machine and Systems Administration MVP

Build Windows 2011: Keynote

Build Windows 2011: 8 Traits of Great Metrol Style Apps

First Impression of the Windows 8 Slate… with Hyper-V

 

Tweets

We asked MVPs who were attending BUILD and wanted to be included in our MVPs at BUILD 2011 twitter list to tweet #bldwinmvp or let us know @MVPAward. The result? A list of 95 MVPs at the conference tweeting about their thoughts, questions and feelings about all things BUILD. Here are a few of our favorites that really highlight BUILD so far:

MVP Tweet
Jeremy Thake #bldwin keynote filling up! Lots of excited geeks awaiting Microsoft's vision for the future of PC @ //build http://instagr.am/p/M_Bjc/
Christian Nagel Windows 8 is the reimagination of Windows, but everything that runs on Windows 7 runs on Windows 8 #bldwin
Laurent Bugnion OK that is sweet! Picture login screen for Windows 8, press on 3 areas of a picture to log in. #bldwin
Miguel Carrasco New start menu / desktop is incredibly beautiful. "Start Screen" is a unification of desktop, start, notifications, etc. Highly customizable
Rob Zelt Everybody's default win8 password is going to be head, shoulders, knees and toes? #bldwin #photopassword
Miguel Carrasco The entire interface is very minimalistic. I have to say it looks very clean and modern. #bldwin
Miguel Carrasco "Is there anything better than a "Chrome Free" browsing?" - Steven Sinofsky - Browser in Windows 8 has no chrome at all.
Manan Kakkar SPELLCHECK THROUGHOUT THE SYSTEM & AUTO CHECK! Windows 8, you've changed everything. #bldwin
CaffeinatedGeek Settings sharing across devices very interesting. Especially for us geeks with many devices. #bldwin
Steve Smith Having better app to app communication in #win8 is exciting. Moving beyond clipboard for app comms will be awesome
Miguel Carrasco Bold Move: All Metro Style Apps are written with any language you want. C, C++. C#, VB, JavaScript, HTML/CSS. #bldwin
Miguel Carrasco Let me say that again (for developers): .net is NOT .dead. You pick whatever language you want! #bldwin
Miguel Carrasco Microsoft essentially just brought .net to the slate party, leapfrogging iOS platform, dev tools, and user experience in a major way #bldwin
Bruce Johnson Big win!!! RT @andrewbrust: Expression Blend will now work with HTML5/CSS as well as XAML.
Steve Smith Yay for app store in windows, with easy access from visual studio. Finally. #Bldwin
Todd Anglin Deploy HTML apps to Windows Store directly from Visual Studio. #bldwin
Matt Milner Microsoft dev tools are hands down the best. Development on win 8 looks fun and great  tool support. #BldWin
Shy Cohen Publishing
  an app on the Windows Store is like waiting for Pizza :) #bldwin
Miguel Carrasco Microsoft is being completely transparent on the app approval process. Huge win vs: Apple's controlling model. #bldwin
Miguel Carrasco
Personally, I think Expression Blend is the dagger through Apple and Androids platforms.  #bldwin Designers will have complete control.
Roberto Hernandez
All this HTML5 and Javascript has me smiling ear to ear! #bldwin #bldwinmvp
W. Kevin Hazzard
XAML says, "Rumors of my death have been highly exaggerated." #bldwin #mvpbuzz
Miguel Carrasco
400 Million devices you can target when Windows 8 launches. That's a lot of eyeballs. A platform that can't be ignored. #bldwin
Shy Cohen
Immediate boot! Hearing about it is one thing, but seeing it is just wow! #bldwin
Dan Holme
Microsoft has succeeded in something it's never done before... Kept a secret and done a reveal! Big big stuff! Great job MS! #bldwin
Vasu Jain
A reply to Macbook Air ? Superthin Acer Notebooks with Windows 8 #bldwin
Martina Grom
and now they will introduce and announce......the samsung slate #bldwin they made 5000 for all attendees
Shy Cohen
Keyboard
  support in the new Metro UI is even better than in Win7. Impressive #bldwin
Rick G. Garibay
#win8 is the 1st platform I've seen that lets you both play *and* get real work done with seamless transitions btw the two. Lines blurred.
David Pallmann
All I can say is WOW!!!!!!!! My high expectations were EXCEEDED! #bldwin
Anthony Borton
The @bldwin keynote did not disappoint. At first glance it appears MS have done a great job of Win 8. Looking forward to using it tonight.
Raffaele Rialdi
As far as I could see the beginnong of this Win8 story is stunning and awesome #bldwin. Platform is back!!!
Rick G. Garibay
Metro really is an evolution. It is the window through which our children will see the world. #bldwin
Josh Santangelo
~5,000 nerds stampeding for free unreleased hardware, beer, and pizza is more than a little terrifying. #bldwin
Jeremy Thake
It's like Xmas came early. Woot! Kid in a toy shop! Free windows 8 slate!!! #bldwin http://instagr.am/p/NBOBg/
W. Kevin Hazzard
My first tweet from my Windows 8 Samsung slate. So glad I didn't give in and get an iPad. Windows 8 FTW.
Miguel Carrasco
The future of computing has arrived, here is the one device to rule them all: yfrog.com/h0ypufbj #bldwin

 

And for those of you who are interested in a more comprehensive experience, we’ve included a more complete stream from our twitter list below.

 

 

Stay tuned the next couple days for more on BUILD from the MVP perspective!

 

BUILD Day #2 in Review According to MVPs

$
0
0

Big announcements about the reimagining of Windows continues to pour out of the Microsoft BUILD conference on day 2, and MVPs are right in the middle of it. We’ve been watching their blog posts and tweets so you can get a front row seat to see what these community leaders have to say about the news coming out of Anaheim.

Also, check out the review of Day 1 at Build According to MVPs.

Blogs:

David Pallmann: Windows Azure: Architecture MVP

Live from the BUILD conference- Windows 8

 

Raffaele Rialdi: Developer Security: Development MVP

Deep Diving WinRT and Metro Style Apps for Windows 8

 

Mercel de Vries: Visual Studio ALM MVP

Microsoft Build Conference Day 2, Metro Style Apps API has Natural Feel for all Developers

 

Louis-Guillaume Monrand: MVP

How to get back the Windows 7 Start Menu in Windows 8

 

Gregory Renard: Windows Azure: Architecture MVP

//Build/ Windows 8 : Microsoft galope sur le chemin de l’évolution et non de la révolution !

 

Roberto Brunetti: MVP

Windows 8: User Experience

 

Jeremy Likness: Silverlight: Architecture

Windows 8: What you Need to Know

If Silverlight is Dead…

 

Chris Klug: Silverlight MVP

Build Windows Day 2

Windows 8 Feature Charms

Windows 8 Feature- Roaming Data

The Windows 8 Developer Story According to Me (at the Moment)

 

Aidan Finn: Virtual Machines: Systems Administration MVP

Build Windows 2011 Windows Server 8 Keynote

Build Windows: Windows 8 Server

Using Windows Server 8 for Building Private and Public Clouds

A Deep Dive into Hyper-V Networking

Refresh or Reset Window 8

 

Tweets

We asked MVPs who were attending BUILD and wanted to be included in our MVPs at BUILD 2011 twitter list to tweet #bldwinmvp or let us know @MVPAward.

Here are some of our favorites from Day 2 at BUILD:

MVP

Tweet

Miguel Carrasco

The most exciting thing about Windows 8 Slate devices is the incredibly powerful development
  environment. #bldwin

Bruce Johnson

I already love the find matching code feature in VS11 #bldwin

Robert Hogg

WOW visual studio 11 imaging and graphics has moved kicking and screaming from the 1980's with great image and 3D editors #bldwin #nomorebmp

Shy Cohen

Awesome, awesome, awesome! Connecting the client rendered view to the code that generated it! Can't wait to get my hands on this! #bldwin

Shy Cohen

OMG! Its gets better and better! Minified and bundled versions of scripts and CSS by convention! #bldwin

Todd Anglin

Today's #bldwin keynote is like cool, refreshing lemonade for the .NET developer. Gets you excited about .NET again.

Miguel Carrasco

Showing user stories, sprints, sprint planning, tasks, teams, task board, how to run a stand up meeting. #bldwin Awesome demo!

Maarten van Stam

Golden Tickets for TFS Azure services available for //Build attendees #bldwin

Steve Smith

Move virtual machine storage location while it is running with no downtime in win server 8 #bldwin

Dennis Vroegop

Can't wait to start using TFS in the cloud. It will make life so much easier. #bldwin

Manan Kakkar

Password Vault in Windows 8—great addition! Synced auth! looks like that Windows Vault thing is  finally *something* #bldwin

Rick G. Garibay

Yes, that wooho on #appfabric #ServiceBus was me :-) #BldWin

Miguel Carrasco

West Coast Customs in the house... have you ever imagined a dream car that ha augmented reality  right in the front windshield? #bldwin

Manan Kakkar

Microsoft just turned the nerd alert to a whole new level with West Coast Customs on stage. #bldwin

Aidan Finn

#SURPRISE Steve Ballmer comes out

Kevin Griffin

Oh snap...

Manan Kakkar

we missed you Steve! #bldwin

RobinDotNet

Wow Over 500k downloads of windows 8 last night. Amazing.

Chris Woodruff

I may be called MSFT fanboy but I am very excited to be a developer that primarily uses .NET. I want to make great solutions & will #bldwin

Todd Anglin

The #bldwin masses are flooding the expo, armed with questions for MSFT http://twitpic.com/6kvhwq

Chad Campbell

If you've been writing WP7 apps, it looks like those skills will translate swimmingly to Windows 8

Miguel Carrasco

Make the function beautiful! Strip it down to nothing, and then make it beautiful! #bldwin

Jennifer Smith

Loving Joe Stegman's session on xaml. Approaching on a level that everyone can understand.

Miguel Carrasco

Pride in craftsmanship, Be fast and fluid, Authentically digital, Do more with less, Win as one! #bldwin

Todd Anglin

Windows Phone team is creating CSS skins for jQuery Mobile that look WinPhone native. #bldwin

Rick G. Garibay

#Server8 The power of many servers, the simplicity of one. #bldwin

Peter Ritchie

Just did interview with my friends at @DevExpress about all the good stiff we've seen so far this week #bldwin #BldWinMVP

Jim Wooley

Windows 8 is about no PC left behind. -Joe Stegman #bldwin

Aidan Finn

Automatic classification of data for dynamic access control is serious business reason for Windows Server 8!!!! #bldwin #bldwinmvp

Raffaele Rialdi

You could never imagine guys. This Win8 stuff is huge and terribly cool #WinRT #bldwin

Walt Ritscher

You know how people take pics of session screens with their phones? This morning I saw dozens of  ppl taking pic with their new win8 slates.

Miguel Carrasco

I love that Blend designer is now incorporated right into Visual Studio! #bldwin

Evan Hutnick

@miguelcarrasco We've been keeping quiet about that one since the MVP summit :) #bldwin

Kate Gregory

Went quiet because i am massively engaged with C++ content in packed rooms. Small break between sessions to say "wow!" #bldwin #happycamper

Jeremiah Morrill

Microsoft has out done themselves with c++/com. Amazing! C# should have little complaints about moving over.

W. Kevin Hazzard

As sad as I was when @devhawk left the DLR team I fully understand why he was THE perfect choice on the WinRT team. This changes everything.

Evan Hutnick

After this little Xaml revolution at #bldwin I seriously need to get my website up. You'll see why, have had domain for two years :D

wwoombile

In love with CSS3 #bldwin

DerikWhittaker

So with Win8 I am no  longer just a .net dev I am also a WinRt dev. more resume candy #bldwin  #bldwinmvp

Fabien Lavocat

I'm creating my first application for Windows 8 :) #proud #bldwin

sevensteps

ok, decided. not going to the #bldwin party. 1) didn't sleep last night. 2) win8 app almost done, just another couple of hours. Almost there

Vasu Jain

Within a single day of announce of developer preview of Windows 8, it has more users than Mac OS X Lion .. #bldWin

 

And for those of you who really want to experience the full effect of this event you can find a more complete set of tweets here:

 

 

 

 


BUILD Day #3 in Review According to MVPs

$
0
0

As the BUILD conference comes to a close, MVPs and other attendees are diving deeper into what the game changing announcements from the last couple of days really mean. We’ve captured some of the impressions from MVPs on Day 3 of BUILD so you can get these independent experts' point of view on the impact of Microsoft’s reimagining of Windows.

Also, check out our Reviews of Day 1 and Day 2 according to MVPs.

Blogs

Chris Klug: Silverlight MVP

Choosing Technology for Windows Development

 

David Pallmann: Windows Azure: Architecture MVP

Live from the BUILD Conference – Windows Server 8

 

Mike Halsey: Windows Expert- Consumer: Author MVP

Should you reinstate the Start Menu in Windows 8?

 

Ian Griffiths: Client App Dev MVP

Real Native WinRT Development

 

Gregory Renard: Windows Azure: Architecture

//Build/ Windows 8 : Quid du développeur … WinRT, Win32 ou .NET ?

 

Xamalgeek: Silverlight MVP

Follow up on //build

Windows and the new Metro UI

Dual boot with Windows 7 and Windows 8 (VHD)

 

Aidan Finn: Virtual Machine: Systems Administration MVP

Windows 8 Metro UI Internet Explorer 10 is Plugin Free Zone

How Many MICs for Clustered Windows Server 8 Hyper-V?

Looking Back on day 3 at Build Windows … Plus More!

Designing Systems for Continuous Availability – Multi-Node with Remote File Storage

Designing Systems for Continuous Availability – Multi-Node with Block Storage

Designing Systems for Continuous Availability and Scalability.

Enabling Multi-Tenancy and Converged Fabric for the Cloud Using QoS

Platform Storage Evolved

 

Tweets

And here are some tweets that highlight the excitement MVPs are experiencing at BUILD pulled from our MVPs at BUILD 2011 twitter list.

MVP

Tweet

Walt Ritscher

holy wow! The graphics tools in VS11 are fricking awesome. The shader visualizer is a new way of generating HLSL.

Maarten van Stam

what is new in .NET 4.5, room was full in no time... lot of interest with devs as it seems.#bldwin

Sasha Goldshtein

So you can build drivers in Visual Studio. Serious WOW moment!! #bldwin

Evan Hutnick

Still waiting for the "Oh Snap" reference from a presenter talking about the Metro Snap feature :) #bldwin

Walt Ritscher

Wow, watching a new XBox game running 60fps on a standard laptop. Very smooth. XBox live for windows 8 #bldwin

Miguel Carrasco

I can't believe how fast Windows 8 boots. Seriously ridiculous.. Less than 2 seconds. From off...From off...

Dennis Vroegop

They made incorporating the search charm really easy. My data will be so much more useful with this technology #bldwin

Miguel Carrasco

"Everyone can make an App that is a share source. Other Apps can be targets and consume sources" #bldwin

Tony Champion

I have collected almost 60k tweets from #bldwin this week. Writing some search/filtering features so I can get a #pivotviewer running.

Miguel Carrasco

Learning about the "Devices" charm. Makes talking to devices extremely easy to use.

Raffaele Rialdi

There are even more updates almost ready after vs 11 release. i love continuous releases

Alex Thissen

Really cool: production debugging of ASP.NET web applications with IntelliTrace. Can be done from/on USB stick if you want to.

Marques Lyons

The "Windows 8 Update" site has some great pictures from yesterday's BUILD Blogger Bash. Check em out. http://bit.ly/qVZstM #bldwin

Jeremy Thake

Ask the experts was awesome, just had questions answered by Azure team on WF! Happy camper! #bldwin

 

And for those of you who want to fully immerse yourself in the MVP experience at BUILD, you can find a more complete collection of our MVPs at BUILD 2011 twitter list below.

 

 

 

 

Getting Started with the Silverlight 5 Release Candidate

$
0
0

Editor's Note: The Following is a guest post by Silverlight MVP Michael Crump.

Introduction

The final release of Silverlight 5 is coming up shortly, but that does not mean that we cannot go ahead and get our feet wet with the recently released bits. The release candidate was announced on September 1st, 2011 and is freely available to download right now. I personally consider this an important release and it adds many improvements including XAML Debugging, Multiple Windows Support, Linked Text Containers, 3D Graphics and much much more.

Today, I will show you where to download the bits and highlight several important features of Silverlight 5 that I think business developers would benefit the most from. By the end of this article, you should have enough information to go ahead and get started building your first Silverlight 5 Application.

Before we get started downloading the tools, I wanted to point out some a webinar that I recently did for Silverlight Show titled “Getting Started with Silverlight 5”. Several people have emailed me and found it useful for their learning and I hope you are able to get something out of it as well.  

Source Code

The source code to all samples provided in this article and more can be found here.

Getting Started

Let’s go ahead and get started by downloading the tools needed to build a Silverlight Application. I would like to point out that before we get started that you can install the beta on top of the final release of Silverlight 4.

  • Visual Studio 2010 SP1 or Visual Web Developer Express 2010 SP1 is required to develop Silverlight 5 Applications.  Visual Studio 2010 SP1 or Visual Web Developer Express 2010 SP1.
  • After you have installed VS2010 SP1 or Visual Web Developer Express 2010 SP1 then you will need to download and install the Silverlight 5 Tools for Visual Studio 2010 SP1.
  • This download will install all components necessary for Silverlight 5 RC  and Microsoft WCF RIA Services V1 SP2 RC development:
    • Silverlight 5 RC Developer Runtime
    • Silverlight 5 RC SDK (software development kit)
    • Update for Visual Studio 2010 Service Pack 1 and Visual Web Developer Express 2010 Service Pack 1 (KB2502836)
    • Microsoft WCF RIA Services V1.0 SP2 RC
  • You should also install the Expression Blend Preview for Silverlight 5. The current version of Expression Blend 4 will not allow you to make changes to your Silverlight 5 UI. 
  • I always like to have a local copy of the help documentation on my hard drive in case I need to read it while on a flight or if my internet is down. So, I would recommend downloading the Silverlight 5 SDK CHM Help documentation. It is around ~75MB, but well worth it in those tight situations. 

A couple of optional files are located below. Most of these tools are automatically installed when you installed the Silverlight 5 Tools.

After Installation

One of the first things you are going to notice after installation is when you create a new Silverlight project in Visual Studio 2010 that you have the following option right after you type a name for your project.

You also have the ability to select Silverlight 3 or 4 from this drop-down. Let’s go ahead and look at a few key features. Don’t worry about the source code to the applications and I will provide a link at the end of the article with everything you need.

XAML Binding Debugging

One of the things that I looked forward to most in this release was the support of XAML Binding Statements Debugging. Let me go ahead and show you a screenshot.

Do you see the breakpoint that I inserted on the HyperlinkButton line? Now before you get all trigger happy you will want to know that you can only insert a breakpoint on a line that has the {Binding } expression. 

Let’s just say that you had an error on a Binding expression. You would simply add the breakpoint to the line that wasn’t binding properly and run the application (with the debugger of course) and you would see the following in your locals window:

It is very easy to debug Binding expressions now with that feature. Another great feature is that if you have the Silverlight 5 Beta installed then your Silverlight 4 applications automatically get access to the debugging feature.

Multiple Window Support

Imagine having the ability to spawn multiple windows from an Out-of-Browser application with elevated trust with just a couple of lines of code. Well, you now have that ability with Silverlight 5.

Linked Text Containers

This feature enables the text of a RichTextBlock control to overflow from one into the next. Multiple RichTextBlockOverflows can be chained together to spread text across a layout. Let’s go ahead and take a look at a screenshot of a RichTextBlock with a RichTextBlockOverflow working together.

As you can see from this screenshot, we had a RichTextBlock in the upper left and its content overflowed onto the RichTextBlockOverFlow #1, #2 and #3. You can think of this as something that is similar to a newspaper article. As the browser expands or contracts the content fills the available area.

NOTE: Post-beta, Microsoft changed this to use the non-editable RichTextBlock instead of RichTextBox. So a word of warning, many post-beta demos of this functionality on the web will no longer work. You can view my Silverlight 5 demo page for a working demo of this functionality.

Conclusion

We have downloaded the required tools and became familiar with some of the new features in Silverlight 5 including XAML Debugging, Multiple Windows and Linked Text Containers. The Silverlight 5 Release Candidate actually contains a lot more things that I didn’t have room to cover. I would recommend you to explore P/Invoke which would allow you to do cool things such as detect when a USB drive is inserted into the computer. If you wish to see the source code for the features I showed today as well as other Silverlight 5 features then visit this page. I would also invite you to connect with me on Twitter and subscribe to my blog. Thank you for reading.

Author's Bio

Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a system administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson Corporation and has been working with some form of .NET and VB/C# since 2003.

He shares his findings in his personal blog: http://michaelcrump.net and he also tweets at:@mbcrump

 

MVPs’ Windows Phone 7 App Wins Top Honors—and Helps Ease Public Commute in Sydney

$
0
0

Windows Live MVPs Bronwen Zande and John O’Brien recently took top honors for their Windows Phone 7 application when it showcased at Tech Ed Australia—which won the pair a trip to BUILD!

Transhub offers Sydney Public Transport commuters a fast and personalized application for finding the best public transport options, routes and time-tables to reach their destination.

Below are a few screenshots, and you can see more screen shots here.

Bronwen and John welcome your feedback and they’re interested in beta testers for other cities. You can reach them through the main website http://transhub.com or http://feedback.transhub.com.

If you live in or near Sydney, the application can be downloaded at http://syd.transhub.com.

Congratulations Bronwen and John!

MVPs Make a Big Impact at Taiwan Tech Day

$
0
0

The recent Tech Day in Taipei, Taiwan, was another huge success, again attracting more than 3,000  IT pros and developers from around the region. Not surprisingly, MVPs played a major role in making it a fun, informative event, serving as speakers for nearly 40% of the technical sessions and almost half of the informal “birds of a feather” sessions.

 

The 60 MVPs in attendance helped set the tone for Tech Day, making themselves available to the community to answer questions throughout the event. Six MVPs even took the stage to host a “Mini-Quest,” challenging participants to answer tough technical questions until a winner could be named. At the MVP Award booth, MVPs dropped by to talked with visitors about what it means to be an MVP and must have gained a number of new fans because the  new Taiwan MVP Facebook page has already received 670 new likes!

Getting Up and Running with the TFS 2010 Object Model

$
0
0

Editor's Note: The Following is a guest post by Visual Studio ALM MVP Jeff Bramwell

For those of you familiar with Team Foundation Server (TFS), you are no doubt aware that it ships with a great deal of functionality right out of the box.  From work item tracking, to version control, reporting and everything else in between, TFS can handle almost any software development lifecycle (SDLC) methodology.  As extensive as TFS is, you will still, no doubt, run into scenarios that are not inherently covered.  To address these unhandled scenarios, Microsoft has provided broad extensibility throughout the product.  The extensibility points in TFS include the process templates, reports, build automation, and, at a more granular level, the TFS Object Model.  It is the TFS Object Model that we will be digging into in this article.

If you are new to the TFS object model, there are three basic steps that you must take to utilize the TFS object model:

  1. Connect to a TFS configuration server (i.e. a specific TFS instance) or Team Project Collection (TPC).
  2. Determine which TFS services you want to interact with and reference the appropriate assemblies.
  3. Obtain a reference to one or more of these services and write custom code to interact with the services.

Let’s take a look at each of these steps in more detail.

Connecting to TFS

Before connecting to TFS, you must first decide if you need to interact with a specific TPC or with a TFS configuration server (which manages multiple TPCs).  If, for example, you want to modify security settings for a TFS server instance, then you will need to connect to a TFS configuration server.  If you want to retrieve a specific changeset from version control for a specific TPC, then you must first connect to the desired TPC.

The TFS object model provides classes for handling both of these scenarios.  In fact, the methods and functionality provided by these classes are very similar because of a common class hierarchy.  The following diagram illustrates the classes typically used to connect to a TFS configuration server or TPC. 

The TfsConnection class provides common methods that apply to TFS configuration servers as well as TPCs such as the ability to get access to the various services provided by TFS.  However, TfsConnection is an abstract class and therefore must be inherited from before it can be used.  TfsConfigurationServer and TfsTeamProjectCollection both inherit from TfsConnection providing concrete classes which can be used to establish a connection to TFS.  TfsConfigurationServer provides specific methods for connecting to a TFS configuration server (as the name implies) whereas TfsTeamProjectCollection provides methods for connecting to and managing a TPC.  We will go into more detail in the examples below.

TFS Services

Once you have made your initial connection to TFS, whether it’s to a TFS configuration server or a TPC, all interaction is handled via the many services provided by the TFS object model.  Some of the services are specific to the type of connection you have whereas others will work with either.  Here is a list of the services provided by TFS 2010 and the type of connection(s) that can be used with them:

For example, if you want to query for a specific work item, you would need to utilize the WorkItemStore service.  Notice that the WorkItemStore service is not available for an instance of TFS since work items are specific to a TPC.  If you want to programmatically manage security, you can use either class since security can be applied at both the configuration server level as well as the TPC level.

Writing the Code

Now that you know about the different types of connections you can make to TFS and the types of services offered, let’s put it all together.

The first step when creating any type of utility that is going to interact with the TFS object model is establishing a connection with TFS (whether it’s with a configuration server or TPC).  With this being such an important step, there are myriad methods and helper classes that can be used to connect to TFS.

A connection to TFS is typically established when creating a new instance of either TfsConfigurationServer or TfsTeamProjectCollection (there are alternatives which are not covered in this article).  As such, the constructors for each of these classes have multiple overloads allowing for various ways to establish a connection.  There are also various helper classes that provide alternative mechanisms for making a connection, some of which provide visual user interfaces.

For example, you can:

  • Connect to TFS simply by providing a uniform resource identifier (URI) to the TFS configuration server or TPC to connect to, depending upon the type of object being instantiated.
  • Connect to TFS by providing an instance of RegisteredConfigurationServer.
  • Use either of the above methods passing in custom network credentials – or prompting the user for their network credentials.
  • Use either of the first two methods above and connect on behalf of another user allowing you to perform actions on their behalf.
  • Connect to TFS using the TfsConfigurationServerFactory.
  • Provide a dialog to the user, via the TeamProjectPicker, allowing them to select which TFS server they want to work with as well as one or more TPCs (depending on how you configure the dialog).

We won’t cover all of these approaches in this article.  However, once you learn one variation it’s fairly simple to implement another variation.

Our First Example

Before writing any code, you must first add the necessary references to our Visual Studio project.  The references you add will directly depend upon the types of services you plan on interacting with.  Most of the required assemblies that you will need to reference are located in the following folder:

32-bit à C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0

64-bit à C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0

To illustrate the process for setting up a connection, let’s create a simple application that will connect to a TFS configuration server as well as a specific TPC.  Follow these steps to get started:

  1. Create a new Visual Studio Windows Forms or WPF application.
  2. Add a reference to Microsoft.TeamFoundation.Client (found in the folder location shown above).
  3. Add a button to your form and double-click it to create the associated Click event handler.
  4. Add the following using statement at the top of your class file:

using Microsoft.TeamFoundation.Client;

5. In the Click event handler, write the following code, replacing the provided URIs with ones specific to your TFS   configuration:

// Connect to an instance of TFS

var tfs = new TfsConfigurationServer(new Uri("http://tfsserver:8080/tfs"));

 

// Connect to a specific TPC

var tpc = new TfsTeamProjectCollection(new Uri(

"http:// tfsserver:8080/tfs/DefaultCollection"));

In these two simple lines you have established a connection to your TFS configuration server as well as a specific TPC (in the example above, the default TPC is used).

Extending the Example

To obtain a reference to one of the many services provided by TFS, call the GetService<T> method provided by the TfsConnection base class where T is the data type for the type of service to retrieve.  Let’s take the above example a step further and do something a little more useful such as querying the work item store.  As you might have guessed, to query the work item store, you will need to make use of the WorkItemStore service.  The following example illustrates the steps necessary to obtain a reference to the work item store reference and how to use that reference to query against the store.

To query the work item store follow these steps:

  1. Add a reference to Microsoft.TeamFoundation.WorkItemTracking.Client (found in the folder location shown above).
  2. Add the following using statement at the top of your class file: using Microsoft.TeamFoundation.WorkItemTracking.Client;
  3. In the same event handler created above, add the following code:

// Line 1: Get a reference to the work item store for the current TPC

var workItemStore = tpc.GetService<WorkItemStore>();

 

// Line 2: Build our query

var wiql = "SELECT [System.Id], [System.Title] FROM WorkItems WHERE

([System.TeamProject] = 'Demo') ORDER BY [System.Id]";

 

// Line 3: Query the work item store

var workItems = workItemStore.Query(wiql);

 

// Line 4: Display the results

foreach (WorkItem workItem in workItems)

{

Console.WriteLine("{0} - {1}", workItem.Id, workItem.Title);

}

Let’s take a look at this example line-by-line.

Line 1:  Here, we are obtaining a reference to the work item store service provided by TFS.  Specifically, this service only works with TPC references (see Table 1 above).  Once you have obtained this reference, you can interact with the TPC’s work item store performing actions such as querying the stored work items, retrieving a specific work item, deleting work items, and more.

Line 2: For our example to work you must provide a string containing the WIQL (work item query language) query that you wish to execute against the TPC’s work item store.  WIQL is similar in concept to SQL queries that you might run against relational databases such as Microsoft SQL Server.  You use WIQL to specify the work item fields you wish to return, the fields (and conditions) you wish to filter against, and the sort order.  Our example above provides a simple WIQL string that returns two fields (Id and Title) for all work items belonging to the Team Project “Demo” ordering the results by Id.

Line 3: This line is simply invoking the Query method of the WorkItemStore service to execute the provided WIQL query.  This method will return an instance of WorkItemCollection which can be iterated through to retrieve the selected fields for each work item located.

Line 4: This section of code is simply iterating through each of the work items in the results displaying the work item’s ID and Title.  A more elaborate example would most likely be returning more fields and have a more complex filter.

What Next?

This article has only looked at one of the services provided by TFS and has exercised a fraction of that service’s capabilities.  Covering all of the services and their respective features is out of the scope of this article so spend some time exploring the remaining services thinking about how they might apply to everyday scenarios in your development shop.  Although the specifics for each of the services can differ greatly, the basic steps are the same – connect to TFS (a TFS configuration server or TPC), obtain references to the desired service(s), and write the code needed to solve the problem at hand.  Keep in mind that Microsoft’s MSDN forums, documentation and various blogs are your key allies when writing code against any of the services provided by TFS. Check these resources out first when you start coding against a specific
service for the first time.  With a little work, you can extend TFS to achieve results that may not have even been thought about when the product was first conceived or delivered.

Happy coding!

Author's Bio

Jeff Bramwell has over 20 years of software development experience and is currently employed as an Enterprise Applications Architect by Farm Credit Services of America.  He has been working with .NET technologies since the early pre-release days (mid 2000) and taught C# at a local university for three years.  Having focused on Visual Studio and Team Foundation Server for the past few years, Jeff leads the Omaha Team System User Group and has presented on Visual Studio and Team Foundation Server at the Omaha .NET User Group, the Heartland Developers Conference, Tulsa TechFest, VSLive!, and
others.  Jeff is a Microsoft Visual Studio ALM MVP and, as time permits, answers Visual Studio and Team Foundation Server questions in the MSDN forums and makes every attempt to post useful information on his blog at http://devmatter.blogspot.com/.  You can follow Jeff on twitter at twitter.com/jbramwell.

Viewing all 788 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>