onedrive mailbox.makeewsrequest( ); message forwarded by exchangeendpoint retrieves attachments app...
TRANSCRIPT
Deep dive into Compose and other updates for Mail AppsAndrew SalamatovSenior Program ManagerMicrosoft
SPC391
Mail Apps – a brief intro
Type of apps in Apps for Office platform
Enable developers to extend Outlook using web technologies
Can be installed by end-users or admins for entire org
OneDrive
Mail AppsWrite once, run everywhereOutlook, Outlook Web App, OWA app for iPad and iPhoneMessages and appointments
Appear contextually, based on entities or patterns
What’s new
What’s new
Body and attachment accessEnd-users can install apps from the store that access message body and attachments
CommerceSell, give away or provide subscriptions for your mail apps
ComposeCreate apps to be used while reading a message or appointment, composing, or both
Body and attachment access
Attachments Demo(Harmon.ie)
Andrew Salamatov
Accessing attachments in 2013 RTMApp forwards the message to an SMTP endpoint Endpoint parses the message and extracts the attachmentsApp requires highest permission level, admin-installable only
mailbox.makeEwsRequest(
<XML EWS REQUEST>
);
Message forwarded by Exchange Endpoint retrieves attachmentsApp in Outlook
New approach goalsEnd-user apps can access body and attachments
Optimize for client bytes over the wire
The designJS APIs to access metadata, token and EWS URLAvailable with ReadItem permission
Outlook
APP
Exchange
App Backend
App requests attachment metadata,
callback token and EWS URL via JS APIs
The designApp code passes metadata + token to its backendCallback token is short-lived, item bound
Outlook
APP
Exchange
App Backend
App passes attachment id, token
and EWS URL to its backend
The designApp backend uses EWS to retrieve attachmentEWS Managed API support coming soon
Outlook
APP
Exchange
App Backend
App backend calls EWS to get attachment
A few notes on the callback tokenExtends concept that apps can read any property on the current item
Item and session boundSelf-signed by Exchange, bearer tokenBound to current item (EWS operations only allowed on item that the app was launched on)“Bound” to session – is valid for 5 minutes
Allowed EWS APIsGetAttachmentsGetItem
Attachments code demo
Andrew Salamatov
Saving attachment to SharePoint1. Register mail app as a web server app in
AAD
2. Users grant permission via OAuth flow
3. Backend will get access token to call into OneDrive
OAuth flowApp opens new window to Azure AD to ask for consent
Outlook
APP
Launch OAuth
Azure ADGrant Consent
App Backend
SP
OAuth flowAzure AD redirects to the redirect URL, providing access code as query URI parameter
Outlook
APP
Launch OAuth
Azure ADGrant Consent
App’s redirect html page
App Backend
SP
OAuth flowApp extracts access code and passes it to its backend
Outlook
APP
Launch OAuth
App’s redirect html page
App Backend
SP
OAuth flowApp backend exchanges access code for refresh token and access token from Azure AD and calls into SP
Outlook
APP
Launch OAuth
App Backend
SP
Azure AD1. Exchange for refresh
and access token
2. Call SP with access token
Code demo
Andrew Salamatov
ResourcesDocumentationAccessing attachments from a mail app: http://msdn.microsoft.com/en-us/library/office/dn148008.aspxCreating a WebAPI backend service for a mail app: http://blogs.msdn.com/b/officeapps/archive/2013/06/10/create-a-web-service-for-an-app-for-office-using-the-asp-net-web-api.aspxDirectory service: http://msdn.microsoft.com/en-us/library/dn605898(v=office.15).aspxIntegrating app with AAD: http://msdn.microsoft.com/en-us/library/windowsazure/dn151122.aspx
Related SessionsWebsite app registration and auth: SPC371 (5pm Today!)Discovery service: SPC 3999New APIs in SharePoint: SPC 3999
Code will be posted to this session in Yammer after the talk
Commerce
Paid Mail AppsDevelopers can sell mail apps in Office storeModel supports:• Trial mode• Subscription• Individual purchase
Entitlement is validated server-sideDocumentation: http://msdn.microsoft.com/en-us/library/office/jj163908.aspx
Compose
Compose demo
Andrew Salamatov
Compose mail appsActivation
Capabilities
Permissions
ActivationApps can appear in messages and/or appointmentsCompose apps are across Desktop, Tablet and Mobile
Compose mail app capabilitiesUse core JS APIsRead/Write recipientsRead/Write subjectAdd attachmentsWrite to the bodyR/W appointment propertiesCustom item properties
User Identity TokenMake EWS requestsSettingsUser Profile
Compose mail app capabilitiesUse core JS APIsRead/Write recipientsRead/Write subjectAdd attachmentsWrite to the bodyR/W appointment propertiesCustom item properties
Get/set/add recipients orattendees
Get/set the subject
Compose mail app capabilitiesUse core JS APIsRead/Write recipientsRead/Write subjectAdd attachmentsWrite to the bodyR/W appointment propertiesCustom item properties
Add file or item attachments
Compose mail app capabilitiesUse core JS APIsRead/Write recipientsRead/Write subjectAdd attachmentsWrite to the bodyR/W appointment propertiesCustom item properties
Prepend to the body
Overwrite current selection in body
Compose mail app capabilitiesUse core JS APIsRead/Write recipientsRead/Write subjectAdd attachmentsWrite to the bodyR/W appointment propertiesCustom item properties
Get/set start or end timeGet/set locationGet/set/add attendees
Compose mail app capabilitiesUse core JS APIsRead/Write recipientsRead/Write subjectAdd attachmentsWrite to the bodyR/W appointment propertiesCustom item properties
Saved on the sent item
Can be used to mark a composed message (eg “Tracked” in CRM)
PermissionsRestrictedApp can access data from limited entitiesRegular expressions are blockedJS API limits item data access
ReadItemApp can access data from all entitiesRegular expressions allowedRead JS APIs are allowedEWS calls are not allowed
ReadWriteItemAll JS APIs are allowed
ReadWriteMailboxLimited EWS methods are allowed
ReadWriteMailbox
End-userscan install
Admins can install
Compose code demo
Andrew Salamatov
Possibilities…
ScenariosAssist with writing a messageFrequently written snippetsMultiple signaturesInsert meeting location detailsHierarchical Address Book
Book Workspace
Address Book
Bob Costas
Jane Smith
John Doe
ScenariosTemplate messages and meetingsCreate a message based on a templateAttach an invoice
ScenariosKick-off workflowsDocument signingRequest approval for marketing campaignRecord email conversation for innovation management
Newsletter Approval
Select documents for approval:
ResourcesDemo code will be posted to #SPC391 Yammer discussion directly after the session
Documentation available on MSDNhttp://msdn.microsoft.com/EN-US/library/office/fp161135(v=office.15).aspx
Related talksOffice power hour – what’s new in Apps for Office: SPC 351Creating cloud hosted LOB apps: SPC 361New ODATA APIs in Exchange (right after this talk): SPC 379
MySPCSponsored by
connect. reimagine. transform.
Evaluate sessionson MySPC using yourlaptop or mobile device:myspc.sharepointconference.com
© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Compose app capabilitiesFor those who could not attend the talk, the next slides show sample JS to give a feel for the APIs
APIsCore APIsR/W recipients (to, cc, bcc)R/W subjectWrite data at cursor in bodyPrepend to bodyAdd file or item attachmentsR/W start/end time and locationCustom Properties
var item = Office.context.mailbox.item;
item.to.setAsync(“[email protected]”);item.subject.setAsync(“Hello”);
APIsCore APIsR/W recipients (to, cc, bcc)R/W subjectWrite data at cursor in bodyPrepend to bodyAdd file or item attachmentsR/W start/end time and locationCustom Properties
var item = Office.context.mailbox.item;
item.body.setSelectedData( “<b>Hello!</b>”, { coercionType : ‘HTML’ });
item.body.prependAsync(“Hello World!”);
APIsCore APIsR/W recipients (to, cc, bcc)R/W subjectWrite data at cursor in bodyPrepend to bodyAdd file or item attachmentsR/W start/end time and locationCustom Properties
var item = Office.context.mailbox.item;
item.addFileAttachmentAsync( “http://myurl.com/attachment.jpg”);
item.addItemAttachmentAsync(“EWS item id”);
APIsCore APIsR/W recipients (to, cc, bcc)R/W subjectWrite data at cursor in bodyPrepend to bodyAdd file or item attachmentsR/W start/end time and locationCustom Properties
var item = Office.context.mailbox.item;var now = new Date();
item.start.setAsync(now);item.location.setAsync(“My office”);