none
SharePoint/OneDrive as a Default Save Location RRS feed

  • Question

  • Hello community.

    We implement new SharePoint on premise personal sites (OneDrive) and we need to make sure that when user creates new document in Word and saves it, the default location is user's personal OneDrive. Is it possible? If I just change 'Default local file location' location in Word settings, it doesn't work.

    Or is it possible to make a custom button, that opens Save dialog and sets OneDrive as current location? We would name this button 'Save to OneDrive' or something.

    Thanks for your help.


    Forgot to mention: Word version is 2016. We also need this behavior in Excel and PowerPoint.
    Sunday, April 9, 2017 9:27 AM

Answers

  • Hello,

    For the issue about "Default local file location" doesn't work in Word settings, I suggest you post on Word IT Pro Discussions forum for further support.

    If you want to create a custom button to save to OneDrive, I suggest you develop an VSTO add-in.

    Please visit:

    Walkthrough: Creating Your First VSTO Add-in for Word

    Ribbon Overview

    To save file using dialog, you could use built-in dialogs, please visit How to: Programmatically Use Built-In Dialog Boxes in Word

    E.g.

          dynamic dialog = Globals.ThisAddIn.Application.Dialogs[Word.WdWordDialog.wdDialogFileSaveAs];
                dialog.Name = @"D:\"+ Globals.ThisAddIn.Application.ActiveDocument.Name;         
                dialog.Show();

    You could also use WinForm SaveFileDialog control and specify its initial directory.

    E.g.

     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.Filter = "Word Documents|*.docx|All Files|*.*";
                saveFileDialog1.Title = "Save the File";
                saveFileDialog1.InitialDirectory = @"D:\";
                saveFileDialog1.ShowDialog();
                if (saveFileDialog1.FileName != "")
                {
                  string  saveFileName = saveFileDialog1.FileName;
                  Globals.ThisAddIn.Application.ActiveDocument.SaveAs2(saveFileName);
                }

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 10, 2017 3:16 AM
    Moderator

All replies

  • Hello,

    For the issue about "Default local file location" doesn't work in Word settings, I suggest you post on Word IT Pro Discussions forum for further support.

    If you want to create a custom button to save to OneDrive, I suggest you develop an VSTO add-in.

    Please visit:

    Walkthrough: Creating Your First VSTO Add-in for Word

    Ribbon Overview

    To save file using dialog, you could use built-in dialogs, please visit How to: Programmatically Use Built-In Dialog Boxes in Word

    E.g.

          dynamic dialog = Globals.ThisAddIn.Application.Dialogs[Word.WdWordDialog.wdDialogFileSaveAs];
                dialog.Name = @"D:\"+ Globals.ThisAddIn.Application.ActiveDocument.Name;         
                dialog.Show();

    You could also use WinForm SaveFileDialog control and specify its initial directory.

    E.g.

     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.Filter = "Word Documents|*.docx|All Files|*.*";
                saveFileDialog1.Title = "Save the File";
                saveFileDialog1.InitialDirectory = @"D:\";
                saveFileDialog1.ShowDialog();
                if (saveFileDialog1.FileName != "")
                {
                  string  saveFileName = saveFileDialog1.FileName;
                  Globals.ThisAddIn.Application.ActiveDocument.SaveAs2(saveFileName);
                }

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 10, 2017 3:16 AM
    Moderator
  • Thanks Celeste.
    Thursday, April 13, 2017 12:35 PM