Open office doc
inside Windows Metro
App
BY:ASHISH AGRAWAL
Problem Statement
 How to open SharePoint document inside windows 8/8.1 metro app inside a web view
 login should happen seamlessly and app should be able to automatically open office web app
inside web view
Solution
 Using WebView.NavigateWithHttpRequestMessage(httpRequestMessage) API
 Using this API, we can pass the requestmessage with desired cookie to webview.
 Steps:






Login to office 365 account
Save the rtfa and fedauth cookie
create the httpRequestMessage and add cookie header to it
change the URL as sharepoint document URL
Make navigate request with this httpRequestMessage
Sample Code
var httpRequestMessage = new
Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.Get, uriFormat);
uriFormat should be sharepoint document URL

httpRequestMessage.Headers.Cookie.Add(“cookie-name”,”cookie-value”);

WebView.NavigateWithHttpRequestMessage(httpRequestMessage);
Thanks

Open office doc inside windows metro app

  • 1.
    Open office doc insideWindows Metro App BY:ASHISH AGRAWAL
  • 2.
    Problem Statement  Howto open SharePoint document inside windows 8/8.1 metro app inside a web view  login should happen seamlessly and app should be able to automatically open office web app inside web view
  • 3.
    Solution  Using WebView.NavigateWithHttpRequestMessage(httpRequestMessage)API  Using this API, we can pass the requestmessage with desired cookie to webview.  Steps:      Login to office 365 account Save the rtfa and fedauth cookie create the httpRequestMessage and add cookie header to it change the URL as sharepoint document URL Make navigate request with this httpRequestMessage
  • 4.
    Sample Code var httpRequestMessage= new Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.Get, uriFormat); uriFormat should be sharepoint document URL httpRequestMessage.Headers.Cookie.Add(“cookie-name”,”cookie-value”); WebView.NavigateWithHttpRequestMessage(httpRequestMessage);
  • 5.