【发布时间】:2014-10-14 15:16:55
【问题描述】:
目前我已尝试将 URL 分解为多个部分:
var items = SP.ListOperation.Selection.getSelectedItems(oList);
for(var n in items)
{..
var itemURL = window.location.protocol +'//'+ window.location.host
+'/'+ oList.Title +'/Forms/DispForm.aspx?ID=' + items[n].id;
..}
这会将 oList.Title 部分输出为 undefined,并且该站点内还有一个需要包含的子站点。以粗体突出显示的是可变字段:
http://sharepoint_site/sub_site/**current_document_lib**/forms/dispform.aspx?**ID=1**
目前输出为:
http://sharepoint_site/undefined/forms/dispform.aspx?ID=1
有什么想法吗?
【问题讨论】:
-
你使用的是sharepoint 2010?
-
使用 2013 年,似乎通过使用 window.location.href 并使用 replace() 将 'AllItems' 替换为 'DispForm' 解决了问题
标签: javascript list url sharepoint