Hi Experts,
how to reproduce:
- Add a List WebPart from one of your custom Lists to a Wiki-Page.
- In the WebPart properties pane change the current view (just add more fields..)
- Click OK and save the page.
- You will see some data from your list (You should have some data).
- Right click to open the source
- Search for ctx = new ContextInfo(); to find your Webpart.
- Some lines below you will find ctx.view = "{guid of your view}";
- Copy this View-Id.
- Copy the List-Id from ctx.listName ="{guid of your list}"; or grap it from list Settings.
- Now add a script-editor Webpart to same page and add following code:
<script type="Text/javascript">
function Export()
{
var siteURL=window.location.protocol+'//'+window.location.host;
window.open(siteURL + "/_vti_bin/owssvr.dll?CS=65001&Using=_layouts/query.iqy&List={<YourListGuid>}&View={<YourViewGuid>}&RootFolder=/Lists/<NameOfTheList>&CacheControl=1");
return true;
}
</script>
<table>
<tr>
<td>
<button onClick="javascript:Export()" style="background-color:#3c9947; color: white; font-weight: bold;font-size: 13px">Export</button>
</td>
<tr>
</table>
- Click Insert and save the page.
- The page Shows your data and a button.
- Click the button, so that we can Export the view-Data to Excel.
- Excel will open. Click 'Activate' if you get a security message. Type your Login if you will requested.
- Boom, you'll get an unspecific error and Excel-Sheet is blank!
- Now get the View-Guid from the Default View 'All Items' of your list.
- Change the script from Script-Editor-WebPart and Change the View-ID to your Default View-ID (Guid)
- Save your changes.
- Click the Export-Button again.
- Excel will open. Click 'Activate' if you get a security message. Type your Login if you will requested.
- Excel will load the data. Call to owssvr from Script works!
So i assume this is By-Design? - Can just use Views which are defined in Lists and not specific Web-Part-Views?
Some Clarifications from Microsoft?
With Kind Regards,
Ronny