1

I have installed web app server and now the server is 192.168.1.103 on IIS and i have a sample code from this site https://code.msdn.microsoft.com/office/Building-an-Office-Web-f98650d6/view/Discussions#content

in this sample the appwopiserver in web config is: "wopihost.wingtip.com:8888/api/wopi/files/"

How can i create api/wopi/files/ directory in my server ? in other words i want to change this code to connect to my server . here is the code that get the link:

    public Link GetLink([FromUri] FileRequest fileRequest)
    {
        if (ModelState.IsValid)
        {
            var xml = WebConfigurationManager.AppSettings["appDiscoveryXml"];
            var wopiServer = WebConfigurationManager.AppSettings["appWopiServer"];
            bool updateEnabled = false;
            bool.TryParse(WebConfigurationManager.AppSettings["updateEnabled"], out updateEnabled);
            WopiAppHelper wopiHelper = new WopiAppHelper(HostingEnvironment.MapPath(xml), updateEnabled);

            var result = wopiHelper.GetDocumentLink(wopiServer + fileRequest.name);

            var rv = new Link
            {
                Url = result
            };
            return rv;
        }

        throw new ApplicationException("Invalid ModelState");
    }

the final created link to open office in browser in this sample is:

http://owa1.wingtip.com/we/wordeditorframe.aspx?WOPISrc=http%3a%2f%2fwopihost.wingtip.com%3a8888%2fapi%2fwopi%2ffiles%2ftest.docx&access_token=YMDZjBxXlD4%3dlxnjDAq1aib0yGsNDo%2fd0Jm4b5R8eJircFrcaU84fgQ%3d

but i want something like this: (http:// 192.168.1.103/we/wordeditorframe.aspx?WOPISrc=http%3a%2f%2fwopihost.wingtip.com%3a8888%2fapi%2fwopi%2ffiles%2ftest.docx&access_token=YMDZjBxXlD4%3dlxnjDAq1aib0yGsNDo%2fd0Jm4b5R8eJircFrcaU84fgQ%3d)

rocky
  • 7,506
  • 3
  • 33
  • 48

1 Answers1

1

You have to replace App_Data\Discovery.xml with an XML you find at http://192.168.1.103/hosting/discovery (your OWA server).

rocky
  • 7,506
  • 3
  • 33
  • 48
  • Did you get a chance to make word editing via OWA 2013? I could see people talking about Microsoft.CobaltCore.dll to get FSSHTTP protocol working for word editing. Any samples will be appreciated. – Joy George Kunjikkuru Apr 29 '16 at 15:03
  • Yes I have an MVC6 working sample here https://github.com/petrsvihlik/wopihost it's based on Marx Yu's project (https://github.com/marx-yu/WopiHost) – rocky Apr 29 '16 at 15:13
  • I tried the technique in one of my sample but didn't work.Still opening docx says "document cannot be opened for editing".Does this require OWA 2016 or 2013 is enough? – Joy George Kunjikkuru Apr 29 '16 at 18:39
  • I believe both have been designed and tested for OWA 2013. – rocky Apr 30 '16 at 10:04