Sharepoint 2013 HostUrl令牌未返回主机url值

时间:2014-02-25 01:52:40

标签: sharepoint-2010 sharepoint-2013

我有一个应用程序,我正在成功部署到SharePoint 2013.我的ECB菜单项代码是:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control
ControlAssembly="Sharepoint.Webpart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=04e797fdfc603650"
                ControlClass="Sharepoint.Webpart.CustomItemAction" Sequence="50" Id="AdditionalPageHead"/>

  <CustomAction Id="CustomAction.Ecb.Add"
                 Location="EditControlBlock"
                 RegistrationType="ContentType"
                 RegistrationId="0x0101"
                 Sequence="302"
                 Title="Add"
                 Description="Add"
                 ImageUrl ="http://localhost:20102/Content/Images/SharePoint/CustomAction.Add.16x16.png">
    <UrlAction Url="http://localhost:20102/Add/?HostUrl={HostUrl}&amp;Source={Source}&amp;ListId={ListId}&amp;ItemId={ItemId}"/>
  </CustomAction>
</Elements>

但是,当我选择ECB项目时,返回给我的URL是:

http://localhost:20102/Add/?HostUrl={HostUrl}&Source=http%3A%2F%2Fc4968397007%2FSitePages%2FHome%2Easpx&ListId=%7B3E3145D1%2D95DB%2D4581%2D840E%2D0F23F9573D1E%7D&ItemId=3

我不确定为什么没有返回HostUrl。

1 个答案:

答案 0 :(得分:0)

事实证明我在设计项目时犯了一个错误。我错误地制作了SharePoint 2010应用程序而不是SharePoint 2013应用程序。因此,当我调用某些属性时,我遇到了错误。这只是因为SharePoint 2010中不存在这些属性。