We have a custom .aspx page that creates a WebPart programmatically, which shows a special view on a library.
XsltListViewWebPart listWp = new XsltListViewWebPart();
listWp.ID = LVWP_GUID;
listWp.ViewGuid = docs.DefaultView.ID.ToString(Views.FORMAT_GUID).ToUpper();
listWp.WebId = SPContext.Current.Web.ID;
listWp.ListId = docs.ID;
listWp.ListName = viewName;
listWp.AllowClose = false;
listWp.AllowConnect = false;
listWp.AllowEdit = false;
listWp.AllowHide = false;
listWp.AllowMinimize = false;
listWp.AllowZoneChange = false;
listWp.ChromeType = PartChromeType.TitleOnly;
listWp.AsyncRefresh = true;
listWp.ManualRefresh = false;
listWp.ParameterBindings += Views.PARAM_BINDING;
listWp.XmlDefinition = [see below]
It uses a view definition like this
<ViewFields>
<FieldRef Name="FileLeafRef" ListItemMenu="TRUE" LinkToItem="TRUE" />
<FieldRef Name="DocumentNumber" ListItemMenu="TRUE" LinkToItem="TRUE" />
...
</ViewFields>
The problem is: the links in the dropdown menu are broken, e.g. "Check Out", "Version History", "Edit in undefined" (<- should be Microsoft Word) and "Delete".
The interesting part is that the links for "View/Edit Properties" and "Manage Permissions" work as expected.
I checked the URLs that are called and it seems that the filename is missing on the links that don't work:
View Properties uses this URL:
https://example.com/sites/Documents/Forms/DispForm.aspx
?ID=2
&Source=...
&RootFolder=%2Fsites%2FDocuments
&IsDlg=1
But Check Out tries to redirect to this URL:
https://example.com/sites/_layouts/Checkin.aspx
?FileName=
&Checkout=true
&Source=...
So it seems that links with an ID work, but links with a filename don't.
Why is this happening and how can I fix it?