0

I have a scenario where a user creates a new Word document (attached to a content type), but doesn't need to open it. The document will be populated by other users later.

Is there a way to avoid the default behavior where a new document is automatically opened in Word? I know I could build a workflow for that, but it seems like an overkill for such a simple task.

3 Answers 3

1

You could use a Document Set with a single document template but it introduces additional functionality (possibly complexity) that you probably don't require.

2
  • Thanks for the idea. I agree that it's more complexity than I need, especially in my case as I plan to stay with Foundation.
    – Christophe
    Commented Apr 26, 2011 at 23:07
  • Marking this as answer for MSS. For Foundation, I sticked to my initial idea, using a workflow.
    – Christophe
    Commented Sep 16, 2011 at 16:41
0

Why not to add a button to the document library ribbon, and name it smth like "Create document by template"?

And on click, you can pop out SharePoint ModalDialog with your layouts page for asking some additional info (file name), or simply call your js function and create a document by template (most simple way is probably to use SPFile.CopyTo method to copy template from another document library, which you can hide if you wish).

You can either use standard SharePoint XML for adding ribbon button, or use Fluent Ribbon API (codeplex project, which simplifies ribbon creation).

You will need to add following code into your feature receiver:

    var button = new ButtonDefinition()
    {
        Name = "CreateByTemplate",
        Title = "Create by template",
        Image = ImageLibrary.GetStandardImage(12, 9),
        CommandJavaScript = " .. your js here ..",
        TemplateAlias = "o1"
    }

    var ribbonCustomAction = new RibbonCustomAction();

    ribbonCustomAction.AddControl(button1, "Ribbon.Documents.New", 1);

    ribbonCustomAction.Provision(ReceiverGuid, web, ListTypes.GenericLibrary);

For details, please visit Fluent Ribbon project documentation site, you will need section "Project features => RibbonCustomAction".

4
  • I am really hoping that there's something much simpler and obvious that I am missing - just an option to turn off. When you upload a document, it is not automatically opened, I just want the same behavior for new documents.
    – Christophe
    Commented Apr 26, 2011 at 13:23
  • I'm afraid there is no such option. Actually what SharePoint is doing, when New button is pressed: it is only opens MSWord and provides some meta information, like document library url and it's default document template. As far as I know, document is not created until you press Save from MSWord. So, actually, MSWord creates the document, not SharePoint itself. Btw, solution which I provided, was used in a real project and works fine. Commented Apr 26, 2011 at 13:32
  • Anyway, I will try to find some extra information about document creation in SharePoint. Commented Apr 26, 2011 at 13:33
  • @AndreyMarkeev , how about ShaarePoint Online? I need to achieve this functionality as well. When you create new document ONline it opens in Word Online and is already saved. I also have a piece of code which creates the document without opening, but I have some issues with it, could you take a look? - sharepoint.stackexchange.com/questions/176528/…
    – Gintas K
    Commented Apr 12, 2016 at 12:09
0

One option is to use a content type and set the document template to a LAYOUTS page. Some of the default content types point to Upload.ASPX and you could do the same to point to your own ASPX that creates the document and does not open it.

1
  • My question is specifically about Word documents. Sorry, I don't understand how pointing to a aspx page would help.
    – Christophe
    Commented Apr 27, 2011 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.