Question

I have an application that I'm successfully deploying to SharePoint 2013. My code for an ECB menu item is:

<?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>

However, when I select the ECB item the URL that is returned to me is:

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

I'm not sure why the HostUrl isn't being returned.

Was it helpful?

Solution

It turns out that I had made a mistake in the setup of my project. I had mistakenly made a SharePoint 2010 app instead of a SharePoint 2013 app. So when I was calling certain attributes I was getting errors. This is simply because the attributes don't exist in SharePoint 2010.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top