none
integrating with Office Word from iOS custom application and URL scheme file:/// RRS feed

  • Question

  • I am writing an app in iOS (language Objective-C) and try to open a docx file by invoking the method openURL and passing the file location to it as per the scheme "ms-word:ofe|u|<urlofmyfile>" where <urlofmyfile> is a local file in the app such as file:///var/. Word app is saying it cannot open the file as it does not recognize the url. Is there any restriction integrating with Office Word from iOS custom application which pass an URL to a local file located in this app?

    The sample provided by the kb: https://msdn.microsoft.com/en-us/library/office/dn911482.aspx refer to URL protocol http or https but nothing about local file location file:///

    Any help or guidance would be helfull


    cedric

    Monday, March 23, 2015 10:16 PM

Answers

  • Hi cedric,

    I’m not familiar with iOS development, so please correct me if I have any misunderstandings on your question.

    I think you was using the UIApplication class to open the URL. I did a quick research about it and as the document described:

    URL: An object representing a URL (Universal Resource Locator). UIKit supports many schemes, including http, https, tel, facetime, and mailto schemes.

    Since I have no experience on the iOS development, I don’t know whether the URL object supports the “file” protocol. By the way, this forum is mainly for discussing Office development related questions on Windows Platform.  I will suggest you confirming this on the iOS development forum.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by L.HlModerator Tuesday, April 7, 2015 5:20 AM
    Tuesday, March 24, 2015 6:23 AM
    Moderator

All replies

  • Hi cedric,

    I’m not familiar with iOS development, so please correct me if I have any misunderstandings on your question.

    I think you was using the UIApplication class to open the URL. I did a quick research about it and as the document described:

    URL: An object representing a URL (Universal Resource Locator). UIKit supports many schemes, including http, https, tel, facetime, and mailto schemes.

    Since I have no experience on the iOS development, I don’t know whether the URL object supports the “file” protocol. By the way, this forum is mainly for discussing Office development related questions on Windows Platform.  I will suggest you confirming this on the iOS development forum.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by L.HlModerator Tuesday, April 7, 2015 5:20 AM
    Tuesday, March 24, 2015 6:23 AM
    Moderator
  • Hi Jeffrey,

    Thank you for your reply, I confirm I am using the UIApplication class to open the URL. The iOS reference on NSURL class accept file protocol as described here: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/

    Sorry if it is the wrong Forum as you mentioned it is mainly discussion on Windows platform. Is there any Office discussion Forum then where I can post this specific question related on IOS platform? 

    regards,

    Cedric

     


    cedric

    Thursday, March 26, 2015 9:03 AM
  • Hey Jeff did you solve this problem? I'm having exactly the same issue!

    Monday, June 29, 2015 6:04 PM
  • Hey Jeff,  I have trouble similar.
    Had you solve issue?
    =====
    stringURL = @"ms-word:ofe|u|file:///var/mobile/Containers/Data/Application/334AB86F-CA29-4910-8B21-46CB734595BA/Documents/Downloads/FileTestoffice.docx"
    NSURL *url = [NSURL URLWithString:stringURL];
    [[UIApplication sharedApplication] openURL:url];
    =====
    My app can't open word app.


    Monday, August 3, 2015 5:18 AM
  • Did you get an answer for this question?

    On iOS 9, the NSURL(string: "ms-word: .....") returns nil - iOS will not parse the custom protocol string

    Monday, August 24, 2015 9:55 PM
  • You get nil because the URL is not encoded, and has |u| in it....  you should encode it first.

        customURL = [customURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

        NSURL *url = [NSURL URLWithString:customURL relativeToURL:nil];

    Tuesday, May 17, 2016 9:09 PM
  • I am writing an app in iOS (language Objective-C) and try to open a docx file by invoking the method openURL and passing the file location to it as per the scheme "ms-word:ofe|u|<urlofmyfile>" where <urlofmyfile> is a local file in the app such as file:///var/. Word app is saying it cannot open the file as it does not recognize the url. Is there any restriction integrating with Office Word from iOS custom application which pass an URL to a local file located in this app?

    The sample provided by the kb: https://msdn.microsoft.com/en-us/library/office/dn911482.aspx refer to URL protocol http or https but nothing about local file location file:///

    Any help or guidance would be helfull


    cedric

    Hi Cedric,

    were you able to solve this issue?

    Thank you,

    Vasilis

    Monday, November 6, 2017 9:54 AM