Microsoft TS: Visual Studio Tools for 2007 MS Office System (VTSO) Sample Questions:
1. You create an add-in for Microsoft Office Word 2007 by using Visual Studio Tools for the Microsoft Office System (VSTO). The add-in customizes the Ribbon user interface (UI). The add-in contains a file named Ribbon1.xml that has the following markup for two buttons.
<button id="Btn1" onAction =" DoOperation " />
<button id="Btn2" onAction =" DoOperation " />
You need to create a callback function that runs different code for the buttons.
Which code segment should you use?
A) public void DoOperation (Control control ) { if ( control.Text == "Btn1") { //Btn1 click } else { //Btn2 click } }
B) public void DoOperation ( Office.IRibbonControl control) { if ( control.Tag == "Btn1") { //Btn1 click } else { //Btn2 click } }
C) public void DoOperation (Control control ) { if ( control.ProductName.Equals ("Btn1")) { //Btn1 click } else { //Btn2 click } }
D) public void DoOperation ( Office.IRibbonControl control) { if ( control.Id == "Btn1") { //Btn1 click } else { //Btn2 click } }
2. You create an add-in for Microsoft Office Word 2003 by using Visual Studio Tools for the Microsoft Office System (VSTO). You install Microsoft VSTO 2005 Second Edition and Microsoft Office 2003 Professional with its default settings on computers that run Microsoft Windows XP Professional. You also install the add-in on the computers. Users report that they are unable to access the add-in. You need to configure the computers to run the add-in correctly. What should you install on the computers? (Each correct answer presents part of the solution. Choose two.)
A) Microsoft .NET Framework 1.1
B) Microsoft Visual Studio 2005
C) Microsoft .NET Framework 2.0
D) Microsoft Office 2003 Primary Interop Assemblies
3. The solution document refers to the following bugs:
bug123
Bug514
BUG512
The solution document must provide more details about a bug whenever a reference to the bug is found in the document.
You need to create a smart tag that identifies each bug.
Which code segment should you use?
A) Dim tag As SmartTag = New SmartTag _ ("http: / / MySmartTag/ST#BugRecognizer", "Bug Recognizer") Dim regex As Regex = _ New Regex("bug\d\d\d", RegexOptions.IgnoreCase) tag.Expressions.Add(regex)
B) Dim tag As SmartTag = New SmartTag _ ("http: / / MySmartTag/ST#BugRecognizer", "Bug Recognizer") tag.Terms.Add("[B|b][U|u][G|g]000")
C) Dim tag As SmartTag = New SmartTag _ ("http: / / MySmartTag/ST#BugRecognizer", "Bug Recognizer") tag.Terms.Add("bug\d\d\d")
D) Dim tag As SmartTag = New SmartTag _ ("http: / / MySmartTag/ST#BugRecognizer", "Bug Recognizer") Dim regex As Regex = New Regex("[B|b][U|u][G|g]000") tag.Expressions.Add(regex)
4. You create an add-in for Microsoft Office Outlook by using Visual Studio Tools for the Microsoft Office System (VSTO). The add-in must set up a WindowSelectionChange event for the Outlook e-mail messages by using Microsoft Office Word as the editor.
You write the following lines of code. (Line numbers are included for reference only.)
01 void WindowSelectionChange ( Word.Selection Sel ) {
02 Outlook.Inspector ins = Application.ActiveInspector ();
03 if ( ins.EditorType == Outlook.OlEditorType.olEditorWord ) {
04 ...
05 app.WindowSelectionChange += new
06 Word.ApplicationEvents4_WindowSelectionChangeEventHandler
07 ( WindowSelectionChange );
08 }
09 }
You need to bind the event to the Word application object.
Which code segment should you insert at line 04?
A) Word.Application app = ( ins.CurrentItem as Word.Document ).Application;
B) Word.Application app = ins.CurrentItem as Word.Application ;
C) Word.Application app = ins.WordEditor as Word.Application ;
D) Word.Application app = ( ins.WordEditor as Word.Document ).Application;
5. You create an add-in for Microsoft Office Word by using Visual Studio Tools for the Microsoft Office System (VSTO). You will use Microsoft Visual Studio 2005 Bootstrapper to install the add-in.
The Product.xml file for the Bootstrapper contains the following XML fragment. (Line numbers are included for reference only.)
01 < InstallChecks >
02 < AssemblyCheck Property="VSTORInstalled"
03 Name="Microsoft.Office.Tools.Common"
04 PublicKeyToken="b03f5f7f11d50a3a" Version="8.0.0.0"/ >
05 < /InstallChecks >
0 6 < Commands Reboot="Defer" >
07 < Command PackageFile="vstor.exe" >
08 < InstallConditions >
09 ...
10 < /InstallConditions >
11 < /Command >
12 < /Commands >
You need to ensure that Microsoft VSTO Runtime is installed on the target computers.
Which XML fragment should you insert at line 09?
A) < BypassIf Property="VSTORInstalled" Compare="ValueExists" Value="false"/ >
B) < BypassIf Property="VSTORInstalled" Compare="ValueExists" Value="true"/ >
C) < FailIf Property="VSTORInstalled" Compare="ValueExists" Value="false"/ >
D) < FailIf Property="VSTORInstalled" Compare="ValueExists" Value="true"/ >
Solutions:
| Question # 1 Answer: D | Question # 2 Answer: C,D | Question # 3 Answer: A | Question # 4 Answer: D | Question # 5 Answer: B |

We're so confident of our products that we provide no hassle product exchange.


By Miles


