SharePoint中传递Search参数的Url的一些研究

首先创建两个站点,主站点名字叫 Search, 在它下面有一个子站点, 名字叫Search_111。
 
在主站点的 default page中,SearchBox有三个选项:
  • All sites:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=All Sites
  • This site: Search:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&cs=This Site&u=http://localhost:6325
  • People:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=People
在主站点的List中:

在Shared Documents list中, 他有4个选项.

  • All sites:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=All Sites
  • People:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=People
  • This site: Search:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&cs=This Site&u=http://localhost:6325
  • This List:Shared Documents:http://localhost:6325/_layouts/ OSSSearchResults.aspx?k=c&cs=This List&u=http://localhost:6325/Shared Documents
 
在子站点的 default page中.
  • All sites:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=All Sites
  • This site: Search_111:http://localhost:6325/MMM/_layouts/ OSSSearchResults.aspx?k=c&cs=This Site&u=http://localhost:6325/MMM
  • People:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=People
在子站点的Task List 中的选项如下:
  • All sites:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=All Sites
  • This site: Search_111:http://localhost:6325/MMM/_layouts/ OSSSearchResults.aspx?k=c&cs=This Site&u=http://localhost:6325/MMM
  • People:http://localhost:6325/_layouts/OSSSearchResults.aspx?k=c&s=People
  • This List:Task:http://localhost:6325/MMM/_layouts/OSSSearchResults.aspx?k=c&cs=This List&u=http://localhost:6325/MMM/Lists/Tasks
 所以,我猜测他在使用Url传递参数的时候,有两个规则:

Rule1:所有的 search box 包含三项, People, All sites 和 This Site: site name. 如果是 People 或 All sites, 参数为 k=keyword 和s= the scope(All sites or People).如果是This Site: site name,参数为 k=keyword, cs=This Site, u=current site's url.
 
Rule2: 如果当前是在一个List里面,他将包含另外一项, This List: List name. 参数为 k=keyword, cs=This List, u=current list's url.

但是在List里面没有Url这一项,

一些 list's 属性.
Documents->Shared Documents
ParentWeb.Url:   http://localhost:6325
ParentWebUrl:   /
DefaultViewUrl:   /Shared Documents/Forms/AllItems.aspx
Description:   Share a document with the team by adding it to this document library.
Direction:   none
SendToLocationUrl:   
SendToLocationUrl:   
Title:   Shared Documents
 
Lists->Tasks
ParentWeb.Url:   http://localhost:6325
ParentWeb.Url:   /
DefaultViewUrl:   /Lists/Tasks/AllItems.aspx
Description:   Use the Tasks list to keep track of work your team needs to complete.
Direction:   none
SendToLocationUrl:   
SendToLocationUrl:   
Title:   Tasks
 
Lists->Calendar
ParentWeb.Url:   http://localhost:6325
ParentWeb.Url:   /
DefaultViewUrl:   /Lists/Calendar/calendar.aspx
Description:   Use the Calendar list to keep in, deadlines, and other important events.
Direction:   none
SendToLocationUrl:   
SendToLocationUrl:   
Title:   Calendar
 
Sub Lists->Document
ParentWeb.Url:   http://localhost:6325/MMM
ParentWebUrl:   /MMM
DefaultViewUrl:   /MMM/Shared Documents/Forms/AllItems.aspx
Description:   Share a document with the  document library.
Direction:   none
SendToLocationUrl:   
SendToLocationUrl:   
Title:   Shared Documents

我发现他有两个属性, DefaultViewUrl 和 Title, 所以我们可以通过这两个属性把它拼出来.

你可能感兴趣的:(SharePoint)