共用方式為


New Features in Microsoft Office Developer Tools for Visual Studio 2012

The Microsoft Office Developer Tools for Visual Studio 2012 have been released and have some fantastic new additions in them for building apps.  This blog post covers some of the new features that you’ll want to be familiar with.

New Project Item Templates

There are a few project item templates that have been added since the Preview 2 tools.

image

Search Configuration Project Item

An interesting addition is the new Search Configuration project item template.  To use this, create a search center and then go to Site Settings / Search / Configuration Export.

image

This will export the search settings as an XML file.  When you use the Search Configuration project item in Visual Studio, it prompts you for this XML file.  This enables you to deploy search settings such as ranking models and managed properties as part of your app!  For more information on deploying search customizations, see the MSDN topic How to: Deploy custom search configurations by using Visual Studio.

App for Office Project Item

Another project item to notice is the App for Office project item that can be added to a SharePoint hosted app or a provider hosted app. This project item enables you to define your app and bind it to a document, which can then be used in your project to set as the default template of a document library.  Add the new App for Office to a SharePoint hosted app:

image

The next screen asks if you want to create a new document or use an existing document:

image

Add a new list to the project, creating a customizable list based on the Document Library type.

image

Here’s the really cool part.  Prior to the RTM version of the tools, this is where things stopped, and you had to do some work with the element manifest files to deploy the document and set it as the document template.  Visual Studio now saves you this extra step, allowing you to choose the document created in the previous step that has a reference to your app.

image

To test, I changed the start URL of my app to ~appWebUrl/Lists/MyDocs?{StandardTokens} and press F5.  The app opens to my new document library, and the content type is available in the New menu.

image

Create a new “MyDocsContentType” document, and when the document is opened, it will have your app already in it!

image

Personally, I love this feature.  There used to be many more steps involved in this, and this makes the entire process so incredibly simple.  Even better, the content for your app is being served from SharePoint, so there’s no need to go search for somewhere to host your app for Office. 

For more information on deploying an App for Office as part of your SharePoint app, see the MSDN topic How to: Create an app for SharePoint that contains a document template and a task pane app

 

Debugging Remote Event Receivers

One of my favorite additions in the tools is the ability to use Windows Azure Service Bus for debugging remote event receivers.  This was a challenge with previous releases of the tools because remote event receivers are basically HTTP calls made from the SharePoint server.  If you develop an autohosted app, add a remote event receiver, add a breakpoint and press F5 in Visual Studio, your event receiver will not fire because your web application is running as the address localhost, the remote server cannot resolve “localhost” to your machine.  The new developer tools make this simple by leveraging Windows Azure Service Bus.  Start by logging into the Azure Portal and add a new namespace.

image

Once the namespace is created, you can use the “Access Key” button to discover the connection string for your service bus endpoint.

image

Now go to the properties / SharePoint tab for your app manifest project and paste the Windows Azure Service Bus connection string.

image

Add a breakpoint, hit F5, and watch the goodness as the web site containing your remote event receiver service is running under localhost and the breakpoint is still hit!

image

To learn more about remote event receivers in SharePoint 2013, see the MSDN topic Handling events in apps for SharePoint.

 

 

App for Office Validation

I was very happy to see that a new feature has been added when publishing your app for Office… validation!  This validation is representative of some of the checks that will be made when you submit your app to the Office marketplace.  Simply check the checkbox to “Validate my app for the Office Store” on the publish window and choose Finish. 

 

image

Your app will then be validated and a report shown of various issues that could prevent your app from successfully being submitted to the Office Store.

image

To learn more about the validation policies for apps submitted to the Office Store, see the MSDN topic Validation policies for the apps submitted to the Office Store (version 1.3).

For More Information

Download Microsoft Office Developer Tools for Visual Studio 2012

How to: Deploy custom search configurations by using Visual Studio

How to: Create an app for SharePoint that contains a document template and a task pane app

Handling events in apps for SharePoint

Validation policies for the apps submitted to the Office Store (version 1.3)

Comments

  • Anonymous
    April 02, 2013
    Glad to see someone covering remote event debugging with the new tools.  Hey...I've had luck with debugging remote event receivers for Apps (app installed, app updated, etc), but not List and ListItem events...have you experienced this?  I even configured my ListItem events to use the same remote service with no luck.