I have completed my first sharepoint 2013 app (sharepoint hosted) where I'm using my own code to display list data etc rather than use any OTB pages/functionality.
The one feature I want to include from the OTB ribbon is the export to excel feature but I can't see any examples of this on MSDN, has anyone managed to do this via Javascript or JQuery?
Thanks,
S
For anyone interested this is how i did it!
Function to get my lists and views
function getLists() {
lists = web.get_lists();
context.load(lists, "Include(Id, Title, Hidden, ItemCount, Views)");
context.executeQueryAsync(onSuccess, onFail);
}
Function to get list and build link
function onSuccess() {
var listsEnum = lists.getEnumerator();
while (listsEnum.moveNext()) {
var list = listsEnum.get_current();
if (list.get_title() == "Name of list") {
var title = list.get_title();
var viewCollection = list.get_views();
var viewInfo = 'Tasks list current views: \n\n';
var viewEnumerator = viewCollection.getEnumerator();
while (viewEnumerator.moveNext()) {
var view = viewEnumerator.get_current();
if (view.get_title() == "View-Title") {
var viewGUID = view.get_id();
//Add the export link
$('#lnkExport').attr("href", "../_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=" + list.get_id().toString() + "&View=" + viewGUID + "&CacheControl=1");
}
}
}
}
}