Connecting to a custom remote file repository from Word RRS feed

  • Question

  • Hi,

    we have a third-party non-MS-based service whose part functions like a file repository. Each file in the repository is linked to a parent non-file record (you can imagine, that the parent record is a project and you might attach a file to the project). Main UI is over web, but we are considering a functionality which allows manipulating with the files from Word UI directly.

    * The user must be authorized using login/password.
    * Communication with the server must goes over https.
    * Users are allowed to put new files into the repository under an existing parent record, get list of available files, open a file, save a previously opened file, close a file.
    * Preferrably: If the file goes from the service, it must be saved to the same location (ie. it could not be renamed, it could not be relinked to another parent non-file record).
    * The service UI will be accessible from the Word interface.
    * The solution must work in Word 2010 and 2013.

    We have come with few possible solutions:
    * Implement the Word's collaboration protocol (for example, implemented by SkyDrive). Rejected - too complicated, need to understand DOCX structure.
    * Download/upload file over a custom REST api, accessible using a backstage/ribbon interface made by an add-in. For this, we need to be able to get hands on the physical file of the document (ie. get the DOCX representing the document). Unfortunately, we could not find a working solution.

    For the second option (add-in), we have experienced the following dificulties:

    1) When the file comes from SkyDrive/SharePoint/Web location, the path of the document is a non-file url (https://....), so it's physical representation is not accessible for the add-in. Additionally, Word saves the file directly to the cloud, so the potential local file copy is not actual until it is synced by an external application.

    2) When the file comes from the local disc, it is locked, so the StreamReader raises an exception.

    3) Word's Document still does not implement Document.SaveCopyAs method.

    4) Calling the Word's Document.SaveAs(filename) opens the Word's Save As dialog instead of using the passed file name; effectively preventing Document.SaveAs(tempFilename); Document.Open(originalFilename); PushToRepository(tempFileName). Could not find why the Save As dialog appears.

    5) Workarounds for SaveCopyAs we have found on the internet does not work (not available on this platform, causes opening Save As dialog, does not make a full copy of the document, raises file locked exception etc.).

    Do you have any tips? Thank you.

    Thursday, May 16, 2013 8:20 PM

All replies

  • Hi MCCZ,

    Thank you for posting in the MSDN Forum.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best regards,

    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 20, 2013 12:58 PM
  • Hello,

    I opened a document(in Word) from Skydrive and its path was "https://....". I tried to save it using Word VBA (using the SaveAs method), but I did not get the SaveAs dialog.

    Am I missing anything? Can you tell steps to reproduce this issue?

    Thursday, May 23, 2013 5:37 PM
  • Hi Ajay,

    you are right and I appologize for this. The SaveAs dialog was triggered by another test add-in which was not correctly cleaned.

    Currently, as the best approach seems to be to use the Word's implementation of the IPersistFile.Save() method to salt away a local copy of the document into a temp direktory, read that file and post its content using our own protocol onto the server.

    If you have better idea, for example, for steps which do not require physically creating the temp file, but which make the docx file available just in a memory, I will appreciate if you share your tips here.

    Thank you.

    • Edited by MCCZ Monday, May 27, 2013 8:26 PM
    Monday, May 27, 2013 8:25 PM