<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Apps for Office and SharePoint blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/officeapps/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/officeapps/feed.xml</link>
    <description>The official Microsoft blog for cloud app model developers of Office and SharePoint</description>
    <lastBuildDate>Thu, 30 Jul 2015 03:29:25 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Announcement: Apps for Office and SharePoint blog has moved</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/announcement-apps-for-office-and-sharepoint-blog-has-moved</link>
      <pubDate>Tue, 22 Jul 2014 18:54:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/07/22/announcement-apps-for-office-and-sharepoint-blog-has-moved/</guid>
      <description><![CDATA[This is the final Apps for Office and SharePoint blog post. We've moved to the Office Developer...]]></description>
      <content:encoded><![CDATA[<p>This is the final Apps for Office and SharePoint blog post. We've moved to the Office Developer blog, in this new location:</p>
<p><a href="https://blogs.office.com/dev">https://blogs.office.com/dev</a></p>
<p>Here is the RSS feed for the new Office Developer blog: <a href="https://blogs.office.com/feed/?filter-audience=dev">https://blogs.office.com/feed/?filter-audience=dev</a></p>
<p>Please join us in this new location to keep reading all the latest news about developing Apps for Office and SharePoint.</p>
<p>Don&rsquo;t worry, we won&rsquo;t delete any of these MSDN blog posts &ndash; they&rsquo;ll stay here so you can continue to refer to them for the information you need.</p>
<p>Here are all the places where you can join the Office Developer conversation:</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="clip_image001" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/3225.clip_image001_thumb_6ACA91A1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/3225.clip_5F00_image001_5F00_thumb_5F00_6ACA91A1.png" alt="clip_image001" width="25" height="26" border="0" /><sup><a href="https://twitter.com/officedev"><span style="font-size: small;"><span style="font-size: small;">Twitter</span></span></a><span style="font-size: small;"><span style="font-size: small;"> @OfficeDev</span></span></sup></p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="clip_image002" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/8130.clip_image002_thumb_261DF760.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/8130.clip_5F00_image002_5F00_thumb_5F00_261DF760.png" alt="clip_image002" width="28" height="27" border="0" /><sup><a href="https://www.facebook.com/OfficeDev"><span style="font-size: small;"><span style="font-size: small;">Facebook </span></span></a><span style="font-size: small;"><span style="font-size: small;">Office Developer</span></span></sup></p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="clip_image003" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/2766.clip_image003_thumb_4CEC0DA0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/2766.clip_5F00_image003_5F00_thumb_5F00_4CEC0DA0.png" alt="clip_image003" width="28" height="25" border="0" /><sup><a href="https://www.yammer.com/itpronetwork/"><span style="font-size: small;">Yammer - Office 365 Technical Network</span></a></sup></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6557.clip_image004_13D5309E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6557.clip_5F00_image004_5F00_13D5309E.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="clip_image004" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/1780.clip_image004_thumb_45CCD128.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/1780.clip_5F00_image004_5F00_thumb_5F00_45CCD128.png" alt="clip_image004" width="27" height="25" border="0" /></a> <sup><a href="https://social.msdn.microsoft.com/Forums/office/en-US/home?category=apps,officedev,sharepoint,exchangeserver,lync,msproject"><span style="font-size: small;"><span style="font-size: small;">MSDN forums</span></span></a></sup></p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="clip_image005" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6560.clip_image005_0CB5F426.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6560.clip_5F00_image005_5F00_0CB5F426.png" alt="clip_image005" width="33" height="37" border="0" /><sup><a href="https://stackoverflow.com/"><span style="font-size: small;"><span style="font-size: small;">Stackoverflow </span></span></a><span style="font-size: small;"><span style="font-size: small;">[MS-Office] [Office365] [OneNote]</span></span></sup></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/5074.clip_image006_539F1723.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/5074.clip_5F00_image006_5F00_539F1723.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="clip_image006" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/5482.clip_image006_thumb_48758CD9.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/5482.clip_5F00_image006_5F00_thumb_5F00_48758CD9.png" alt="clip_image006" width="26" height="25" border="0" /></a><sup><a href="https://dev.office.com/"><span style="font-size: small;"><span style="font-size: small;">Office Developer Center</span></span></a></sup></p>]]></content:encoded>
    </item>
    <item>
      <title>.NET and JavaScript Libraries for Office 365 APIs, Available in Preview</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/net-and-javascript-libraries-for-office-365-apis-available-in-preview</link>
      <pubDate>Mon, 12 May 2014 09:07:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/05/12/net-and-javascript-libraries-for-office-365-apis-available-in-preview/</guid>
      <description><![CDATA[You can now access the Office 365 REST APIs from .NET and JavaScript, using a new set of client...]]></description>
      <content:encoded><![CDATA[<div class="OutlineElement Ltr SCX81133611" style="text-indent: 0px; margin-left: 0px;">
<p class="Paragraph SCX81133611" style="text-align: left; color: windowtext; text-indent: 0px; font-family: 'Segoe UI',Tahoma,Verdana,'Sans-Serif'; font-size: 6pt; font-style: normal; font-weight: normal; vertical-align: baseline; background-color: transparent;"><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">You can now access the Office 365 </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">REST </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">APIs </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">from</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;"> .NET and JavaScript</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">, using a new set of client libraries</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">. These libraries make it </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">a lot </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">easier to interact with the </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">Office 365 </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">APIs</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">,</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;"> from </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">popular device and desktop platforms</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">. </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">The </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">libraries are included in the </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">latest update for </span></span><a class="Hyperlink SCX81133611" style="text-decoration: none;" href="https://aka.ms/office365apitoolspreview"><span class="TextRun Underlined SCX81133611" style="color: #0563c1; line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt; text-decoration: underline;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">Office 365 API Tools for Visual Studio Preview</span></span></a><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">. </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">Along with the </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">l</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">ibraries</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">,</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;"> t</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">his release </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">also </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">brings you some key updates to the tooling experience</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;"> making it </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">easier to </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">interact with Office 365 </span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">services</span></span><span class="TextRun SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;" xml:lang="EN-US"><span class="NormalTextRun SCX81133611" style="background-color: inherit;">.</span></span><span class="EOP SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;">&nbsp;</span></p>
<p class="Paragraph SCX81133611" style="text-align: left; color: windowtext; text-indent: 0px; font-family: 'Segoe UI',Tahoma,Verdana,'Sans-Serif'; font-size: 6pt; font-style: normal; font-weight: normal; vertical-align: baseline; background-color: transparent;"><span class="EOP SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;">Read all about it here! <em><a href="https://blogs.office.com/2014/05/12/net-and-javascript-libraries-for-office-365-apis/">.NET and JavaScript Libraries for Office 365 APIs, Available in Preview</a> </em></span></p>
<p class="Paragraph SCX81133611" style="text-align: left; color: windowtext; text-indent: 0px; font-family: 'Segoe UI',Tahoma,Verdana,'Sans-Serif'; font-size: 6pt; font-style: normal; font-weight: normal; vertical-align: baseline; background-color: transparent;"><span class="EOP SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;"><a href="https://visualstudiogallery.msdn.microsoft.com/7e947621-ef93-4de7-93d3-d796c43ba34f">Download the tools here.</a></span></p>
<p class="Paragraph SCX81133611" style="text-align: left; color: windowtext; text-indent: 0px; font-family: 'Segoe UI',Tahoma,Verdana,'Sans-Serif'; font-size: 6pt; font-style: normal; font-weight: normal; vertical-align: baseline; background-color: transparent;"><span class="EOP SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;">And for more developer-related announcements from TechEd, <a href="https://blogs.msdn.com/b/somasegar/archive/2014/05/12/mobile-first-cloud-first-development-visual-studio-apache-cordova-tooling-and-cloud-optimized-net-futures.aspx">see Soma's post</a>.<br></span><span class="EOP SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;">&nbsp;</span></p>
<p class="Paragraph SCX81133611" style="text-align: left; color: windowtext; text-indent: 0px; font-family: 'Segoe UI',Tahoma,Verdana,'Sans-Serif'; font-size: 6pt; font-style: normal; font-weight: normal; vertical-align: baseline; background-color: transparent;"><span class="EOP SCX81133611" style="line-height: 18px; font-family: Calibri,Sans-Serif; font-size: 11pt;">Enjoy!</span></p>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Using Office 365 APIs in your MVC and Windows 8.1 Applications – Part II</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/using-office-365-apis-in-your-mvc-and-windows-8-1-applications-part-ii</link>
      <pubDate>Wed, 23 Apr 2014 18:20:00 GMT</pubDate>
      <dc:creator><![CDATA[SharePoint Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/04/23/using-office-365-apis-in-your-mvc-and-windows-8-1-applications-part-ii/</guid>
      <description><![CDATA[UPDATE 5/12/2014 - A new preview is available. You can now access the Office 365 APIs using client...]]></description>
      <content:encoded><![CDATA[<p><em><strong>UPDATE 5/12/2014 - A new preview is available. You can now access the Office 365 APIs using client libraries available for .NET and JavaScript.</strong> See: <em><a href="https://blogs.office.com/2014/05/12/net-and-javascript-libraries-for-office-365-apis/">.NET and JavaScript libraries for Office 365 APIs</a></em></em></p>
<p><em>In </em><a href="https://blogs.msdn.com/b/officeapps/archive/2014/03/12/announcing-office-365-api-tools-for-visual-studio-preview.aspx"><em>last month&rsquo;s blog post</em></a><em>, we announced the Office 365 API Tools &ndash; Preview add-in for Visual Studio 2013. By using Office 365 APIs, developers can access users&rsquo; data in the Office 365 cloud, e.g., reading calendar information, storing documents, or sending emails on behalf of users. The Office 365 APIs are an open platform that is available across a variety of languages and technologies. If you&rsquo;re developing Model-View-Controller (MVC) web projects or Windows 8.1 applications, our </em><a href="https://aka.ms/office365apitoolspreview"><em>Office 365 API Tools for Visual Studio</em></a><em> </em><em>will make it that much easier to add Office 365 APIs to your solution.</em></p>
<p>The <a href="https://blogs.msdn.com/b/officeapps/archive/2014/03/12/announcing-office-365-api-tools-for-visual-studio-preview.aspx">previous post</a> focused on getting started with the tooling and the Office 365 APIs &ndash; going through the registration piece and exploring the sample code. This post continues from where the previous post left off, going from using the generated sample code to authoring your own. If you haven&rsquo;t already done so, I highly recommend reading the previous post before continuing with this one.</p>
<p><strong>Note</strong> A couple of weeks ago (April 7, 2014), we released an updated (1.1) version of the <a href="https://aka.ms/office365apitoolspreview">Office 365 API Tools &ndash; Preview</a>, which offers some reliability improvements to the tool, along with some slightly modified sample code (particularly in relation to SharePoint). Today&rsquo;s blog post assumes you are using the latest version of the tools and the accompanying samples.</p>
<h2>Recap of the Project Structure</h2>
<p>In <a href="https://blogs.msdn.com/b/officeapps/archive/2014/03/12/announcing-office-365-api-tools-for-visual-studio-preview.aspx">last month&rsquo;s blog post</a>, we took a look at the files that are added by the Office 365 API Tooling. If you have not already, I would encourage you to read the &ldquo;Exploring the project structure&rdquo; section of that post &ndash; including the diagrams that show which files are added to the <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/0407.fig%207.png" original-url="https://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/0407.fig-7.png">MVC Web Application</a> and the <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/6557.fig%208.png" original-url="https://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/6557.fig-8.png">Windows 8.1 app</a>. In a nutshell, after registering an app with the Azure Active Directory, the Office 365 API Tools make the following modifications to a project:</p>
<ul>
<li>Add NuGet packages for <a href="https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/">Active Directory Authentication Library</a> and <a href="https://www.nuget.org/packages/Newtonsoft.Json/">Json.NET</a>.</li>
<li>Add a set of common helper files (files whose names start with "Office365*," such as "Office365ServiceInfo") that are common across different services.</li>
<li>Add a set of service-specific sample files (for example, ExchangeSampleController and its accompanying View folder for MVC, or ExchangeSamplePage.xaml and its accompanying code-behind for Windows 8.1).</li>
<li>Modify Web.config or App.xaml to include the Client ID (and, in the case of web apps, the Password) for the app.</li>
</ul>
<p>The NuGet additions and the Web.config/App.xaml modifications are fairly straightforward, so in terms of new files added to the project, we&rsquo;re left with the helper files and the service-specific sample files. The helper files are designed to be fairly transparent to the developer, as they encapsulate functionality that you shouldn&rsquo;t need to worry about. The one exception is error-handling, where you may want to customize the experience by customizing the UI or writing the errors to a log or database. We&rsquo;ve left a <strong>TODO</strong> flag in the Office365Helper and Office365CommonController files to make it clear where such error-handling logic should be implemented. For the rest of the helper-class implementations, you can treat those files as library files and generally avoid peeking into them, except to satisfy your academic curiosity.</p>
<p>Instead of exploring the underlying plumbing of the helper files, this blog post will focus on showing you how to <em>use </em>the files to accomplish your business needs.</p>
<h3>A note on the differences between MVC Web Apps and Windows 8.1 apps</h3>
<p>No doubt, every developer has faced the frustration of learning to do something one way &ndash; and then needing to re-learn a completely different approach for a similar scenario.</p>
<p>When designing our helper classes, we worked hard to ensure that much of the individual differences between platforms and services are abstracted away. Using our helper classes, accessing Exchange from a Windows 8.1 app feels no different than accessing SharePoint from an MVC web app. For example, authentication on Windows 8.1 apps has different caching mechanisms than web applications, but our helper classes handle it transparently for the developer in either case. Likewise, accessing OneDrive for Business in SharePoint requires an extra discovery step, whereas accessing Exchange does not; but again, this is not be something that a developer needs to remember. By using our helper classes, the code that you author will be similar both in spirit and structure, no matter which project type and which service you choose to target.</p>
<p>So, what does the sample code look like when the individual differences are abstracted away by helper classes? Let us take a function that retrieves calendar events from Exchange and take a look, step by step.</p>
<h2>Performing a GET request</h2>
<h3>Step 1: Obtain information for communicating with the service</h3>
<p>To use the helper functionality, first you need to create an object to represent the service. The object type is one of the helper classes, <strong>Office365ServiceInfo</strong>. This class encapsulates information about a service&rsquo;s API endpoint, resource ID, access token, error handling, and more (generally speaking, much of this information should be transparent for your code). All you need to do is obtain an instance of the service, and then pass it around to other helper functions.</p>
<p>To construct an <strong>Office365ServiceInfo</strong>instance, the Office365ServiceInfo file offers a number of static methods that construct an instance of a particular service type:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p>MVC Web App</p>
</td>
<td valign="top" width="534">
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span style="color: #2b91af; font-family: Consolas;"><span style="font-size: 9.5pt;">Office365ServiceInfo</span></span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;"><span><span style="color: #000000;"> serviceInfo =</span> <br /></span><span style="color: #2b91af;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>Office365ServiceInfo</span></span><span><span style="color: #000000; font-size: 9.5pt;">.GetExchangeServiceInfo();</span></span></span></p>
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span><span style="color: #000000; font-size: 9.5pt;"> (!serviceInfo.HasValidAccessToken)</span></span></span></p>
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">return</span></span></span><span><span style="color: #000000; font-size: 9.5pt;"> Redirect(serviceInfo.GetAuthorizationUrl(Request.Url));</span></span></span></p>
<span style="list-style-type: disc; line-height: 11pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;"><span style="color: #000000; font-size: 10pt;">}</span></span></td>
</tr>
<tr>
<td valign="top" width="90">
<p>Windows 8.1</p>
</td>
<td valign="top" width="534">
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: Consolas;"><span style="color: #2b91af;"><span style="font-size: 9.5pt;">Office365ServiceInfo</span></span><span style="font-size: 9.5pt;"><span><span style="color: #000000;"> serviceInfo = </span></span></span></span><span style="font-family: Consolas;"><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">await <br /><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span></span></span><span style="color: #2b91af;">Office365ServiceInfo</span></span><span><span style="color: #000000; font-size: 9.5pt;">.GetExchangeServiceInfoAsync();</span></span></span></p>
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span><span style="color: #000000; font-size: 9.5pt;"> (!serviceInfo.HasValidAccessToken)</span></span></span></p>
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="Codeblock" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">return</span></span><span><span style="color: #0000ff;">null</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">;</span></span></span></p>
<span style="list-style-type: disc; line-height: 11pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;"><span style="color: #000000; font-size: 10pt;">}</span></span></td>
</tr>
</tbody>
</table>
<p>By necessity, this preamble to get the <strong>Office365ServiceInfo</strong> object is somewhat different between the two project types &ndash; but it does stay identical between services (merely substituting <strong>GetExchangeServiceInfoAsync</strong> for <strong>GetOneDriveServiceInfoAsync</strong>, <strong>GetActiveDirectoryServiceInfoAsync</strong>, etc).</p>
<p>As a side note, the reason for the difference is that a web project must redirect to a login page and then back to itself in order to show a login UI, whereas a Windows 8.1 project is able to display the login screen as an overlay dialog. Thus, whereas the MVC code needs to redirect to the authorization URL if no access token is retrieved, the Windows 8.1 code does not. The difference also accounts for the need to &ldquo;await&rdquo; the dialog in Windows 8.1 (though certain services, like <strong>GetOneDriveServiceInfoAsync</strong>, still need to be async even in the case of an MVC Web App, as they first require a call to a Discovery service).</p>
<h3>Step 2: Create a URL for retrieving the data</h3>
<p>The next step is to construct a URL to call into the service. This code is completely the same across project types (though it is different for different service types).</p>
<p>How do you know which URL to use for the service, and which query parameters to pass in? In the MSDN <a href="https://msdn.microsoft.com/library/office/dn605892(v=office.15).aspx">Office 365 APIs Preview</a> documentation, choose an appropriate section for your service type, such as the article on <a href="https://msdn.microsoft.com/library/office/dn605896(v=office.15).aspx">Using the Mail, Calendar and Contact REST APIs</a>. For this example, the &ldquo;Work with calendar items&rdquo; section describes the format of the query to retrieve calendar data and even suggests a filter that you can apply, which is part of the standard ODATA syntax.</p>
<pre style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">GET https://outlook.office365.com/ews/odata/Me/Calendar/ Events?$filter=Start le 2014-02-14T05:00:00Z and End ge 2014-02-10T05:00:00Z HTTP/1.1</span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">Accept: application/json</span></span></span></pre>
<p>Armed with the example above, we can create our own query. In the case of the sample code that the tool produces, this query will retrieve the top 10 upcoming calendar events (and minimize data sent over the wire by doing only a <strong>select</strong> on a few fields):</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p><strong>Both</strong> MVC and Windows 8.1</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">string</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">[] queryParameters = </span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">String</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">.Format(</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">CultureInfo</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.InvariantCulture, </span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515;">"$filter=End ge {0}Z"</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">, </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">DateTime</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">.UtcNow.ToString(</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515;">"s"</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">)),</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515;">"$top=10"</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515; font-size: 9.5pt;">"$select=Subject,Start,End"</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">};</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">string</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> requestUrl = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">String</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">.Format(</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">CultureInfo</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.InvariantCulture,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515;">"{0}/Me/Calendar/Events?{1}"</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">serviceInfo.ApiEndpoint,</span></span></span></span></p>
<span style="font-family: Consolas;"><span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="color: #2b91af;">String</span></span><span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="color: #000000;">.Join(</span></span><span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="color: #a31515;">"&amp;"</span></span></span><span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">, queryParameters));</span></span></span></td>
</tr>
</tbody>
</table>
<p>Note that to reduce error, the code above substitutes <strong>serviceInfo.ApiEndpoint</strong> into the beginning of the query, so that you don&rsquo;t have to type out the same API endpoint (&ldquo;https://outlook.office365.com/ews/odata&rdquo;) every time. In addition to saving on typing, this pattern also makes calling different services consistent, whether the API endpoint is static (as it is for Exchange and Active Directory Graph) or dynamically discovered (as in the case of OneDrive for Business).</p>
<h3>Step 3: Prepare the HTTP request</h3>
<p>Now that the URL for obtaining the data is prepared, the next step is to create <strong>HttpClient </strong>and <strong>HttpRequestMessage </strong>objects. While the sample code creates a new <strong>HttpClient </strong>object every time, you may instead choose to keep it around for easy reuse. The code is the same across project types and fairly similar across service types as well. Differences worth noting are things like substituting <strong>odata=verbose</strong> versus <strong>odata=minimalmetadata</strong> for the <strong>Accept</strong> headers, depending on the service type. For such things, the MSDN documentation gives guidance on which <strong>Accept</strong> or <strong>ContentType</strong> headers the REST calls expect.</p>
<p>For the case of doing a simple Get on Exchange, the following will suffice:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p><strong>Both</strong> MVC and Windows 8.1</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">using</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> (</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpClient</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> client = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">new</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpClient</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">())</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">Func</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">&lt;</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpRequestMessage</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">&gt; requestCreator = () =&gt;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">{</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpRequestMessage</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> request = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">new</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpRequestMessage</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">(</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpMethod</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.Get, requestUrl);</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">request.Headers.Add(</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515;">"Accept"</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">, </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515;">"application/json;odata=minimalmetadata"</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">);</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">return</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> request;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">};</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt;"><span style="line-height: 10pt;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt;"><span style="line-height: 10pt;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">&lt;Upcoming code here&gt;</span></span></span></span></p>
<span style="list-style-type: disc; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></td>
</tr>
</tbody>
</table>
<p>You may wonder, why do we create a lambda (e.g., a function that returns an <strong>HttpRequestMessage</strong>) rather than just creating the appropriate <strong>HttpRequestMessage</strong> object? The reason is that a request could fail because of an expired access token, in which case a new access token would need to be created and a new request dispatched to the service. Because an <strong>HttpRequestMessage</strong> object cannot be used more than once, the procedure for creating the request is captured as a lambda.</p>
<p>The whole business of retrying a request sounds tricky, but fortunately our helper code handles it for you. All you need to do is use the helper, and then you can just read the data. The only difference between the MVC code and the Windows 8.1 code is the name of the helper: <strong>Office365Helper</strong> vs. <strong>Office365CommonController</strong>.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p>MVC Web App</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">using</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> (</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpResponseMessage</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> response = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">await</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">Office365Helper</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">SendRequestAsync(serviceInfo, client, requestCreator))</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">&lt;Upcoming code here&gt;</span></span></span></span></p>
<span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></td>
</tr>
<tr>
<td valign="top" width="90">
<p>Windows 8.1</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">using</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> (</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">HttpResponseMessage</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> response = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">await</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">Office365CommonController</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">SendRequestAsync(serviceInfo, client, requestCreator))</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">&lt;Upcoming code here&gt;</span></span></span></span></p>
<span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></td>
</tr>
</tbody>
</table>
<h3>Step 4: Read the response and de-serialize the data</h3>
<p>With the response received, it&rsquo;s time to read the response object; and, in case of failure, to use the common error-handling function to parse out the human-readable error from the response and display it to the user. As mentioned before, the error-handling implementation has a basic default behavior, but you can customize it to suit your needs. The code is the same across service types, and only mildly different between platforms (redirecting to a special error view in the case of MVC, versus displaying an error dialog in the case of Windows 8.1)</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p>MVC Web App</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">string</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> responseString = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">await</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> response.Content.ReadAsStringAsync();</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> (!response.IsSuccessStatusCode)</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">return</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">Office365CommonController</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.ShowErrorMessage(</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">serviceInfo, responseString);</span></span></span></span></p>
<span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></td>
</tr>
<tr>
<td valign="top" width="90">
<p>Windows 8.1</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">string</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> responseString = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">await</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> response.Content.ReadAsStringAsync();</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">if</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> (!response.IsSuccessStatusCode)</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">await</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">Office365Helper</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.ShowErrorMessageAsync(</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">serviceInfo, responseString);</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">return</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">null</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">;</span></span></span></p>
<span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></td>
</tr>
</tbody>
</table>
<p>Finally, if the response was successful, you typically want to perform some action based on the response. For <strong>GET</strong> operations such as retrieving mail, calendar, or files, this may involve de-serializing the data. For <strong>POST</strong> operations, you may still want to de-serialize the data, or you might be content to know that the operation succeeded.</p>
<p>If you do need to de-serialize the data, using a library such as Json.NET (which is added automatically to the project when you add an Office 365 service) makes it possible to work with the returned data as if it is a .NET object. First, however, you need to define the shape of the data that you expect to receive over the wire. The same <a href="https://msdn.microsoft.com/library/office/dn605892(v=office.15).aspx">MSDN documentation</a> as before will show the shape of the returned data. Thus, continuing with the previous example, the section on <a href="https://msdn.microsoft.com/library/office/dn605896(v=office.15).aspx#sectionSection6">Work with calendar items</a> defines not only the query format, but also the entirety of the object that you will get back.</p>
<p>Trimming for brevity, the MSDN documentation shows something like this:</p>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000; font-family: Consolas; font-size: 9pt;">{</span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp; </span></span><span style="font-size: 9pt;">"@odata.context": "https://outlook.office365.com/EWS/OData/$metadata#Me/<br />Calendar/Events", </span></span></span></span><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="font-size: 9pt;">"value": [</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">{</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"@odata.id": "https://outlook.office365.com/EWS/OData/Users<br />('sadie@contoso.com')/Events('AAMkAGI3...')",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">...</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"Subject": "Lunch",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">...</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"Start": "2014-02-13T20:30:00Z",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"End": "2014-02-13T21:00:00Z",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">...</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">},</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">{</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"@odata.id": "https://outlook.office365.com/EWS/OData/Users<br />('sadie@contoso.com')/Events('AAMkAGI3...')",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">...</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"Subject": "Test new REST API",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">...</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"Start": "2014-02-13T16:00:00Z",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">"End": "2014-02-13T17:00:00Z",</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9pt;">}</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000;"><span style="font-family: Consolas;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp; </span></span><span style="font-size: 9pt;">]</span></span></span></span></pre>
<pre style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; border-style: none; padding: 0px;"><span style="mso-bidi-font-size: 10.0pt; mso-ansi-language: en;" lang="EN"><span style="color: #000000; font-family: Consolas; font-size: 9pt;">}</span></span></pre>
<p><strong>Tip</strong> While MSDN can be great for initial familiarization with the data step, sometimes you want to experiment with the data against live data in real-time. A common technique is to dispatch the request and then watch the response using a debugging proxy such as Fiddler. In fact, if you run the sample code, you can use Fiddler to intercept the request (Access Token and all) &ndash; and then use the <strong>Composer</strong> tab in Fiddler to re-issue the request with minor modifications.</p>
<p>In any case, once you know the JSON shape, you can create a plain C# class with properties that match the names of the JSON fields. In the case of the sample files, this class is defined towards the top of the files. Alternatively, you could also extract it into a separate file, for example, to reuse across your project.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p><strong>Both</strong> MVC and Windows 8.1</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">public</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">class</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af; font-size: 9.5pt;">CalendarEvent</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">public</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">string</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> Subject { </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">get</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">; </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">set</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">; }</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">public</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">DateTime</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> Start { </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">get</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">; </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">set</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">; }</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">public</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">DateTime</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> End { </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">get</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">; </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;">set</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">; }</span></span></span></p>
<span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></td>
</tr>
</tbody>
</table>
<p>With the data structure defined, all that remains is to de-serialize it. The exact call can differ slightly between service types, depending on how nested the JSON structure is. For Exchange, it looks like this:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p><strong>Both</strong> MVC and Windows 8.1</p>
</td>
<td valign="top" width="534">
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">var</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"> events = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">JObject</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;">.Parse(responseString)[</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #a31515;">"value"</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">].</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt; line-height: 11pt; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">ToObject&lt;SampleModel.Exchange.</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #2b91af;">CalendarEvent</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">[]&gt;();</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p>Also depending on the service, you may need to do additional post-processing on the results. For example, Exchange does not yet support ordering events on the server, so the sample sorts them locally:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="90">
<p><strong>Both</strong> MVC and Windows 8.1</p>
</td>
<td valign="top" width="534">
<p><span style="list-style-type: disc; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; line-height: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">events = events.OrderBy(e =&gt; e.Start).ToArray();</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p>With that, you have successfully accessed data from the Office 365 cloud. From here, the samples display the data in a basic MVC view or a Windows 8.1 page &ndash; but for authoring your own code, the sky&rsquo;s the limit.</p>
<h2>Performing a POST request</h2>
<p>The sample code produced by the Office 365 API Tools shows only <strong>GET</strong> requests. Now that you&rsquo;ve seen how a <strong>GET</strong> request works, how do you go about authoring a <strong>POST</strong> request? The answer: Follow the exact same pattern!</p>
<p>To demonstrate that the patterns are in fact the same, I will round off this article with an example of issuing a <strong>POST</strong> request, such as adding a new contact to Exchange.</p>
<p>As before, we start with looking at the MSDN documentation to see the prototypical way to create a contact. In the <a href="https://msdn.microsoft.com/EN-US/library/office/dn605896(v=office.15).aspx#sectionSection7">Create a contact</a> section, we see:</p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: normal;"><span style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Segoe UI';"><span style="color: #454545; font-size: 10pt;">To create a contact, send a POST request to the <strong>Contacts</strong> property of the contacts folder with a JSON representation of the new contact in the payload. The following example creates a new contact in the default Contacts folder.</span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: normal;"><span style="mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Segoe UI';"><span style="color: #454545; font-size: 10pt;">&nbsp;</span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">POST https://outlook.office365.com/ews/odata/Me/Contacts HTTP/1.1</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">Accept: application/json</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">Content-Type: application/json;odata.metadata=full</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">Expect: 100-continue</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">&nbsp;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp; </span></span><span style="font-size: 9pt;">"@odata.type": "#Microsoft.Exchange.Services.OData.Model.Contact",</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp; </span></span><span style="font-size: 9pt;">"GivenName": "Mara",</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp; </span></span><span style="font-size: 9pt;">"Surname": "Whitley",</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9pt;">&nbsp; </span></span><span style="font-size: 9pt;">"EmailAddress1": "mara@fabrikam.com"</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 8pt 0.5in; line-height: 16.65pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="mso-bidi-font-size: 10.0pt; mso-fareast-font-family: 'Times New Roman';"><span style="font-family: Courier New;"><span style="color: #000000; font-size: 9pt;">}</span></span></span></p>
<p>First, ensure you have appropriate permissions by going back to the <strong>Services Manager</strong> dialog. For this example, select <strong>Exchange</strong>, then <strong>Configure</strong>, and then <strong>Have full access to the users&rsquo; contacts</strong>.</p>
<p>With this done &ndash; and having added an entry point (such as a method off of a button click, with appropriate error handling) for invoking the action &ndash; you would follow the same steps as before. In broad strokes:</p>
<ol>
<li>Obtain information for communicating with the services.</li>
<li>Create a URL corresponding to the <strong>ODATA</strong> request &ndash; and, in the case of a <strong>POST</strong> request, prepare a data structure for transmitting the data.</li>
<li>Prepare the HTTP request.</li>
<li>Send the request.</li>
<li>Read the response and handle errors.</li>
</ol>
<p>The biggest difference is in step #3, when preparing the <strong>HttpRequestMessage</strong> object:</p>
<ul>
<li>The request must be a <strong>POST</strong> rather than a <strong>GET</strong>.</li>
<li>The <strong>Accept</strong> header may need to be adjusted, depending on what the documentation prescribes.</li>
<li>A <strong>Content</strong> header must be added.</li>
<li>The request content must be set to the serialized JSON.</li>
</ul>
<p>Here is the code in its entirety, for a Windows 8.1 app:</p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #0000ff;"><span style="font-size: 9.5pt;">private</span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">class</span></span></span><span><span style="color: #2b91af; font-size: 9.5pt;">Contact</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">{</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">[</span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #2b91af;">JsonProperty</span></span><span><span style="color: #000000;">(</span></span><span><span style="color: #a31515;">"@odata.type"</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">)]</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">public</span></span><span><span style="color: #0000ff;">string</span></span><span><span style="color: #000000;"> EntityType { </span></span><span><span style="color: #0000ff;">get</span></span><span><span style="color: #000000;">; </span></span><span><span style="color: #0000ff;">set</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">; }</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">public</span></span><span><span style="color: #0000ff;">string</span></span><span><span style="color: #000000;"> GivenName { </span></span><span><span style="color: #0000ff;">get</span></span><span><span style="color: #000000;">; </span></span><span><span style="color: #0000ff;">set</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">; }</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">public</span></span><span><span style="color: #0000ff;">string</span></span><span><span style="color: #000000;"> Surname { </span></span><span><span style="color: #0000ff;">get</span></span><span><span style="color: #000000;">; </span></span><span><span style="color: #0000ff;">set</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">; }</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">public</span></span><span><span style="color: #0000ff;">string</span></span><span><span style="color: #000000;"> EmailAddress1 { </span></span><span><span style="color: #0000ff;">get</span></span><span><span style="color: #000000;">; </span></span><span><span style="color: #0000ff;">set</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">; }</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;"><span style="font-size: 9.5pt;">private</span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">async</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">Task</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> AddContact() {</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #008000; font-size: 9.5pt;">// Obtain information for communicating with the service:</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">Office365ServiceInfo</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;"> serviceInfo = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">await</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">Office365ServiceInfo</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.GetExchangeServiceInfoAsync();</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">if</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> (!serviceInfo.HasValidAccessToken)</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">{</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">return</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">}</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span><span style="color: #008000; font-size: 9.5pt;">// Create the data structure and the URL corresponding to the ODATA request</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #2b91af;">Contact</span></span><span><span style="color: #000000;"> contact = </span></span><span><span style="color: #0000ff;">new</span></span><span><span style="color: #2b91af;">Contact</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">()</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">{</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">EntityType = </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #a31515;">"#Microsoft.Exchange.Services.OData.Model.Contact"</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">GivenName = </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #a31515;">"Mara"</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">Surname = </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #a31515;">"Whitley"</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">EmailAddress1 = </span></span></span><span><span style="color: #a31515; font-size: 9.5pt;">"mara@gabrikam.com"</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">};</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">string</span></span><span><span style="color: #000000;"> requestUrl = </span></span><span><span style="color: #2b91af;">String</span></span><span><span style="color: #000000;">.Format(</span></span><span><span style="color: #2b91af;">CultureInfo</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">.InvariantCulture,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #a31515;">"{0}/Me/Contacts"</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">,</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;</span></span><span style="font-size: 9.5pt;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>serviceInfo.ApiEndpoint);</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #008000; font-size: 9.5pt;">// Prepare the HTTP request:</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">using</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;"> (</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">HttpClient</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;"> client = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">new</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">HttpClient</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">())</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">{</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">Func</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;">&lt;</span></span><span><span style="color: #2b91af;">HttpRequestMessage</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">&gt; requestCreator = () =&gt;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">{</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #2b91af;">HttpRequestMessage</span></span><span><span style="color: #000000;"> request = </span></span><span><span style="color: #0000ff;">new</span></span><span><span style="color: #2b91af;">HttpRequestMessage</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">(</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #2b91af;">HttpMethod</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">.Post, requestUrl);</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">request.Headers.Add(</span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #a31515;">"Accept"</span></span><span><span style="color: #000000;">, </span></span><span><span style="color: #a31515;">"application/json;odata.metadata=full"</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">);</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">request.Content = </span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">new</span></span><span><span style="color: #2b91af;">StringContent</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">(</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #2b91af;">JsonConvert</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">.SerializeObject(contact)); </span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">request.Content.Headers.ContentType = </span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">new</span></span><span><span style="color: #2b91af;">MediaTypeHeaderValue</span></span><span><span style="color: #000000;">(</span></span><span><span style="color: #a31515;">"application/json"</span></span></span><span><span style="color: #000000; font-size: 9.5pt;">);</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span><span style="color: #0000ff;">return</span></span></span><span><span style="color: #000000; font-size: 9.5pt;"> request;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">};</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span><span style="color: #008000;"><span style="font-size: 9.5pt;">// Send the request using a helper method</span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-size: 9.5pt;">, which will add an authorization header to the request,</span></span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #008000; font-size: 9.5pt;">// and automatically retry with a new token if the existing one has expired.</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">using</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;"> (</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">HttpResponseMessage</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;"> response = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">await</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">Office365Helper</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.SendRequestAsync(</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">serviceInfo, client, requestCreator))</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">{</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #008000; font-size: 9.5pt;">// Read the response and deserialize the data:</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">string</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;"> responseString = </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">await</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> response.Content.ReadAsStringAsync();</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">if</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;"> (!response.IsSuccessStatusCode)</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">{</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">await</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">Office365Helper</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">.ShowErrorMessageAsync(serviceInfo, responseString);</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">return</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">}</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">&nbsp;</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="font-family: Consolas;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="mso-spacerun: yes;"><span style="color: #000000;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span style="font-size: 9.5pt;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">await</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #0000ff;">new</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #2b91af;">MessageDialog</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;">(</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #a31515;">"Contact added successfully!"</span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000;">, </span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #a31515;">"Success!"</span></span></span><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="color: #000000; font-size: 9.5pt;">).ShowAsync();</span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">}</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000;"><span style="mso-spacerun: yes;"><span style="font-size: 9.5pt;">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 9.5pt;">}</span></span></span></span></p>
<p class="MsoNormal" style="list-style-type: disc; margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"><span style="background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; mso-highlight: white;"><span style="font-family: Consolas;"><span style="color: #000000; font-size: 9.5pt;">}</span></span></span></p>
<p>For an MVC project, the code would be largely the same. <em>For real-world applications, though, the one important difference between Windows 8.1 and MVC code is the initial authentication piece.</em> Whereas a Windows 8.1 app will display a dialog box that prompts the user to enter credentials &ndash; and which the code can just &ldquo;await&rdquo; &ndash; an MVC web project must do a redirect to an authentication provider (e.g., redirect to https://login.windows.net/) before getting redirected back to the MVC controller. As such, if the action is state-full (e.g., you&rsquo;re adding a contact based on information submitted by the user), you will need to ensure that this information is persisted when the login page returns. You can do this in a variety of ways &ndash; for example, storing a cookie, encoding the information as a query parameter on the URL passed to <strong>serviceInfo.GetAuthorizationUrl</strong>, or ensuring that even a blank form requires the user to log in first.</p>
<p>I hope this blog post has helped you to get started with authoring your own Office 365 APIs code. To learn more, I invite you to read the <a href="https://msdn.microsoft.com/library/office/dn605893">MSDN documentation on Office 365 APIs</a>, and &ndash; if you&rsquo;ve haven&rsquo;t already &ndash; to watch The <a href="https://channel9.msdn.com/Blogs/funkyonex/Office-365-API-Tools-for-Visual-Studio">Office 365 API Tools for Visual Studio</a> video on Channel 9 that touches upon many of the points in this post.</p>
<p><a href="https://channel9.msdn.com/Blogs/funkyonex/Office-365-API-Tools-for-Visual-Studiohttp:/channel9.msdn.com/Blogs/funkyonex/Office-365-API-Tools-for-Visual-Studio"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/3162.image_6668F2DA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/3162.image_5F00_6668F2DA.png" alt="image" width="456" height="341" border="0" /></a></p>
<p><em>Video: Office 365 API Tools for Visual Studio</em></p>
<p>- Michael Zlatkovsky, Program Manager on the Office Developer Tools team at Microsoft</p>]]></content:encoded>
    </item>
    <item>
      <title>Cross-post from the Exchange dev blog: Customizing the compose experience with mail apps for Outlook</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/cross-post-from-the-exchange-dev-blog-customizing-the-compose-experience-with-mail-apps-for-outlook</link>
      <pubDate>Mon, 31 Mar 2014 06:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/03/31/cross-post-from-the-exchange-dev-blog-customizing-the-compose-experience-with-mail-apps-for-outlook/</guid>
      <description><![CDATA[On 3/27, Andrew Salamatov published Customizing the compose experience with mail apps for Outlook....]]></description>
      <content:encoded><![CDATA[<p>On 3/27, Andrew Salamatov published <a href="https://blogs.msdn.com/b/exchangedev/archive/2014/03/27/customizing-the-compose-experience-with-mail-apps-for-outlook.aspx">Customizing the compose experience with mail apps for Outlook</a>. In his post, he talks about how you can customize your compose experience in <a href="https://msdn.microsoft.com/library/office/fp161135(v=office.15).aspx">apps for Outlook.</a><p>Compose apps are available for all our customers on Office 365 and for on-premises customers that have installed the Service Pack 1 for <a href="https://support.microsoft.com/kb/2817430">Office 2013</a> and <a href="https://support.microsoft.com/kb/2926248">Exchange 2013</a>.</p><p>Check Andrew&rsquo;s post in the <a href="https://blogs.msdn.com/b/exchangedev/">Exchange dev blog</a> and build great apps for Outlook!</p></p>
]]></content:encoded>
    </item>
    <item>
      <title>Office 365 for Developers at //build 2014</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/office-365-for-developers-at-build-2014</link>
      <pubDate>Fri, 28 Mar 2014 06:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/03/28/office-365-for-developers-at-build-2014/</guid>
      <description><![CDATA[Come see us at this year’s //build conference as we take you on a journey through the latest...]]></description>
      <content:encoded><![CDATA[<p><img title="Build 2014 logo" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Build 2014 logo" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/8272.clip_image002_4DA40B8D.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/8272.clip_5F00_image002_5F00_4DA40B8D.jpg" width="624" height="269" /></p>  <p>Come see us at this year’s <a href="https://www.buildwindows.com/">//build</a> conference as we take you on a journey through the latest updates and improvements to the Office and SharePoint APIs and Services. We have made huge investments in the developer capabilities for apps for Office and SharePoint, as well as the new Office 365 APIs, which are services that enable external access to Office 365 data.</p>  <p>Don’t miss these Office developer track sessions at //build:</p>  <p>Start your journey with an overview of all the things that are new in Office and SharePoint development with the <b>Build Connected Productivity Apps (2-567) </b>session, then explore the details of the new APIs in the sister sessions <b>Office Power Hour (3-568)</b>, <b>SharePoint Power Hour (3-569)</b> and <b>Apps for Outlook Power Hour (3-574)</b>. Next, we’ll go through more examples of how SharePoint apps can be created using some of the most widely used 3<sup>rd-</sup>party JavaScript libraries in the <b>SharePoint 2013 Apps with AngularJS (2-570) </b>session.</p>  <p>After that, make it easy for users to work together! Take a little detour into the realm of social, and explore how we can extend the social enterprise experience with <b>Building Enterprise Social Apps with Yammer (3-571)</b>, and how we can enable data capture and retention through customized experiences by using the new OneNote Services APIs in <b>Captivate Consumers with the OneNote API (3-572)</b>.</p>  <p>Finally, we’ll have our friends from the Visual Studio team deep dive into the Cloud Business Apps templates in Visual Studio that enable rapid and agile development of apps for SharePoint with easy connectivity to a variety of external data sources in <b>Developing Office 365 Cloud Business Apps (3-573)</b>.</p>  <p>We’re excited to share the new development APIs available for the Office platform. Stop by the Office booth and get your <b>“Working on it…” t-shirt</b> and <b>invaluable</b> <b>reference posters</b>. We’ll also have expert staff on hand to discuss any of the topics in our sessions or answer any of your questions.</p>  <p>Can't wait for the sessions to start learning more? Check out the content on <a href="https://dev.office.com">https://dev.office.com</a>.</p>  <p>Follow us on Twitter: <a href="https://twitter.com/MSDN_Office">@MSDN_Office</a></p>  <p>See you in San Francisco!</p>  <p>Office Developer Platform Team</p>]]></content:encoded>
    </item>
    <item>
      <title>Integrating documents into cloud business apps</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/integrating-documents-into-cloud-business-apps</link>
      <pubDate>Tue, 18 Mar 2014 10:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/03/18/integrating-documents-into-cloud-business-apps/</guid>
      <description><![CDATA[Documents are critical pieces of information in many business applications. That’s why we added...]]></description>
      <content:encoded><![CDATA[<p><i>Documents are critical pieces of information in many business applications. That’s why we added support for easily attaching to Office 365 or SharePoint document libraries in the latest release of Cloud Business Apps in Visual Studio 2013. With the <a href="https://blogs.msdn.com/b/visualstudio/archive/2014/03/03/announcing-office-developer-tools-for-visual-studio-2013-march-2014-update.aspx">Microsoft Office Developer Tools for Visual Studio 2013—March 2014 Update</a>, it is now easier than ever to attach to document libraries and interact with documents in your application.</i></p>  <p>Let’s walk through an example. Imagine we are store owners who sell a variety of products, and would like to use SharePoint to store documents related to those products, such as manuals, warranties, sales presentations, and notes. In this example, we will create a Cloud Business App (CBA) that relates our products to documents stored on Office 365 or SharePoint 2013. We will also create screens to allow access to those related documents.</p>  <h1>Choose the SharePoint document library</h1>  <p>On the SharePoint site, choose a document library to store documents relating to our products. The document library needs to be on the same site and <a href="https://msdn.microsoft.com/en-us/library/office/fp179925.aspx">host web</a> as our CBA app when we deploy, so the app has access to the library. We need to create a column to track which product the document belongs to, in this case use the string field Product. While the document library list can have associated content types, the shared column needs to be a list column so it is available for every document.</p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 1. Choose a Document Library List with a field to store the associated product" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 1. Choose a Document Library List with a field to store the associated product" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6180.clip_image002_4D6EC6B9.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6180.clip_5F00_image002_5F00_4D6EC6B9.jpg" width="625" height="663" />     <br />Figure 1. Choose a Document Library List with a field to store the associated product.</div>  <h1>Create tables in Visual Studio</h1>  <ol>   <li><a href="https://msdn.microsoft.com/en-us/library/dn454600.aspx">Create a new Cloud Business App project</a> (VB or C#). Select our debugging SharePoint site. This site should mirror the document library we have set up on the production site.       <p><i>Note: If we had created the Cloud Business App with a previous version of Visual Studio, upgrade the app and update the SharePoint data sources. If the entities were SharePoint Document Libraries they will be ready for use after the update. To upgrade the app, choose the project in Solution Explorer and select &quot;Upgrade Project...&quot;</i></p>   </li>    <li>Create a table named <b>Product.</b>       <p>a. Add a new field <b>ProductName</b> as type <b>string</b>.</p>      <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 2. Create the products table" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 2. Create the products table" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/5516.clip_image003_1B0AF33A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/5516.clip_5F00_image003_5F00_1B0AF33A.png" width="624" height="145" />         <br />Figure 2. Create the products table.</div>   </li>    <li>     <p>Set the <b>Include in Unique Index</b> property for this field so we do not have two products with the same name. Alternatively, we can choose to auto-populate a string field with any unique key, like a GUID, by writing code in the Product_<i>Inserting </i>event. We need a unique field so it can be associated with a column on the document library. </p>      <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 3. Set the ProductName field property to Include in Unique Index" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 3. Set the ProductName field property to Include in Unique Index" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/8244.clip_image005_1DB3AEEB.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/8244.clip_5F00_image005_5F00_1DB3AEEB.jpg" width="625" height="255" />         <br />Figure 3. Set the ProductName field property to Include in Unique Index.</div>   </li> </ol>  <h1>Add data source for the document library</h1>  <ol>   <li>Add a new data source by choosing the Data Sources node in the Solution Explorer and then choosing <b>SharePoint</b>.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 4. Attach to a SharePoint data source" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 4. Attach to a SharePoint data source" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/0333.clip_image007_16947273.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/0333.clip_5F00_image007_5F00_16947273.png" width="624" height="499" />         <br />Figure 4. Attach to a SharePoint data source.</div>   </li>    <li>The SharePoint site is already filled in with the site we used when creating the project. The document library must reside on the same debugging site as our app. When we deploy the app, we need to verify the ProductDocument library exists on the production site. The Publish Wizard will walk us through this. For more information, see the <a href="https://msdn.microsoft.com/en-us/library/dn592162(v=office.15).aspx"><i>Publish Cloud Business Apps</i></a><i> </i>topic in the MSDN library.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 5. Choose to connect to the host web SharePoint site" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 5. Choose to connect to the host web SharePoint site" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6683.clip_image009_565E58F8.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6683.clip_5F00_image009_5F00_565E58F8.jpg" width="624" height="499" />         <br />Figure 5. Choose to connect to the host web SharePoint site.</div>   </li>    <li>Depending on our SharePoint site's security, we will be prompted for our credentials when we choose <b>Next</b>. Select <b>Document Libraries</b> to show the document library lists, and select our library. We can now search for the library using the search box and get more information about the library—including the fields and related tables.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 6. Select the document library entity" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 6. Select the document library entity" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/3377.clip_image011_7D2C6F38.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/3377.clip_5F00_image011_5F00_7D2C6F38.png" width="624" height="499" />         <br />Figure 6. Select the document library entity.</div>   </li>    <li>Choose <b>Finish</b> to add the data source to our project.</li> </ol>  <h1>Set Relationship between the Product Documents entity and Product</h1>  <ol>   <li>In the ProductDocuments entity designer, select <b>Add: Relationship.</b></li>    <li>Set up the relationship as shown in the image below. Each product can have many documents, and the fields we set up earlier are the shared fields.      <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 7. Set up the relationship to the document library" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 7. Set up the relationship to the document library" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/0247.clip_image012_18D0FB2F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/0247.clip_5F00_image012_5F00_18D0FB2F.png" width="500" height="665" />         <br />Figure 7. Set up the relationship to the document library.</div>   </li> </ol>  <h1>Add screens</h1>  <ol>   <li>Choose the Client project screen node in the Solution Explorer and choose <b>Add Screen….</b> In the dialog box, choose the <b>Common Screen Set</b>. The Common Screen set creates the Browse, View, and Add/Edit screens all at once and configures them for the associated data. For screen data, choose the <b>Products</b> table and choose <b>Product ProductDocuments</b>. Choose <b>OK</b> to create the screens.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 8. Create the product common screens" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 8. Create the product common screens" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/5050.clip_image014_589AE1B4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/5050.clip_5F00_image014_5F00_589AE1B4.png" width="624" height="444" />         <br />Figure 8. Create the product common screens.</div>   </li>    <li>Once the screens are created, observe the view details screen where we included the related documents. There is a tab called <b>Product Documents</b> that has a tile list to containing the documents. The row of the tile list is using the new <b>Document Summary </b>control. There is also an <b>Add</b> command bar button to add or upload new documents. We do not need to make any changes to the screen to get the document functionality.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 9. The Product Documents row uses a Document Summary control" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 9. The Product Documents row uses a Document Summary control" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/2311.clip_image016_1864C83A.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/2311.clip_5F00_image016_5F00_1864C83A.jpg" width="625" height="380" />         <br />Figure 9. The Product Documents row uses a Document Summary control.</div>   </li> </ol>  <h1>Running the app</h1>  <p>Choose <b>Start Debugging</b> (F5) to start the app. We may need to enter our credentials and we will need to trust the app. When the app loads, it will open to the <b>Product</b> page where we can add a product.</p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 10. Create a new product" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 10. Create a new product" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6114.clip_image018_6D203132.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6114.clip_5F00_image018_5F00_6D203132.png" width="624" height="467" />     <br />Figure 10. Create a new product.</div>  <p>Once the product is added, select the product to view details and open the <b>Product Documents</b> tab. Choose the <b>Add</b> button to create a new document or upload an existing document. The item named <b>Document</b> is the default template added for new document libraries. We can customize which templates are associated with the library in SharePoint and they will appear in the popup list for easy creation. For now, create a Word document.</p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 11. Create a new document for the product" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 11. Create a new document for the product" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/2816.clip_image020_5AD76A70.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/2816.clip_5F00_image020_5F00_5AD76A70.png" width="624" height="467" />     <br />Figure 11. Create a new document for the product.</div>  <p>This will open the document in Office Online. Using Office Online, we can rename the document by selecting the name on the menu bar and add our content to the document body. </p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 12. Use Office Online to rename and edit the new document" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 12. Use Office Online to rename and edit the new document" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/7041.clip_image021_683D7D76.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/7041.clip_5F00_image021_5F00_683D7D76.png" width="624" height="467" />     <br />Figure 12. Use Office Online to rename and edit the new document.</div>  <p>When the edits are complete, just choose the back button to return to the product view page. Office Online auto-saves your document—so we don't need to explicitly save.</p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 13. Documents for the selected product appear in the tile list" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 13. Documents for the selected product appear in the tile list" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/5808.clip_image023_2EBA6D7F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/5808.clip_5F00_image023_5F00_2EBA6D7F.png" width="624" height="467" />     <br />Figure 13. Documents for the selected product appear in the tile list.</div>  <p>Selecting the document in the tile list will open the document to allow viewing or editing. It will open the desktop Office client if we have it installed or Office Online if the desktop version is not installed.</p>  <h1>Publishing</h1>  <p>CBA apps have flexible <a href="https://msdn.microsoft.com/en-us/library/dn454601(v=vs.120).aspx">deployment options</a>. When we run the Publish Wizard, the SharePoint library address will automatically be updated to point at the host web of the publish site. Create the library with the same columns on this site so the app can find it.</p>  <p>Once the app is published, we can access the app on desktop, tablet, or phone and the layout will adjust for the best experience. Here's what it looks like on my phone. Pretty cool!</p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 14. The document tile list adjusts format for device form factors" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 14. The document tile list adjusts format for device form factors" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/7140.clip_image024_558883BF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/7140.clip_5F00_image024_5F00_558883BF.png" width="482" height="803" />     <br />Figure 14. The document tile list adjusts format for device form factors.</div>  <h1>Enable support for legacy browsers</h1>  <p>To allow uploading documents on legacy browsers such as Internet Explorer 9, add a NuGet package to the server project. Choose the server project and choose <b>Manage NuGet Packages</b> from the context menu. In the NuGet manager, select <b>Online, </b>search for &quot;web pages,&quot; choose <b>Microsoft ASP.NET Web Pages</b> package, and select <b>Install</b>. This package will also install two dependent packages; <b>Accept</b> the license agreement to install the packages.</p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 15. Install Microsoft ASP.NET Web Pages NuGet Package for legacy browser support" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 15. Install Microsoft ASP.NET Web Pages NuGet Package for legacy browser support" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/3362.clip_image026_712D0FB5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/3362.clip_5F00_image026_5F00_712D0FB5.png" width="624" height="416" />     <br />Figure 15. Install Microsoft ASP.NET Web Pages NuGet Package for legacy browser support.</div>  <p>The <a href="https://go.microsoft.com/fwlink/?LinkId=392086"><i>Troubleshooting document libraries</i></a> topic provides more information about enabling legacy browser support.</p>  <h1>Summary</h1>  <p>The document library support added in the Office Developer Tools for Visual Studio—March 2014 Update provides a way to seamlessly integrate SharePoint document libraries into your applications, without needing to write any code. CBA apps excel at showing a table entity and all of its related documents. Uploading documents, creating new documents from templates or blank Word, Excel, or PowerPoint documents, and editing documents in Office Online or Office desktop are supported.</p>  <p>The <a href="https://channel9.msdn.com/Series/CBA/How-Do-I-Incorporate-Document-Libraries-in-a-Cloud-Business-App-"><i>How Do I: Incorporate Document Libraries in a Cloud Business App?</i></a> topic provides a video demonstration about integrating document libraries.<i></i></p>  <p>-Ed Smith, Software Development Engineer in Test, Cloud Business Applications Team</p>]]></content:encoded>
    </item>
    <item>
      <title>New release: Modern Trend app for Excel</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/new-release-modern-trend-app-for-excel</link>
      <pubDate>Fri, 14 Mar 2014 06:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/03/14/new-release-modern-trend-app-for-excel/</guid>
      <description><![CDATA[The Microsoft ecoSystem group is pleased to announce the free Modern Trend app for Excel. It is now...]]></description>
      <content:encoded><![CDATA[<p>The Microsoft ecoSystem group is pleased to announce the free <a href="https://office.microsoft.com/en-us/store/modern-trend-WA104220390.aspx?queryid=a1a03251%2D9e7a%2D45b5%2D99bd%2Df1bf2c759c9e&amp;css=trend&amp;CTT=1"><i>Modern Trend app for Excel</i></a>. It is now available on <a href="https://office.microsoft.com/en-us/store"><i>Office Store</i></a>! </p>  <p>The Modern Trend app helps you tell a story based on your Excel data. With a few steps, your data is shown on an interactive trend chart. You can pin the specific data points on the chart, and add descriptions on the canvas.&#160; </p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="Figure 1. Modern Trend app for Excel" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="Figure 1. Modern Trend app for Excel" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/4454.clip_image001_405E709C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/4454.clip_5F00_image001_5F00_405E709C.png" width="512" height="384" /><br/>Figure 1. Modern Trend app for Excel</div>  <p>Currently, the app can:</p>  <ul>   <li>Bind and show your data on a trend chart.&#160; </li>    <li>Basic interactions on the chart</li>    <ul>     <li>Show or hide a line with a legend.</li>      <li>Pin or unpin a data point.</li>   </ul>    <li>Add a description directly on the canvas </li> </ul>  <p>If you are interested in developing your own apps for Office and SharePoint, we have great news: w<em>e will publish the </em>Modern Trend <em>app source code soon. Stay tuned for more great apps for Office and SharePoint released </em>on the <a href="https://office.microsoft.com/en-us/store/wikipedia-WA104099688.aspx?queryid=f475db14%2Da920%2D4409%2D8586%2Dcc22c4e9cd46&amp;css=wikipedia&amp;CTT=1"><i>Office Store</i></a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>Announcing Office 365 API Tools for Visual Studio — Preview</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/announcing-office-365-api-tools-for-visual-studio-preview</link>
      <pubDate>Wed, 12 Mar 2014 06:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/03/12/announcing-office-365-api-tools-for-visual-studio-preview/</guid>
      <description><![CDATA[UPDATE 5/12/2014 - A new preview is available. You can now access the Office 365 APIs using client...]]></description>
      <content:encoded><![CDATA[<p><strong>UPDATE 5/12/2014 - A new preview is available. You can now access the Office 365 APIs using client libraries available for .NET and JavaScript.</strong> See: <em><a href="https://blogs.office.com/2014/05/12/net-and-javascript-libraries-for-office-365-apis/">.NET and JavaScript libraries for Office 365 APIs</a></em></p>
<p><em>Office 365 APIs enable developers to integrate Office resources (such as calendars, contacts, mail, files, and profile information) directly into their custom applications. For example, with Office 365 APIs, a native WinRT application could add calendar appointments directly into a user's Exchange calendar or send mail on behalf of the user. Similarly, a web application with export functionality could now offer a "Save to OneDrive" option, saving a user's files directly to their SharePoint "My Documents" folder.</em> <br />&nbsp; <br />We are excited about the new scenarios that <a href="https://msdn.microsoft.com/library/office/dn605893">Office 365 APIs</a> will enable, and are committed to making it easy for every developer to try out these new platform capabilities. With today&rsquo;s release of our <a href="https://aka.ms/office365apitoolspreview">"Office 365 API Tools - Preview" for Visual Studio 2013</a>, adding and using Office 365 APIs is literally a few clicks away. Our tool will:</p>
<ol>
<li>Register and configure your app to consume Office 365 Services.</li>
<li>Add helper classes for authentication, caching, and error-handling.</li>
<li>Add the necessary libraries (<a href="https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/">Active Directory Authentication Library</a> and <a href="https://www.nuget.org/packages/Newtonsoft.Json/">Json.NET</a>) from NuGet, to ensure that the helper classes and sample code work right away.</li>
<li>Add sample code that uses Office 365 APIs and demonstrates common patterns and best-practices.</li>
</ol>
<p>Best of all, our tool:</p>
<ul>
<li>Is available for both MVC Web Applications and Windows 8.1 apps. In fact, with the help of our helper classes, the code you'll write for MVC apps can be almost identical to what you'd write in a Windows 8.1 app, and vice-versa.</li>
<li>Is available for both C# and VB.NET projects.</li>
<li>Is explicitly designed for adding Office 365 APIs to existing applications, and for adding and configure new services at any time: not just on initial project creation. This means you can try out the new Office 365 APIs on real-world scenarios without needing to start a new project. Better yet, you can start small and then iteratively expand on the Office 365 services that you use.</li>
</ul>
<p>The walkthrough below will guide you through adding Office 365 APIs to a web application. You can also view a <a href="https://channel9.msdn.com/Blogs/funkyonex/Office-365-API-Tools-for-Visual-Studio">Channel 9 interview/demo</a>, which demonstrates adding Office 365 to an existing Windows 8.1 app.</p>
<p><a href="https://channel9.msdn.com/Blogs/funkyonex/Office-365-API-Tools-for-Visual-Studio"><img style="border: 0px currentcolor; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="Video: Adding Exchange and SharePoint to an existing Windows 8.1 app" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/2318.Office365Channel9_0FF10555.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/2318.Office365Channel9_5F00_0FF10555.png" alt="Video: Adding Exchange and SharePoint to an existing Windows 8.1 app" width="504" height="376" border="0" /></a></p>
<p><em>Video: Adding Exchange and SharePoint to an existing Windows 8.1 app</em></p>
<h2>Getting Started</h2>
<p>You can get started by <a href="https://aka.ms/office365apitoolspreview">downloading our tool from the Visual Studio Gallery</a>. Close Visual Studio 2013, then choose the .VSIX file and begin setup. A few moments later, the extension will be installed. Now, just open Visual Studio, and follow along in the walkthrough below. <br />&nbsp; <br />Adding Office 365 Services to your project <br />Once you download and install our tool, open (or create) a project that you want to add Office 365 APIs to. The project must be either an MVC web application or a Windows 8.1 app, targeting .NET Framework 4.5 or 4.5.1. We support both C# and VB.NET projects. <br />&nbsp; <br />In the Solution Explorer, choose the project and then choose Add &gt; Connected Service (Figure 1).</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/6560.fig%201.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/6560.fig-1.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/6560.fig%201.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/6560.fig-1.png" alt="" border="0" /></a></p>
<p><em>Figure 1. Add Connected Service</em> <br />&nbsp; <br />A Services Manager dialog box will appear (Figure 2). Depending on your project, you may see a number of tabs on the left pane. Choose Office 365 &gt; Sign in.</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/7384.fig%202.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/7384.fig-2.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/7384.fig%202.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/7384.fig-2.png" alt="" border="0" /></a></p>
<p><em>Figure 2. Services Manager</em> <br />&nbsp; <br />On the sign-in dialog box, enter the username and password for your Office 365 tenant (Figure 3). We recommend that you use your Office 365 Developer Site. Often, this user name will follow the pattern <br />&lt;your-name&gt;@&lt;tenant-name&gt;.onmicrosoft.com. <br />If you do not have a developer site, you can get a free Developer Site as part of your <a href="https://msdn.microsoft.com/library/fp179924(v=office.15).aspx#sectionSection1">MSDN Benefits</a>, or <a href="https://msdn.microsoft.com/library/fp179924(v=office.15).aspx#sectionSection1">sign up</a> for a free trial. Be aware that the user must be an admin user&mdash;but for tenants created as part of an Office 365 Developer Site, this is likely to be the case already. <br />&nbsp; <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/1524.fig%203.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/1524.fig-3.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/1524.fig%203.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/325x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/1524.fig-3.png" alt="" border="0" /></a> <br /><em>Figure 3. Sign-in dialog box</em> <br />&nbsp; <br />After you're signed in, you will see a list of three services: Active Directory Graph, Exchange, and SharePoint. Initially, the Permissions column to the right of each service will be empty&mdash;after all, you have not registered your app to consume any services yet. Choose one of the services (for example, Exchange) from the list and choose OK (Figure 4).</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/1263.Fig%204.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/1263.Fig-4.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/1263.Fig%204.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/1263.Fig-4.png" alt="" border="0" /></a> <br /><em>Figure 4. Adding an Office 365 Service</em> <br />&nbsp; <br />Choosing OK will:</p>
<ul>
<li>Register the app with Windows Azure Active Directory, which serves as the authentication authority for Office 365 APIs.</li>
<li>Add the common Office 365 helper classes and the accompanying NuGet libraries.</li>
<li>Add sample code for the selected service (in the example above, for Exchange).</li>
</ul>
<p>Because no permissions are configured, the tool will also prompt a dialog box to configure permissions (Figure 5). Note that you can return to this same dialog even after the application has been registered, re-opening the Services Manager dialog box and using the Configure&hellip; link to the right of the services grid to modify permissions.</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/4212.fig%205.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/4212.fig-5.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/4212.fig%205.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/4212.fig-5.png" alt="" border="0" /></a></p>
<p><em>Figure 5. Permissions dialog box. Note that the Make this app available to option is only available for Web applications, not for Windows 8.1 apps.</em> <br />&nbsp; <br />The permissions dialog box is different for each of the services. It is also subtly different for web applications versus native Windows 8.1 apps: The Make this app available to &hellip; my tenant only option is only available for Web apps. Native client apps (such as Windows 8.1 apps) don't need this distinction, and can be used on any tenant where the user has granted consent to the app. <br />&nbsp; <br />Choose one or more permissions to proceed with adding the service. For purposes of running the sample code, choose a Read (or higher) permission for each of the services. Be aware that you can choose multiple permissions at the same time: for example, if I want to both read users' mail and send mail on behalf of users, I will need to select both permissions (Figure 6). For other permissions, something like Have full access to the users' calendars already encapsulates the Read users' calendars permission&mdash;but when in doubt, choose both permissions. <br /> <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/4722.fig%206.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/4722.fig-6.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/4722.fig%206.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/311x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/4722.fig-6.png" alt="" border="0" /></a> <br /><em>Figure 6. Selecting multiple permissions within the same category, such as read users' mail, and send mail as a user.</em> <br />&nbsp; <br />After you select the permissions and choose "OK", give our tool a few moments to register your app and add the necessary files and NuGet packages. Now it's time to explore the new files that were added or modified.</p>
<h2>Exploring the project structure</h2>
<p>Once the Service Manager is done adding files, let's look at the Solution Explorer to see which files got added or modified. <br />While the project structure between MVC Web Applications and Window 8.1 apps is quite different (see Figures 7 and 8), the pattern of which files get added or modified stays the same. Our tool:</p>
<ul>
<li>Adds NuGet packages for <a href="https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/">Active Directory Authentication Library</a> and <a href="https://www.nuget.org/packages/Newtonsoft.Json/">Json.NET</a>.</li>
<li>Adds a set of common helper files (that is, files whose names start with "Office365*", such as "Office365ServiceInfo") that are common across different services. These files get added regardless of whether you chose Exchange, SharePoint, or Active Directory, since they are used for all three cases. We expect that you will keep these files in your project, as they will be valuable for your own apps.</li>
<li>Adds a set of service-specific sample files (for example, ExchangeSampleController and its accompanying view folder for an MVC web application, or ExchangeSamplePage.xaml and its accompanying code-behind for a Windows 8.1 app). These files are intended to show how each individual service is used, and to provide a compelling experience when you first try to run the service. Once you have ran the sample and copied any relevant functionality into your own code, you can delete these files.</li>
<li>Modifies Web.config or App.xaml to include the Client ID (and, in the case of web apps the Password) for the app. These values are obtained from the Windows Azure Active Directory, which serves as the authentication authority for Office 365 APIs. Those credentials act as a "link" between the entry in Active Directory and your project within Visual Studio. The Client ID is used both at runtime (for authentication), and by our tool itself (that way, when you return to the Service Manager, we know whether we've already registered your app, and can add or modify services and permissions)</li>
</ul>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/0407.fig%207.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/0407.fig-7.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/0407.fig%207.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/0407.fig-7.png" alt="" border="0" /></a> <br /><em>Figure 7. Files added to an MVC Web Application</em> <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/6557.fig%208.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/6557.fig-8.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/6557.fig%208.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/6557.fig-8.png" alt="" border="0" /></a> <br /><em>Figure 8. Files added to a Windows 8.1 App</em> <br />&nbsp; <br /><strong>Note:</strong> For Windows 8.1 apps, the sample code relies on a set of Windows 8.1 common classes (NavigationHelper, ObservableDictionary, and so on) that are included automatically for non-blank Windows 8.1 apps. The files are found inside of a Common folder at the root of the project. If your project does not contain these files, simply choose Add &gt; New Item &gt; Basic Page (or any other non-Blank page), and add the page to your app. Choose Yes when prompted to add the missing files&mdash;this will ensure that the Common folder is added. After that, you can either delete the new page, or keep it for your own use.</p>
<h2>Running the sample code</h2>
<p>For the Web Application project, choose Debug (or press F5) to run the app. Depending on your web project settings and what file you have open in Visual Studio (our tool automatically opens the controller and the view for the newly-added Office 365 service), your browser may open to the right view by itself. If not, and if it goes to something like "<a href="https://localhost:10247/">https://localhost:10247/</a>", just append "/&lt;Service-Name&gt;Sample/" to the URL: for example, "<a href="https://localhost:10247/ExchangeSample/">https://localhost:10247/ExchangeSample/</a>". <br />&nbsp; <br />Exchange offers several different samples, so going to the Exchange view will give you three buttons to choose from (Figure 9). For this example, I will choose Contacts. In the case of SharePoint and Active Directory, you would be taken directly to the sample.</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/3364.fig%209.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/3364.fig-9.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/3364.fig%209.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/3364.fig-9.png" alt="" border="0" /></a> <br /><em>Figure 9. Running the Exchange sample in a Web application</em> <br />&nbsp; <br />When the app is first run (and on any subsequent closing and re-opening of the browser), the app will have no access tokens or refresh tokens that are necessary for communicating with Office 365 APIs. As such, you will be directed to a login screen (Figure 10). You can enter the same credentials as you used for registering the app&mdash;or you can log in as a different user (or even as a different user on a different tenant, if you had enabled the Make this app available to&hellip; all tenants in the permissions dialog box (Figure 5)). For tenants other than the ones used to register the app, you will also see a consent dialog box after the login screen. <br />&nbsp; <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/2337.fig%2010.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/2337.fig-10.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/2337.fig%2010.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/2337.fig-10.png" alt="" border="0" /></a> <br /><em>Figure 10. An automatic redirect to log in at <a href="https://login.microsoftonline.com">https://login.microsoftonline.com</a></em> <br />&nbsp; <br />After authentication is complete, the browser will redirect you back to your app. You may briefly see something like "<a href="https://localhost:10247/Office365Common">https://localhost:10247/Office365Common</a>" in the address bar, along with some long query parameters. The common controller will handle authentication, will cache the access token and refresh token, and then redirect you back to the page where you came from (for example, "<a href="https://localhost:10247/ExchangeSample/Contacts">https://localhost:10247/ExchangeSample/Contacts</a>"). Now that that page has an access token, it will be able to process the request. For example, you might see something like this (Figure 11). <br />&nbsp; <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/8228.fig%2011.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/8228.fig-11.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/8228.fig%2011.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/8228.fig-11.png" alt="" border="0" /></a> <br /><em>Figure 11. Running the Exchange Contacts sample in a Web application</em> <br />&nbsp; <br />Within a given session, access tokens and refresh tokens are cached&mdash;so you will not need to log in again, even when switching among service, until you close and re-open the browser (or until the session expires due to inactivity). To cache the access tokens and refresh tokens beyond the confines of a session, you can persist them more permanently in a database&mdash;see the comments in the Office365CommonController class. <br />&nbsp; <br /><span style="font-size: small;">Windows 8.1 apps:</span> <br />For Windows 8.1 apps, there is no address bar where you can navigate straight to a particular page. Instead, you will need to add code for an action to take you to the new sample page. For example, you might add a button to your main page. <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;Button Content="Exchange Sample" Click="ExchangeSampleButton_Click" /&gt; <br />Then, in the code-behind, simply do: <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; private void ExchangeSampleButton_Click(object sender, RoutedEventArgs e) <br />&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.Frame.Navigate(typeof(ExchangeSamplePage)); <br />&nbsp;&nbsp;&nbsp; } <br />&nbsp; <br />Having done this, choose Debug (or press F5) to run the app. Be aware that you can run either in full-screen mode on the local machine, or in a Simulator (Figure 12). <br />&nbsp; <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/7411.fig%2012.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/7411.fig-12.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/7411.fig%2012.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/7411.fig-12.png" alt="" border="0" /></a>&nbsp; <br /><em>Figure 12. Simulator vs. Local Machine dropdown for Windows 8.1 apps</em> <br />&nbsp; <br />When you run the app, choose the button to navigate to the sample page. Again, you will either have a choice of samples for Exchange (I will choose Contacts for the example below), or a single sample for Active Directory and SharePoint. In either case, if you are not already signed in with the app, you will be prompted with a login and consent dialog box (Figures 13 and 14).</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/3007.Fig%2013.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/3007.Fig-13.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/3007.Fig%2013.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/3007.Fig-13.png" alt="" border="0" /></a> <br /><em>Figure 13. Windows 8.1 login dialog box</em> <br />&nbsp; <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/0654.Fig%2014.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/0654.Fig-14.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/0654.Fig%2014.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/0654.Fig-14.png" alt="" border="0" /></a> <br /><em>Figure 14. Windows 8.1 consent dialog box</em> <br />&nbsp; <br />Once your app is authenticated and consented, you will see the example functionality (Figure 15).</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/8308.Fig%2016.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/8308.Fig-16.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/8308.Fig%2016.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99/8308.Fig-16.png" alt="" border="0" /></a> <br /><em>Figure 15. Running the Exchange Contacts sample in a Windows 8.1 app</em></p>
<h2>What's Next?</h2>
<p>This post showed how to obtain the <a href="https://aka.ms/office365apitoolspreview">Office 365 API Tools</a>, register an app for Office 365 APIs, and run the sample code. However, this was just the initial setup: the interesting part is once you start authoring your own code to use Office 365 APIs within your Web applications or Windows 8.1 apps.</p>
<p>Stay tuned for a follow-up post where we will explore the sample code that the tool generates, and use that as a building block for writing custom code (for example, to send mail on behalf of a user). For now, take a look at ExchangeSampleController/ExchangeSamplePage (and the analogous Active Directory and SharePoint files) to start looking at the code&mdash;and of course, the <a href="https://msdn.microsoft.com/library/office/dn605893">Office 365 APIs documentation</a>. If you have any questions or feedback, the team is monitoring<a href="https://stackoverflow.com/questions/tagged/Office365APIs"> StackOverflow</a>. Tag your questions [Office365APIs].</p>
<p><em>~ This post was brought to you by Michael Zlatkovsky, a Program Manager on the Office Developer Tools team at Microsoft.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>How to build a cloud business app with SAP data</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/how-to-build-a-cloud-business-app-with-sap-data</link>
      <pubDate>Tue, 11 Mar 2014 06:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/03/11/how-to-build-a-cloud-business-app-with-sap-data/</guid>
      <description><![CDATA[Visual Studio 2013 introduced a new project template for Office 365 Cloud Business App to enable...]]></description>
      <content:encoded><![CDATA[<p><i>Visual Studio 2013 </i><a href="https://blogs.msdn.com/b/officeapps/archive/2013/10/17/announcing-visual-studio-2013-rtm.aspx"><i>introduced a new project template for Office 365 Cloud Business App</i></a><i> to <a name="OLE_LINK6"></a><a name="OLE_LINK5"></a>enable developers to build modern business applications that can integrate with and extend the Office 365 platform experience quickly. The </i><a href="https://msdn.microsoft.com/en-us/library/dn584076(v=office.15).aspx"><i>Cloud Business App template</i></a><i> provides a rich set of tools and features that make it easy to work with data and leverage services such as identity and social to provide mobile-first experiences for Office 365.</i></p>  <p>For the <a href="https://blogs.msdn.com/b/visualstudio/archive/2014/03/03/announcing-office-developer-tools-for-visual-studio-2013-march-2014-update.aspx">Office Developer Tools – March 2014 Update</a>, we’ve added several new features to Cloud Business Apps (CBAs) that enhance the experience for connecting to enterprise data sources. With a CBA, you can now create a line of business app that:</p>  <ul>   <li>Connects to SAP as a first-class data source. </li>    <li>Allows you to easily integrate custom data with SAP data. </li> </ul>  <h1>Overview</h1>  <p>SAP provides a tool called <a href="https://scn.sap.com/community/netweaver-gateway">SAP NetWeaver Gateway</a> that enables the ability to expose SAP application data as an OData service. This OData service can then be used by a CBA to create custom line of business apps. SAP has several <a href="https://scn.sap.com/docs/DOC-31221#section6">sample gateway services</a> you can use for testing and app building. For our example, we will use the <a href="https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/">SAP Enterprise Procurement Model (EPM) service</a>. Read the <a href="https://scn.sap.com/docs/DOC-40986">SAP documentation</a> to learn how to access to the EPM service and other sample services from SAP. Be aware that these sample services are read-only; however, NetWeaver Gateway does support read-write services.</p>  <p>Our SAP CBA app will be based on a <a href="https://scn.sap.com/docs/DOC-44073">fictional company</a> that sells computers and accessories. This company has several locations worldwide, including a distribution branch that we will be building a line of business app for, named <i>Contoso Shipping Management</i>. Specifically, our app will help the branch manager of <i>Contoso Shipping Management </i>with their daily tasks. The branch manager routinely views product information in the system and adds supplemental production information that is specific to their branch (such as the item location and whether items are out of stock).</p>  <h1>Define the data model</h1>  <p>Begin by <a href="https://msdn.microsoft.com/en-us/library/dn454604(v=vs.120).aspx">creating a CBA app</a>; in Visual Studio. Choose the Cloud Business App project template under the <b>Office/SharePoint</b>&gt;<b>Apps</b> node. </p>  <h2>Attach to SAP Data Source</h2>  <p>When you have created the app, attach it to the SAP service.</p>  <ol>   <li>In the <b>Server Explorer, </b>under the <b>Server</b> project, choose the <b>Data Sources</b>&gt;<b>Add Data Source.</b> </li>    <li>In the<b> Attach Data Source Wizard</b>, notice the option to select<b> SAP</b> as a data source; after selecting it, choose<b> Next.</b>       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image001" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/8741.clip_image001_5E03531C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/8741.clip_5F00_image001_5F00_5E03531C.png" width="747" height="594" />         <br />Figure 1. Select SAP in the Attach Data Source Wizard</div>   </li>    <li>On the <b>Enter Connection Information </b>page, enter the <a href="https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/">URL to SAP EPM service</a> along with the credentials that you received after <a href="https://scn.sap.com/docs/DOC-40986">signing up</a> for access to their test feeds; choose <b>Next</b>.       <br />Although, it is possible to select <b>None</b> for the authentication type, typically SAP feeds are configured to require authentication (CBA apps currently support connecting to SAP using basic authentication). For more information, see the <i>Authentication</i> section listed at the end of this post.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image003" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image003" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6607.clip_image003_32BEBC15.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6607.clip_5F00_image003_5F00_32BEBC15.jpg" width="697" height="557" />         <br />Figure 2. Enter connection information in the Attach Data Source Wizard</div>   </li>    <li>On the<b> Choose your Entities</b> page, select the<b> BusinessPartner</b> and<b> Product</b> entities and rename the data source to<b> SAP_EPM_Service</b>; choose<b> Finish</b>.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image005" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image005" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/4544.clip_image005_64B65C9F.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/4544.clip_5F00_image005_5F00_64B65C9F.jpg" width="694" height="554" />         <br />Figure 3. Select the BusinessPartner and Product entities in the Attach Data Source Wizard</div>   </li> </ol>  <p>As a result, you will now see the <b>SAP_EPM_Service</b> added as a data source to your <b>Server</b> project including the <b>BusinessPartner </b>and <b>Product </b>entities that you selected.</p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image007" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image007" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/0743.clip_image007_7288A29A.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/0743.clip_5F00_image007_5F00_7288A29A.jpg" width="780" height="600" />     <br />Figure 4. Entity Designer showing the Product entity</div>  <p>You can use the <b>ctrl + up arrow\down arrow</b> keys to change the order of the properties. It is useful to define the desired order on the entity, so that later when screens are created, the fields on the screen will automatically be added in the same order. For example, you may change the order of the properties so that <b>ProductId, Name, ProductURL</b>, and <b>Description </b>appear first.</p>  <p>One feature of an SAP data source within a CBA is the recognition of certain SAP-specific annotations that can adorn entity properties within the service. Specifically, the annotations that will be recognized by a CBA are those that have the <b>sap:semantics</b> value set to “email”, “tel”, or “url”. The <b>BusinessPartner </b>entity that was selected in the <b>Attach Data Source Wizard</b> happens to have properties that demonstrate all three of these annotations. You can view the semantic annotations by viewing the $metadata from the SAP feed.</p>  <p><a href="https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/$metadata">https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/$metadata</a></p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image008" style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image008" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/8357.clip_image008_526D95DD.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/8357.clip_5F00_image008_5F00_526D95DD.png" width="753" height="94" />     <br /></div>  <p>Viewing the <b>BusinessPartner </b>entity in the Entity Designer, observe that the <b>EmailAddress</b>, <b>PhoneNumber,</b> and <b>WebAddress</b> fields have their respective types set to the <b>Email Address</b>, <b>Phone Number,</b> and <b>Web Address</b> business types. </p>  <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image010" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image010" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6204.clip_image010_32528920.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6204.clip_5F00_image010_5F00_32528920.jpg" width="780" height="273" />     <br />Figure 5. Properties on the BusinessPartner entity have been set to the appropriate business type</div>  <h2>Extend the Product Entity Properties</h2>  <p>For our line of business app, we need to track some additional product information that is specific to our branch, <i>Contoso Shipping Management</i>. With a CBA, we can easily extend <i>any</i> entity properties by relating data from the internal database of the app with data from an external data source. Furthermore, CBAs support relating data between external data sources, such as SharePoint\Office 365 and SAP.</p>  <h2>Add a Relationship</h2>  <p>In our example, we would like to track two additional pieces of product information: the item location and whether a product is out of stock. First, we need to add an entity to the internal database of our app that will be used to store this additional information. Second, we will relate this entity to the <b>Product</b> entity (that exists in the SAP data source) using a one-to-one or zero-to-one <a href="https://msdn.microsoft.com/en-us/library/ff852044.aspx#Same">relationship</a>.</p>  <ol>   <li>To add an entity in the internal database, choose the <b>Data Sources</b> node in the <b>Solution Explorer </b>and select <b>Add Table</b>. </li>    <li>Rename the table to <b>ProductDetail </b>and add the following properties: <b>OutOfStock</b> and<b> BackroomLocation</b>. Clear the <b>Required</b> check box for these properties.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image011" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image011" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/0336.clip_image011_2728FED6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/0336.clip_5F00_image011_5F00_2728FED6.png" width="982" height="300" />         <br />Figure 6. The ProductDetail entity</div>   </li>    <li>Add a relationship between <b>Product</b> and <b>ProductDetail. </b>To do this, open <b>Product </b>in the entity designer and choose the <b>Add: Relationship </b>button.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image013" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image013" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/5226.clip_image013_6E1221D3.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/5226.clip_5F00_image013_5F00_6E1221D3.jpg" width="560" height="272" />         <br />Figure 7. Adding a relationship</div>   </li>    <li>In the <b>Add New Relationship </b>dialog box, add a relationship so that each <b>Product</b> can have one <b>ProductDetail </b>(and a <b>ProductDetail</b> must have a <b>Product</b>). Choose <b>OK</b> to close the dialog box.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image014" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image014" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/0358.clip_image014_2009C25E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/0358.clip_5F00_image014_5F00_2009C25E.png" width="500" height="666" />         <br />Figure 8. Configuring the relationship</div>   </li> </ol>  <h1>Create the client screens</h1>  <p>Now that the data model is defined, add some screens to the app. While working with the screens, remember that the sample SAP service that we are using is read-only. As a result, the only data that we can edit is the <b>ProductDetail</b> entity because it is stored in the internal database of the app. If instead we were using a read-write SAP service, we would be able to edit all of the information on these screens and automatically save the data back to SAP.</p>  <p>Create the Common Screen Set</p>  <ol>   <li>Choose <b>Screens</b> node in the <b>Solution Explorer</b> and select <b>Add Screen</b>. </li>    <li>In the <b>Add New Screen </b>dialog box, select the <b>Common Screen Set</b> template and set the <b>Screen Data</b> to <b>SAP_EPM_Service.ProductCollection</b>. Finally, choose <b>OK</b> to close the dialog box.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image016" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image016" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/7215.clip_image016_14E03814.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/7215.clip_5F00_image016_5F00_14E03814.jpg" width="710" height="507" />         <br />Figure 9. Adding a new Common Screen Set</div>  As a result, you will now see a <b>ProductCollection</b> folder created in the <b>SolutionExplorer</b> that contains three screens: <b>AddEditProduct</b>, <b>BrowseProductCollection</b>, and <b>ViewProduct.</b> </li>    <li>Since we defined a one-to-one or zero-to-one relationship between <b>Product</b> and <b>ProductDetail</b>, we need to add code that automatically creates a new <b>ProductDetail</b> entity when the <b>AddEditProduct</b> screen is opened. Choose the <b>AddEditProduct </b>screen from the <b>Solution Explorer</b>, choose the <b>Write Code</b> drop-down in the Screen Designer toolbar and choose <b>created</b>.       <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image018" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image018" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/6710.clip_image018_46D7D89E.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/6710.clip_5F00_image018_5F00_46D7D89E.jpg" width="892" height="226" />         <br />Figure 10. Writing &quot;created&quot; code on the AddEditProduct screen</div>  To create a <b>ProductDetail</b> instance for this <b>Product </b>instance, use the following code.       <br />      <pre class="code"><span style="background: white; color: black;">myapp.AddEditProduct.created = </span><span style="background: white; color: blue;">function </span><span style="background: white; color: black;">(screen) {
  </span><span style="background: white; color: blue;">if </span><span style="background: white; color: black;">(!screen.Product.ProductDetail) {
    </span><span style="background: white; color: blue;">var </span><span style="background: white; color: black;">productDetail = <br />      myapp.activeDataWorkspace.ApplicationData.ProductDetails.addNew();
    productDetail.Product = screen.Product;
  }
};
</span></pre>

    <br />Now when the <b>AddEditProduct </b>screen is opened, a related <b>ProductDetail </b>is created, if one does not already exist. </li>

  <li>To make the fields that were added from the <b>ProductDetail</b> entity more prevalent on the screen, move the <b>Out of Stock </b>and <b>Backroom Location</b> controls to the top of the <b>right</b> <b>Rows Layout</b> group on this screen. Do the same on the <b>ViewProduct</b> screen as well. Notice that you can also change other appearance properties on controls, such as the font. There are many other properties that you can set on the screen designer to customize the screens. </li>

  <li>Also on the <b>ViewProduct</b> screen, drag out the <b>Supplier </b>field under our <b>ProductDetail </b>controls to show data from the <b>BusinessPartner</b> entity. This will create a group called <b>Supplier </b>(with properties from the related <b>BusinessPartner</b> entity). For this example, remove all the fields from this group except <b>Email Address, Phone Number, </b>and <b>Web Address. </b>Notice that these controls appear respectively as an <b>Email Viewer</b>, <b>Phone Viewer, </b>and <b>Web Address Viewer</b> (due to the annotations feature described earlier). 

    <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image020" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image020" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/0842.clip_image020_26BCCBE1.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/0842.clip_5F00_image020_5F00_26BCCBE1.jpg" width="550" height="189" /> 

      <br />Figure 11. Control layout</div>
  </li>

  <li>Finally, we want to display the <b>Product </b>images on the <b>ViewProduct</b> screen. First change the <b>Product Pic Url </b>control to be an <b>Image</b> control. To do this, choose the <b>ViewProduct</b> screen in the <b>Solution Explorer</b>, then find the <b>Product Pic</b> <b>Url </b>control on the screen and change it from a <b>Text</b> control to an <b>Image</b> control. 

    <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image022" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image022" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/4174.clip_image022_1B934197.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/4174.clip_5F00_image022_5F00_1B934197.jpg" width="328" height="425" /> 

      <br />Figure 12. Changing Product Pic Url to an Image control</div>
Because this SAP service stores the image URLs in a relative format, we need to write more code to set the full URL to the image. With the <b>Product Pic Url </b>control still selected, choose the <b>Edit PostRender Code</b> link in the <b>Properties window</b>. 

    <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image024" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image024" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/8284.clip_image024_4D8AE221.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/8284.clip_5F00_image024_5F00_4D8AE221.jpg" width="326" height="411" /> 

      <br />Figure 13. Properties of the Product Pic Url control</div>
Add the following code to the <b>PostRender</b> method. 

    <br />

    <pre class="code"><span style="background: white; color: black;">myapp.ViewProduct.ProductPicUrl_postRender =
  </span><span style="background: white; color: blue;">function </span><span style="background: white; color: black;">(element, contentItem) {
    contentItem.dataBind(</span><span style="background: white; color: rgb(163, 21, 21);">&quot;value&quot;</span><span style="background: white; color: black;">, </span><span style="background: white; color: blue;">function </span><span style="background: white; color: black;">(value) {
      </span><span style="background: white; color: blue;">if </span><span style="background: white; color: black;">(value) {
        </span><span style="background: white; color: blue;">var </span><span style="background: white; color: black;">totalUri = </span><span style="background: white; color: rgb(163, 21, 21);">&quot;https://sapes1.sapdevcenter.com&quot; </span><span style="background: white; color: black;">+
                        contentItem.value;
        setTimeout(</span><span style="background: white; color: blue;">function </span><span style="background: white; color: black;">() {
          $(</span><span style="background: white; color: rgb(163, 21, 21);">&quot;img&quot;</span><span style="background: white; color: black;">, element).attr(</span><span style="background: white; color: rgb(163, 21, 21);">&quot;src&quot;</span><span style="background: white; color: black;">, totalUri);
        }, 0);
      }
  });
};</span></pre>
    </li>
</ol>

<h1>Run the app</h1>

<p>Now, run the app (press F5).</p>

<p>If prompted, enter your SharePoint credentials. When the app starts, also choose<b> Trust It</b> (if prompted).</p>

<p>Notice the following:</p>

<ul>
  <li>The app <b>home screen</b> allows you to browse <b>Product </b>data from the attached SAP<b> </b>data source. </li>

  <li>When you choose a <b>Product</b>, the detailed <b>Product</b> information is displayed—this includes fields from both the attached SAP<b> </b>data source and the fields defined on the intrinsic <b>ProductDetails</b> entity. 

    <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image026" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image026" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/3326.clip_image026_426157D7.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/3326.clip_5F00_image026_5F00_426157D7.jpg" width="720" height="420" /> 

      <br />Figure 14. The ViewProduct screen</div>
  </li>

  <li>On the <b>ViewProduct</b> screen, you can choose the <b>Edit </b>button to open the <b>AddEditProduct </b>screen. Since the particular SAP service that the app is accessing is a read-only service, the fields defined on the SAP <b>Product</b> entity cannot be updated, but those defined on <b>ProductDetail </b>can be<b>. </b>If your app is accessing a read-only service, it is a good idea to remove the <b>Add </b>button on the <b>ViewProduct</b> screen and make the controls on the <b>AddEditProduct </b>screen “view” controls instead of “edit” controls. 

    <div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image028" style="border-width: 0px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image028" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/2821.clip_image028_7458F861.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/2821.clip_5F00_image028_5F00_7458F861.jpg" width="609" height="347" /> 

      <br />Figure 15. The AddEditProduct screen</div>
  </li>
</ul>

<h1>Additional notes</h1>

<h2>Authentication</h2>

<p>SAP can be configured with a variety of authentication providers. For this release, we support <a href="https://help.sap.com/saphelp_nwce10/helpdata/en/43/960f4a527b58c1e10000000a422035/frameset.htm">HTTP Basic authentication</a>. Basic authentication is enabled on most NetWeaver Gateway installations, and is easy to configure in both test and production. If you find that CBAs aren’t working with your SAP environment, let us know how we can support you better in the future.</p>

<p>For our debut of SAP support, we wanted to enable a complete read and write scenario with SAP data. Therefore, in addition to basic authentication support, we’ve also implemented the session and <a href="https://help.sap.com/saphelp_gateway20sp03/helpdata/en/e6/cae27d5e8d4996add4067280c8714e/content.htm">CSRF token handling that SAP requires</a> to be able to modify SAP data via the NetWeaver Gateway. This means that your CBAs will be able to write changes back to SAP if your SAP feeds support it. Don’t worry—when you attach to SAP data, we negotiate the SAP sessions and tokens automatically. There is nothing for you to configure. </p>

<h2>Non-addressable entities</h2>

<p>If your data fails to load and you see a <a href="https://blogs.msdn.com/b/lightswitch/archive/2011/09/20/diagnosing-problems-in-a-deployed-lightswitch-application-eric-erhardt.aspx?Redirected=true">diagnostics error</a> similar to the following, it’s because you’re attempting to navigate directly to an SAP entity that is non-addressable.</p>

<p><b>Error: </b>The SalesOrderLineItemCollection is not addressable. Please use the Navigation Property via the SalesOrder Collection or Entity.</p>

<p>For example, in the EPM service, the <b>SalesOrderLineItemCollection</b> entity set is marked as non-addressable which is evident in the service root document (for example, https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV).</p>

<div style="text-align: center; padding-bottom: 10px; font-size: 80%;"><img title="clip_image030" style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" border="0" alt="clip_image030" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/0777.clip_image030_692F6E17.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/0777.clip_5F00_image030_5F00_692F6E17.jpg" width="779" height="144" /></div>

<div>
  <p>This means that <b>SalesOrderLineItemCollection</b> is a child of <b>SalesOrderCollection </b>and that you can only access it by navigating to it through the parent.</p>

  <p>To solve this, be sure that you do not have a <b>Browse Data Screen</b> that is bound directly to a non-addressable entity (for example, <b>SalesOrderLineItem</b>). Instead, bind the <b>Browse Data Screen</b> to the parent (for example, <b>SalesOrder</b>) and create a <b>View Details Screen</b> that displays the <b>SalesOrderLineItems</b> data for the selected <b>SalesOrder</b>. This is done for you if you use the <b>Common Screen Set</b> template and select the parent as the primary entity for the <b>Browse Data Screen</b>.</p>

  <h1>That’s a wrap!</h1>

  <p>SAP support is one of the many new features that we’ve added for this Office Developer Tools Update. </p>

  <p><a href="https://aka.ms/officedevtoolsforvs2013"><b>Download the Office Developer Tools for Visual Studio 2013 – March 2014 update.</b></a><b></b></p>

  <p>After you’ve tried building a CBA that connects to an SAP service, let us know what you think by leaving a comment below or visiting the forums.</p>

  <p>For more information about building Cloud Business Apps, <a href="https://msdn.microsoft.com/en-us/library/dn592154(v=office.15).aspx">read the walkthroughs</a>, <a href="https://channel9.msdn.com/Series/CBA">watch the videos</a>, and <a href="https://msdn.microsoft.com/en-us/library/dn584076(v=office.15).aspx">browse the docs on MSDN</a>.</p>

  <p>Thanks!</p>

  <p>David Kidder, Senior Software Developer Engineer in Test, Cloud Business Apps</p>

  <p>Matt Evans, Senior Software Developer Engineer in Test, Cloud Business Apps</p>

  <p>Nicole Haugen, Senior Test Lead, Cloud Business Apps</p>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Office Web Widgets—Experimental</title>
      <link>https://docs.microsoft.com/archive/blogs/officeapps/office-web-widgetsexperimental</link>
      <pubDate>Fri, 07 Mar 2014 06:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Office Developer Team]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/officeapps/2014/03/07/office-web-widgetsexperimental/</guid>
      <description><![CDATA[At SharePoint Conference, we announced a couple of experimental UI widgets to help you build apps...]]></description>
      <content:encoded><![CDATA[<p><i>At SharePoint Conference, we announced a couple of experimental UI widgets to help you build apps for Office and SharePoint. The widgets included in this first release are the People Picker and the List View and in the rest of this post, we will explain what they are and how to use them, but first, an important caveat about the current state of the code.</i></p> <p>The code is not complete and these widgets are “experimental”. In clearer terms, that means:</p> <ul> <li>The target audience for this release is developers and our primary goal is to collect feedback.  <li>The code is tested in Office 365. The People Picker works against SharePoint on-premises, but List View does not.  <li>The code has bugs and functionality limitations. Do not use this code for production scenarios.  <li>The developer interface will change—future versions may require you to change significant amounts of code.  <li>The <a href="https://go.microsoft.com/fwlink/?LinkId=392925">license</a> under which these controls are released grants you specific rights and has certain limitations. Read it carefully.  <li>We do plan to release these controls for production use soon. Your feedback is critical to identifying areas we should invest. </li></ul> <p>That said, technically, the controls are actually quite useful—and in the case of the People Picker—almost fully functional. By using them and providing feedback, you can help shape the direction and accelerate the delivery of these—and other widgets in the future.</p> <p>A note about open source. We have not ruled out providing these controls as open source in the future, but now they still have a proprietary license. This release only includes the binaries. If you have feedback about open source-let us know!</p> <p>Let’s dive into the widget details.</p> <h1>Widgets overview</h1> <p>First, a quick overview of the philosophy around widgets. The two core principles that we want to deliver on are:</p> <ul> <li><b>Bring Office to the Web and provide a delightful user experience.</b> When possible, we want developers to be able to build the same experiences than those provided by our own products without having to spend excessive resources doing so.  <li><b>Provide a great developer experience.</b> You should not have to reverse engineer our code to figure out how to use these widgets. The developer interface should be simple, familiar, and flexible to help you develop your scenarios. </li></ul> <h2>Getting the code</h2> <p>The library code that you need for these widgets is part of a NuGet package. Install it and it will give you access to all the files you need to use the experimental widgets. If you have Visual Studio, it is as easy as choosing your project, choosing <b>Manage NuGet Packages</b> and searching for “<b>Office Widgets</b>”. Remember to sort by published date.</p> <h4><a href="https://www.nuget.org/packages/Microsoft.Office.WebWidgets.Experimental/">https://www.nuget.org/packages/Microsoft.Office.WebWidgets.Experimental/</a></h4> <div style="font-size: 80%; padding-bottom: 10px; text-align: center"><img title="Figure 1. Office Web Widgets - Experimental NuGet package in Visual Studio" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 1. Office Web Widgets - Experimental NuGet package in Visual Studio" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/7776.clip_image0024_7890DB5F.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/7776.clip_5F00_image0024_5F00_7890DB5F.jpg" width="780" height="520"><br>Figure 1. Office Web Widgets - Experimental NuGet package in Visual Studio</div> <h2>People Picker</h2> <p>This is perhaps the most requested UI widget and hence it was an obvious choice for us to work on. We have seen several apps recreating this control on their own, several questions on our forums, and also requests on our UserVoice site to deliver a People Picker.</p> <p>While there is already a Client People Picker that you can use in SharePoint hosted apps, you cannot use it in other hosting models. So, we created a pure HTML/JavaScript widget that you can use in apps for SharePoint in all hosting alternatives (SharePoint hosted, provider-hosted, or auto-hosted). The widget doesn’t have a dependency on where you host your pages, but it does require the use of the SharePoint cross-domain library and the SharePoint REST endpoint. It is specifically tailored to pick people from SharePoint.</p> <p>You include the required files at the top of your HTML page, initialize the runtime, and instantiate the widget using a placeholder div with some special attributes. The following code shows the instantiation. <pre class="code"><span style="background: white; color: black">…  
    </span><span style="background: white; color: blue">&lt;</span><span style="background: white; color: maroon">script </span><span style="background: white; color: red">type</span><span style="background: white; color: blue">="text/javascript"&gt;
        </span><span style="background: white; color: green">// Retrieve context tokens 
        </span><span style="background: white; color: blue">var </span><span style="background: white; color: black">hostWebUrl = </span><span style="background: white; color: #a31515">"PUT HOSTWEB URL HERE"
        </span><span style="background: white; color: blue">var </span><span style="background: white; color: black">appWebUrl = </span><span style="background: white; color: #a31515">"PUT APPWEB URL HERE"</span><span style="background: white; color: black">;

            </span><span style="background: white; color: green">// Initialize Controls Runtime
            </span><span style="background: white; color: black">Office.Controls.Runtime.initialize({
                sharePointHostUrl: hostWebUrl,
                appWebUrl: appWebUrl,
            });
    </span><span style="background: white; color: blue">&lt;/</span><span style="background: white; color: maroon">script</span><span style="background: white; color: blue">&gt;
  </span><span style="background: white; color: #006400">&lt;!-- REFERENCES SECTION END --&gt;
</span><span style="background: white; color: blue">&lt;/</span><span style="background: white; color: maroon">head</span><span style="background: white; color: blue">&gt;
&lt;</span><span style="background: white; color: maroon">body </span><span style="background: white; color: red">style</span><span style="background: white; color: blue">="</span><span style="background: white; color: red">height</span><span style="background: white; color: black">: </span><span style="background: white; color: blue">100%</span><span style="background: white; color: black">;</span><span style="background: white; color: blue">" </span><span style="background: white; color: red">onload</span><span style="background: white; color: blue">="</span><span style="background: white; color: black">Office.Controls.Runtime.renderAll();</span><span style="background: white; color: blue">"&gt;
  </span><span style="background: white; color: #006400">&lt;!--MARKUP START--&gt;
    </span><span style="background: white; color: black">Assigned to:</span><span style="background: white; color: blue">&lt;</span><span style="background: white; color: maroon">div </span><span style="background: white; color: red">id</span><span style="background: white; color: blue">="PeoplePickerSimple" <br></span><span style="background: white; color: red">                     data-office-control</span><span style="background: white; color: blue">="Office.Controls.PeoplePicker"&gt;<br>                &lt;/</span><span style="background: white; color: maroon">div</span><span style="background: white; color: blue">&gt;
  </span><span style="background: white; color: #006400">&lt;!--MARKUP END--&gt;
</span><span style="background: white; color: blue">&lt;/</span><span style="background: white; color: maroon">body</span><span style="background: white; color: blue">&gt;

…</pre></span>
<div style="font-size: 80%; padding-bottom: 10px; text-align: center"><img title="Figure 2. People Picker widget" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 2. People Picker widget" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/4667.clip_image0034_71742F98.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/4667.clip_5F00_image0034_5F00_71742F98.png" width="412" height="156"> <br>Figure 2. People Picker widget</div>
<p>The widget supports various properties and events. For full sample code and documentation, see <a href="https://msdn.microsoft.com/library/dn636915.aspx">How to: Use the experimental People Picker widget in apps for SharePoint</a>.</p>
<h2>List View</h2>
<p>The List View widget attempts to provide the same functionality that the List View on SharePoint pages provides. Be aware that the functionality of the experimental widget is limited. It displays tabular data with some basic sorting and relies on SharePoint pages to view and edit individual items. Instantiation of the widget is similar to the People Picker, you can do it declaratively or imperatively. Since the People Picker example used the declarative syntax, I’ll use the programmatic syntax to instantiate the List View and render a list that is deployed as part of the app.<pre class="code">…
<span style="background: white; color: black">    </span><span style="background: white; color: blue">&lt;</span><span style="background: white; color: maroon">script </span><span style="background: white; color: red">type</span><span style="background: white; color: blue">="text/javascript"&gt;
  
        
        function </span><span style="background: white; color: black">createListView() {
        </span><span style="background: white; color: green">// Retrieve context tokens 
        </span><span style="background: white; color: blue">var </span><span style="background: white; color: black">hostWebUrl = </span><span style="background: white; color: #a31515">"PUT HOSTWEB URL HERE"
        </span><span style="background: white; color: blue">var </span><span style="background: white; color: black">appWebUrl = </span><span style="background: white; color: #a31515">"PUT APPWEB URL HERE"</span><span style="background: white; color: black">;

            </span><span style="background: white; color: green">// Initialize Controls Runtime
            </span><span style="background: white; color: black">Office.Controls.Runtime.initialize({
                sharePointHostUrl: hostWebUrl,
                appWebUrl: appWebUrl,
            });


            </span><span style="background: white; color: blue">var </span><span style="background: white; color: black">listUrlValue = appWebUrl + <br></span><span style="background: white; color: #a31515">                             "/_api/web/lists/getbytitle('CustomersInApp')"</span><span style="background: white; color: black">;
            
            theList= </span><span style="background: white; color: blue">new </span><span style="background: white; color: black">Office.Controls.ListView(
            document.getElementById(</span><span style="background: white; color: #a31515">"listhere"</span><span style="background: white; color: black">), {
                listUrl: listUrlValue 
            }
          );

        }



    </span><span style="background: white; color: blue">&lt;/</span><span style="background: white; color: maroon">script</span><span style="background: white; color: blue">&gt;
…</pre></span>
<div style="font-size: 80%; padding-bottom: 10px; text-align: center"><img title="Figure 3. List View widget" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Figure 3. List View widget" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/53/99/metablogapi/1512.clip_image0044_7827391B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-53-99-metablogapi/1512.clip_5F00_image0044_5F00_7827391B.png" width="339" height="215"> <br>Figure 3. List View widget</div>
<p>To see the full code sample and documentation for List View, see <a href="https://msdn.microsoft.com/library/dn636914.aspx">How to: Use the experimental Desktop List View widget in apps for SharePoint</a>.</p>
<h2>Runtime initialization and connectivity with SharePoint</h2>
<p>Both widgets have a dependency on the SharePoint cross-domain library that in turn means that you must have an app web for things to work, even if you are not deploying any assets on SharePoint. To satisfy this requirement, use a dummy asset, for example, an empty web page hosted on SharePoint that is deployed as part of your SharePoint app package. To learn how the cross-domain library works, see <a href="https://msdn.microsoft.com/library/office/fp179927.aspx">How to: Access SharePoint 2013 data from apps using the cross-domain library</a>.</p>
<p>To initialize the controls library as shown in the code sample, pass the app web and host web URLs to the runtime. If you get these parameters as part of your query string (for example, because you are passing them using context tokens), then you can initialize the runtime with an empty object and the code will attempt to get the parameters from the query string directly.</p><pre class="code"><span style="background: white; color: green">// Initialize with an empty object and the code <br>// will attempt to get the tokens from the
// querystring directly.
</span><span style="background: white; color: black">Office.Controls.Runtime.initialize({});</pre></span>
<h1>Using these widgets in apps for Office</h1>
<p>In this first iteration, widgets are designed with apps for SharePoint in mind, but they can also be used in apps for Office if you are using SharePoint as a backend. This scenario requires you to have both, an app for SharePoint deployed and an app for Office that in turn connects to the app for SharePoint.</p>
<h1>Feedback</h1>
<p>Fantastic, you reached the most important part of this post—how you can give us feedback. We will be monitoring comments on this blog post, but you can also send us feedback on <a href="https://officespdev.uservoice.com/">UserVoice</a> using the <b>Office Web Widgets</b> category. Some key areas where we want your feedback:</p>
<ul>
<li><b>Interface and syntax</b> 
<ul>
<li>What do you think about the interface (for example, widget instantiation, manipulation)? Does it make sense? Is it easy? Is it difficult? 
<li>Do the properties and event names make sense? Are they too long? Are they too short? Are they clear or confusing? 
<li>Do you like the name “Office Web Widgets” or would you prefer something else? </li></ul>
<li><b>Functionality</b> 
<ul>
<li>Does it meet your app needs? 
<li>Are properties/events missing? 
<li>Did you find any critical bugs? 
<li>Do you consider any of the missing functionality an adoption blocker? What would be you would like us enable/fix before you could use the controls in your production apps? </li></ul>
<li><b>Form factors</b> 
<ul>
<li>What form factors and input methods do you see your customers using these widgets on the most? Currently, they are optimized for keyboard and mouse. </li></ul>
<li><b>Other frameworks</b> 
<ul>
<li>Would you like controls for a particular framework (for example, AngularJS)? 
<li>Do widgets conflict with your existing code or frameworks you already use? </li></ul>
<li><b>More controls</b> 
<ul>
<li>o What other widgets would you like to see? </li></ul></li></ul>
<p>We look forward to hearing from you: <a href="https://www.nuget.org/packages/Microsoft.Office.WebWidgets.Experimental/">download the code</a>, look at the <a href="https://msdn.microsoft.com/library/dn636913.aspx">docs</a> and <a href="https://officespdev.uservoice.com/">give us feedback</a>.</p>
<p>Happy coding!</p>]]></content:encoded>
    </item>
  </channel>
</rss>