Visual Studio 2005 Tools for Office Advanced Programming

Visual Studio 2005 Tools
for Office
Advanced Programming, Security
and Deployment
Donald Drake
Development Manager
Visual Studio Tools for Office
Microsoft Corporation
Agenda
Server Programming
Security
Deployment
Server Programming
Enhances rich client capabilities
Build small departmental solutions that
keep the enterprise agile
Build rich, complex, distributed
applications that integrate with critical
business systems
Client
HR Data
Corporate
Systems
Server
Sub OnDocumentCreate()
‘ validate user
‘ get data
‘ pre-populate
document
.NET
Assembly
.NET
Assembly
Budget Data
Building Server Solutions
Start with the client customization
Data caching creates a “data island”
Client code maps the data onto the
document view
Access the data island on the server
ServerDocument provides standard
programming model
Scalable
Easy to use from within ASP .NET
Requesting Data from Server
ASPX
page
Data
Island
User
data
Sending Data Back to Server
ASPX
page
Updated
Data
Island
Updated
data
Data Caching Overview
Stores customization data in the
document
Why cache data in the document?
Available when client is offline
Accessible to a server process
VSTO data caching support
Can cache any public fields marked with
CachedAttribute and are members of
VSTO host item types
Types must be XML-serializable
CachedInDocument property on DataSets
ServerDocument Overview
Access the data island
Populate the cache before serving the
document
Extract data from uploaded documents
Access the document manifest
Add/remove customizations
ServerDocument is a scalable model
Does not use Excel or Word
ServerDocument is a supported model
Creating Office Content
from ASP.NET
Agenda
Server Programming
Security
Deployment
.NET Security Policy
Evidence
Strong Name
Publisher Certificate
Location
Permissions
UI
Execution
Full Trust
Policy Levels
Enterprise
Machine
User
Application
VSTO 2005 Security
Assembly Evidence via .NET Security
Evidence
Default Local Machine Zone is not enough
Document Evidence via Location
Local Machine Zone does apply
Document and Assembly require FullTrust
Documents in Outlook temporary directory
are not trusted because they are in the
internet zone
InfoPath - Security settings on the form
template affect the managed code and they
support partial trust
Security Scenario
Security Scenario
Agenda
Server Programming
Security
Deployment
Deployment Overview
Manifest Based Deployment
Application Manifest
Deployment Manifest
Why Manifests?
Provides rich information about solution
Self updating process
Outlook
Separate Setup project helps to create an MSI for
deployment
Uses registry to locate the manifest
InfoPath
Custom assemblies are included in the form
template. No additional deployment needed
Self Updating Process
ExcelDoc.xls
Deploy.xml
manifest.xml
<manifest>
<deploy
url=http://…/deploy.xml
version=“1.0”/>
<manifest>
. . .
curVersion=”1.0”
curVersion=”1.1”
. . .
</manifest>
ExcelApp.dll 1.1
ExcelApp.dll 1.0
<manifest>
<deploy
url=http:…/deploy.xml
<manifest>
version=“1.1”/>
<deploy
<assembly
url=http:…/deploy.xml
Name=“ExcelApp.dll”
version=“1.0”/>
updateURL=
. . .
http://../ExcelApp.dll
Deployment Models
Local/Local
Local/Network
Network/Network
Loading
not requires
generally
Loading document
document does
require
networknetwork
access access
Users
install solution
personal
copy
of
Users have
shareto
document
instance
document
Users
have
of
Updates
canpersonal
be madecopy
in a central
document
Assembly
location updates can be made in a
central location
Updates
require redistribution
Document updates require
redistribution
Offline Considerations
Local install (e.g. Program Files)
Guaranteed offline experience
Need to run setup first
Servicing
Intellimirror
Guaranteed offline experience
New versions without client intervention
Need to synchronize before first offline access
IE Cache
New versions without client intervention
Need to synchronize before first offline access
Cache is transitory
Referenced assemblies are delay loaded
Deployment Tools
Publishing Wizard
ServerDocument class
Application Manifest Editor Sample
MSI
Publishing Wizard
VSTO 2005 Summary
Scalable server programming model
provides access to cached application
data
.NET security policies ensure control
over code execution
Manifests provide flexible deployment
strategies
Next Steps
Participate in our newsgroups and web forum
microsoft.public.vsnet.vstools.office
microsoft.public.officedev
microsoft.public.office.developer
http://forums.microsoft.com/msdn/ShowForum.aspx?Foru
mID=16
Participate in VSTO-related blogs
Team blog: http://blogs.msdn.com/vsto2
VSTO MVP Chris Kunicki’s blog:
http://www.officezealot.com/VSTO/
Attend a free chat or webcast
http://www.microsoft.com/communities/default.mspx
For More Information
Visit the VSTO sections of these MSDN®
Developer Centers
Office Developer Center
http://msdn.microsoft.com/office/understanding/v
sto/default.aspx
Smart Client Developer Center
http://msdn.microsoft.com/smartclient/understan
ding/vsto/default.aspx
VSTO Help documentation on MSDN
http://msdn2.microsoft.com/library/d2tx7z6d(enus,vs.80).aspx
Questions?
© 2005 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Backups
ServerDocument Example
private void UpdateData_Click()
{
string user = Request.ServerVariables("AUTH_USER");
ExpensesDataset dsExpenses = new ExpensesDataset();
ExpensesDataAdapter.Fill(dsExpenses, user);
ServerDocument doc = new
ServerDocument("expenses.xls");
CachedDataItem cdi =
doc.CachedData.HostItems
["ExpensesWorksheet"].CachedData["Expenses"];
cdi.SerializeDataInstance(dsExpenses);
doc.Save();
doc.Close();
Response.Write(doc);
}
Data Caching Example
[Cached()]
CustomerDataSet _dsCustomer;
void Sheet1_Startup(…)
{
if (_dsCustomer == null)
{
dsCustomer = new CustomerDataSet();
dataAdapter.Fill(_dsCustomer);
}
list1.DataSource = _dsCustomer;
}
Not Supported on the
Server
Manipulation of the view or UI elements
Word/Excel not running so OM not
available
Workaround by manipulating view based
on data using data binding or custom
logic
Integration with other Office
applications
They’re not running on the server
Workaround using XML or web services
Client Requirements
Office 2003 SP1 Professional Edition
.NET Framework 2.0
VSTO 2005 Runtime
Office PIAs
Appropriate security policies
Self Updating Process
OutlookAddin.dll
OutlookAddin.dll v1.0.0
v1.0.1
Outlook
Registry
HKCU\...\Outlook\Addins\OutlookAddin
ManifestName =
“…\OutlookAddin.dll.manifest”
OutlookAddin.dll.manifest
<AppManifest>
<deploy
url=
http://…/OutlookAddin.application
assembly=“..\OutlookAddin.dll”
version=“1.0.0”/>
OutlookAddin.application
<DeployManifest>
<...
curVersion=”1.0.0”
curVersion=”1.0.1”
appManifest=
“OutlookAddin.dll.manifest”
>
<AppManifest>
<deploy
url=
http://…/OutlookAddin.application
assembly=“..\OutlookAddin.dll”
version=“1.0.1”/>
Deployment Summary
Think about your solution’s
requirements
Think about your client’s requirements
Pick the best model for your scenario