Category Archives: Microsoft Graph

Auto Added by WPeMatico

Application Engagement in Windows Timeline with User Activities

Great applications help users do great things — enabling a wide range of creative, productivity and entertainment scenarios. Returning to activities can be a challenge, especially when a person wants to continue those activities across multiple devices. By writing User Activities, application developers have a new tool to get users back into their application.
In this article, you’ll learn how to drive application re-engagement by writing great User Activities into the Microsoft Graph with their UWP applications. This article is also a companion to the Microsoft Connect(); session: Engaging with your customers on any platform using the Microsoft Graph, Activity Feed, and Adaptive Cards.
User Activities and Timeline
Starting in Windows Insider Preview build 17056 or higher, User Activities generated by your application appear in Timeline. By writing User Activities into the Microsoft Graph, you can express specific content within your application as a destination which is showcased in Windows, and accessible on your iOS and Android devices.

Each User Activity represents a single destination within your app: such as a TV show, document or your current campaign in a game. When you engage with that activity (by creating an Activity Session), the system creates a history record indicating the start and end time for that activity. As you re-engage with that User Activity over time, multiple History Records will be recorded for a single User Activity. Here’s how to get started:
Install Windows SDK for Windows 10 Fall Creators Update (10.0.16299) or the latest Windows Insider Preview SDK. The Windows Insider Preview SDK requires Visual Studio 2017
To try out Timeline, install the Windows Insider Preview on the target machine
Adding UserActivities to your app
UserActivities are the unit of user engagement in Windows, and they consist of three components: a deep-link, visuals and content metadata.
The Activation Deep Link is a URI that can be passed back to an application or experience in order to resume the application with specific context. Typically, these links take the form of protocol handler for a scheme (e.g. “my-app://page2?action=edit”) or an AppUriHandlers (e.g. http://constoso.com/page2?action=edit).
Visuals are a set of properties that allow users to visually identify an activity, for example: title, description, or Adaptive Card elements.
Finally, Content Metadata is metadata for the content of the of activity that can be used to group and retrieve activities under a specific context. Often, this takes the form of http://schema.org data.
In order to integrate UserActivities with your application, you need to:
Generate UserActivity objects when your user’s context changes within an application (page navigation, new game, etc.)
Populate UserActivity objects with the minimum set of required fields: ActivityId, ActivationUri, DisplayText
Add a custom scheme handler to your application so it can be re-activated by your UserActivities
UserActivities can be integrated into an application with just a few lines of code:

UserActivitySession _currentActivity;

private async Task GenerateActivityAsync()
{
//Get the default UserActivityChannel and query it for our UserActivity. If the activity doesn’t exist, one is created.
UserActivityChannel channel = UserActivityChannel.GetDefault();
UserActivity userActivity = await channel.GetOrCreateUserActivityAsync("MainPage");

//Populate required properties
userActivity.VisualElements.DisplayText = "Hello Activities";
userActivity.ActivationUri = new Uri("my-app://page2?action=edit");

//Save
await userActivity.SaveAsync(); //save the new metadata

//Dispose of any current UserActivitySession, and create a new one.
_currentActivity?.Dispose();
_currentActivity = userActivity.CreateSession();
}

The first line in the GenerateActivityAsync() method gets a user’s UserActivityChannel. This is the feed that this app’s activities will be published to. The next line queries that channel of an activity called “MainPage”
Your application should name activities in such a way that same ID is generated each time the user is in a particular location in the app. For example, if your application is page-based, use an identifier for the page, if it’s document based, use the name of the doc (or a hash of the name).
If there is an existing activity in the feed with the same ID, that activity will be return from the channel (with the UserActivity object State property set to Published). If there is no activity with that name, and new activity with State set to New.
Activities are scoped to your app, there is no need to worry about your activity ID colliding with IDs from other applications
After getting or creating the activity the next lines of code specify the other two required fields: the DisplayText and the ActivationUri.
Next, save the UserActivity metadata, by calling SaveAsync(), and finally CreateSession(). That last method returns a UserActivitySession object that we can use to manage when the user is actually engaged with the UserActivity. For example, we should call Dispose() on the UserActivitySession when the user leaves the page. In the example above, we also call Dispose() on _currentActivity right before we call CreateSession(). This is because we made _currentActivity a member field of our page, and we want to stop any existing activity before we start the new one (the ‘?’ is an inline null-check).
Since, in this case, our ActivationUri is a custom scheme, we also need to register the Protocol in the application manifest. This can be done in the Package.appmanifest XML file, or using the designer, as shown below. Double-click the Package.appmanifest file to launch the designer, select the Declarations tab and add a Protocol definition. The only property that needs to be filled out, for now, is Name. It should match the URI we specified above hello-activities.
Now we need to write some code to tell the application what to do when it’s been activated via a protocol. In this case, we’ll override the OnActivated method in App.xaml.cs to pass the URI on to our MainPage:

protected override void OnActivated(IActivatedEventArgs e)
{
LoadFrame(e);
if (e.Kind == ActivationKind.Protocol)
{
var uriArgs = e as ProtocolActivatedEventArgs;
if (uriArgs != null)
{
Frame rootFrame = Window.Current.Content as Frame;
if (uriArgs.Host == "page2”)
{
rootFrame.Navigate(typeof(SecondaryPage), uriArgs)
}
}
}
Window.Current.Activate();
}

Use Adaptive Cards to Improve the Timeline Experience
User Activities will appear in Cortana and Timeline experiences. When activities appear in Timeline, we display them using the Adaptive Card framework. If you do not provide an adaptive card for each activity, Timeline will automatically create a simple activity card based on your application name and icon, the required Title field and optional Description field. Below is an example Adaptive Card payload and the card it produces.

{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"backgroundImage": "https://winblogs.azureedge.net/win/2017/11/eb5d872c743f8f54b957ff3f5ef3066b.jpg",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Windows Blog",
"weight": "bolder",
"size": "large",
"wrap": true,
"maxLines": 3
},
{
"type": "TextBlock",
"text": "Training Haiti’s radiologists: St. Louis doctor takes her teaching global",
"size": "default",
"wrap": true,
"maxLines": 3
}
]
}
]
}

Adaptive Cards can be added to the UserActivity object by passing a JSON string to the AdaptiveCardBuilder and setting the UserActivity.VisualElements.Content property:

activity.VisualElements.Content =
AdaptiveCardBuilder.CreateAdaptiveCardFromJson(cardText);

Cross-platform and Service-to-service integration
If your application has a cross-platform presence (for example on Android and iOS), or maintains user state in the cloud, you can publish UserActivities via integration with Microsoft Graph.
Once your application or service is authenticated with a Microsoft Account, it is two simple REST calls to generate Activity and History objects, using the same data as described above.
Summary
In this blog post, we learned how to use the UserActivity API to make your application show up in Timeline and Cortana, but there is much more you can do:
Learn more about UserActivity API on the Windows Dev Center, or check out the sample code at https://github.com/Microsoft/project-rome
Check some more sophisticated Adaptive Cards at io
Publish UserActivities from iOS, Android or your web service via MS Graph
Learn more about Project Rome on GitHub

Windows Developer Day in London – Windows 10 Fall Creators Update SDK Availability

Windows 10 Fall Creators Update provides a developer platform that is designed to inspire the creator in each of us – empowering developers to build applications that change the way people work, play and interact with devices. To truly fulfill this platform promise, I believe that our developer platform needs to be centered around people and their needs.  Technology should adapt and learn how to work with us.
As we showed at Microsoft Build in May, the Windows 10 Fall Creators Update SDK delivers thousands of new capabilities and improvements that support this promise. Today, at Windows Developer Day in London, we’re celebrating three areas that help you, our developer partners:
Create inspiring experiences using the next revolution in technology – Mixed Reality
Modernize applications for the modern workplace
Build and monetize your games and applications
I’m pleased to share with you that you can get started now by downloading the Windows 10 Fall Creators Update SDK. Windows 10 adoption has been incredible – with more than 500 million monthly active devices. We are also seeing devices staying current with the latest updates faster than ever, with the majority of devices running the latest updates in less than 6 months, and over eighty percent of devices running the latest update in less than a year. We can’t wait to see the next wave of innovation enabled by the Windows 10 Fall Creators Update SDK.
Create inspiring experiences using the next revolution in technology – Mixed Reality
The next revolution of computing is Mixed Reality. Microsoft is the only company embracing the entire continuum for mixed reality, from augmented reality to virtual reality and everything in between. Windows 10 was designed from ground up for spatial interactions and the next wave in this journey is Windows Mixed Reality, uniting the digital and real world to create a rich, immersive world. As humans, we interact with space constantly, and Windows Mixed Reality will feel the most natural for users. With HoloLens, we have already demonstrated unrivaled innovation that is transforming industries. Now, our immersive headsets offer unrivaled experiences.
For developers, Windows Mixed Reality offers unique opportunities.
Our unified platform maximizes reuse across platforms and device form factors
Windows Mixed Reality provides reach on the broadest range of devices
Our Microsoft Store provides an unrivaled discovery opportunity
Millions of people come to the Store every day to get an application from our broad catalog
Modernize applications for the modern workplace
With the Windows 10 Fall Creators Update SDK, developers can easily create a new or update an existing application to support modern experiences that employees need, or customers expect.
Modernizing your deployment
The deployment system in Windows 10 has been significantly enhanced to help your users start using your application quicker and easier. This starts with the ability to only download the delta between updates, the updated bits versus the entire package to your end user. In addition, you can break up your application into components to allow streaming install. This will allow your application to work before your user has the entire application installed.
To assist with this modernization, the Fall Creators Update introduces the Windows application packaging project with Visual Studio 2017 version 15.4. This new project allows developers to utilize the app packaging without having to convert your existing installer. Just add the project and you’re done. Once your application is using the modernized installer, you now have access to all the APIs that have been added to the Windows Platform. For example, integration with Windows Hello to assist with security, action center integration to assist with engagement, and cross-device capabilities provided with device relay and activity feed.
Another major investment has been the integration of .NET Standard 2.0 which enables developers to reuse their code across platforms and devices with Visual Studio and integrates the vast array of libraries available in the open source community built on .NET.
Fluent Design System
The Fluent Design System is the evolution of Microsoft’s approach to creating the very best user experiences. Experiences with Fluent Design feel natural on the device you’re using, whether it’s a large screen desktop with keyboard, a laptop or tablet with touch, a mixed reality headset, or one of many other computing form factors. Applications using Fluent Design are optimized for consuming content and are efficient and powerful to use for creating and collaborating, and they help you to achieve more… they are experiences you love to use!
For developers, the Windows 10 Fall Creators Update provides a comprehensive solution for creating applications with Fluent Design in a way that’s simple, powerful and flexible to your needs. It includes UX building blocks, guidelines, samples, tools, and a community to help you build the best experiences for your customers. Here are some highlights:
The Navigation View control provides an easy, consistent home for getting around your app.
Acrylic Material gives you a rich new visual building block that helps you create information hierarchy and greater immersion in your app.
The Reveal Highlight interaction visualization built into many controls helps your experience feel natural to use across as disparate inputs as mouse, pen, touch and gaze.
Connected Animations aid usability by preserving context and increasing engagement, and are so easy to adopt incrementally.
Gesture Actions like swipe build on familiar patterns to help users efficiently and naturally get stuff done.
Learn more about all the different building blocks and features you can take advantage of at: http://developer.microsoft.com/design.
Device Relay and Activity Feed
Microsoft Graph and Project Rome enable new and exciting ways to drive user engagement across apps, devices and platforms. Device relay allows your customers to continue what they’re doing right now, but on a different device and Activity Feed, allows them to pick up an activity they were doing in the past, and continuing it now or sometime in the future.
Helping your customers stay connected to what they need to do right now isn’t as easy as it used to be. People have multiple devices they switch between and they expect them to all work together. Using the Remote Systems and Remote Sessions APIs, you can do truly delightful device relay scenarios to help your customers use the right device for the task.  The Remote Systems APIs enable you to communicate with the user’s devices across Windows, Android and iOS.
With the Activity Feed, you can keep your customers engaged and help them resume what they need to do next. Your customers can’t always finish what they were doing in a task or session in your app, but you can still help them pick up where they left off between devices and experiences by simply adding an activity to the Activity Feed using the UserActivity API.
Build and monetize your games and applications
Lastly, with the Expanded Resources feature in the Fall Xbox One Update, we’ve made another investment in the promise to open Xbox One to UWP game developers who want to build more immersive experiences. Now, developers will automatically have access to 6 exclusive cores, 5 GB of ram and full access to the GPU with DX12! We designed Visual Studio 2017 with game developers in mind! We built a brand-new work-load based installer in Visual Studio 2017, which optimizes the install experience for game developers, so you get everything you need and nothing you don’t.
We recently launched the Xbox Live Creators Program, and this gives anyone the ability to build and publish games for the Xbox One family of devices and Windows 10 PCs. You don’t have to go through concept approval, and the certification is simplified. What’s more is that you are able to leverage select Xbox Live features like stats, leaderboards and cloud saves. We have added more monetization options and tools in Microsoft Store. Interactivity is the future of live streaming and Mixer is our fast and interactive live streaming platform. We have the Mixer SDKs for the major game engines and languages and you can make something cool in less than an hour. Our goal is to create a community of indie game developers. We want to foster open discussions between developers and Windows, and each other. With that in mind, we are bringing back Dream.Build.Play in 2017. The 2017 Challenge has a prize pool over $225,000 (USD), with several categories.
Community and thanks
We were pleased today to have been joined on stage in London by two creative partners building UWPs for unique and innovative experiences.  Black Marble, a UK based developer is building on its history of simplifying law enforcement experiences with a new Mixed Reality UWP to bring MR to courtrooms. Texthelp, another UK based company, showcased a UWP application and Edge extension that helps improve reading and writing comprehension for children with dyslexia and students learning in a second language. Texthelp has also announced a new app, EquatIO, which assists learning in mathematics.
Whether you’re building immersive experiences for Windows Mixed Reality, games, education or business applications, community is crucial to the Windows developer platform. I’d also like to take a moment to thank all developers who are participating Windows Insiders Program and have been using the Fall Creators Update Preview SDK. We value your insight and suggestions, as well as your feedback.
I look forward to seeing what you create with the Windows 10 Fall Creators Update SDK. The Windows Dev Center is open now for submissions to the Microsoft Store! For more details, go to dev.windows.com.

Windows Developer Day Returns!

Windows Developer Day is back! Join us on October 10, starting at 9:30 AM PDT via live stream, or attend a viewing party in your area (location list below), as we explore what’s new in the Windows 10 Fall Creators Update for developers.
The day’s schedule features an introductory keynote by Kevin Gallo and members of the Windows engineering team, a live-streamed Q&A session and several streaming sessions diving deeper into the current Windows 10 update.
Learn what’s new for developers in the Windows 10 Fall Creators Update
No matter what you’re working on, you’ll find plenty of new features and improvements to make your software more compelling:
Game devs
Game Mode and new performance enhancements improve the gameplay experience for most of your players.
Xbox Live Creators Program lets you integrate Xbox Live into your game and publish to both Xbox One and Windows 10.
Mixer is the only next gen streaming service that offers viewers real-time influence and participation in your players’ live streams.
Windows Store improvements help you promote your games with video trailers and control timing and pricing more precisely.
Commercial devs
.NET Standard 2.0 adds more than 20,000 new APIs and lets you share code across all your .NET code base.
Xamarin lets you use your existing C# and .NET skills to build truly cross-platform apps for iOS, Android and Windows 10 devices.
Desktop Bridge improvements to tooling and more make it much easier to convert your existing Win32 and .NET software to Windows 10.
Windows Mixed Reality delivers new levels of immersion to help you enhance the visual experience of your users.
Consumer devs
Microsoft Graph and UserActivity API make your end-to-end experience seamless by connecting screens and experiences across devices and platforms.
Fluent Design System helps you engage your users continuously across all their devices with beautiful, expressive experiences.
Tooling improvements within Visual Studio make it easier to create, convert and deploy your software.
.NET Standard 2.0 adds more than 20,000 new APIs and lets you share code across all your .NET code base.
Live Stream Viewing Parties
Join other developers from your local developer community and attend a Live Stream Viewing Party hosted by a Microsoft Windows Development MVP. Enjoy refreshments, watch the live stream, participate in the Live Q&A alongside your peers and make new community connections!
Here is a list of the locations: 
Amstelveen, Netherlands
Bonstetten, Zurich, Switzerland
Boston, MA, USA
Chicago, IL, USA
Cologne, Germany
Dresden, Germany
Durban, South Africa
Ghent, Belgium
Manchester UK
Mexico City, Mexico
Milan, Italy
Milwaukee, WI, USA
Moscow, Russia
Munich, Germany
Paris, France
Penang, Malaysia
Santa Cruz de Tenerife, Spain
Singapore, Singapore
Stockholm, Sweden
Vienna, Austria
Zagreb, Croatia
Learn more about Windows Developer Day and sign up here!