Often times I get asked how to provision a document library in SharePoint Online to expose the Word, Excel, PowerPoint and OneNote icons in the document library ribbon to allow users to fire up one of those document types right from within the document library.
There is two approaches – one of which is code free, one of which requires a sandboxed solution.
In approach #1 (the code-free approach) you create content types for each of the document templates and then add the document templates to the "New Document" button in a document library and save the document library as a template. I wont dive deeper into this approach here, since you can read the step-by-step guidance on how to do the above here.
In approach #2 you build a sandboxed solution in Visual Studio to add buttons to the "New" group of the "Documents" ribbon, and deploy it to a site collection as a .wsp application package.
I’m not providing the code here, but at the end of this article I’ve provided a link to the SharePoint Online Developer Course (online) in which you can learn the principles behind the solution, and a link to the Fabrikam Site Collection (accessible for Microsoft Partners) in which you can find the solution (wsp) shown below and implement it in your own customer engagements if so desired.
If you download the wsp solution (or develop one yourself) this is how you put it to work
1. Open the solution gallery of the site collection ("Site Actions" > "Site Settings" > "Solutions")
2. Click "Upload Solution"...
... browse your way to the *.wsp file and click OK…
...and the solution is in the Solution Gallery
3. Once the solution is uploaded and activated, you can go to the site level features ("Site Actions" > "Site Settings" > "Manage Site Features")...
...and click "Activate" to activate the feature. The icons will now show up in existing and new document libraries in the site, but not other sites within the site collection
Using the solution
Create a new document library ("Site Actions" > "New Document Library")
The new document library has the four Office icons (buttons) in the "New" group of the "Documents" ribbon
To create e.g a PowerPoint presentation, you just click the PowerPoint button (the new presentation will open in PowerPoint Web App even if you have Office installed on your PC)
Provide a name for the presentation
Modify the presentation
When you close the presentation its automatically saved to the document library
- The solution show above essentially derives its list of files from the New Document method and any content types associated to that specific doc library
- There are four blank default templates (one per Office Type), and then any you add will appear under the respective file type.
- Developing for SharePoint Online with Sandbox Solutions - link (Developer Course on MSDN, see the Exercise 2 - Customizing the Ribbon)
- Add multiple Office templates to a document library - link
- Fabrikam Site Collection - link - if you install this demo site collection you can download the wsp shown above from the solution gallery and implement it in your own solutions