1

I made a custom SharePoint application page and now I want to open it from edit control block (item context menu). My XML won't compile because it is telling me that I have illegal characters in the Url. The & characters are causing this. But if I use & instead, I can compile and deploy but the URL is wrong. This is because the JavaScrit understands & characters, where Visual Studio won't let me through.

<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="SPTest.CustomMenuItem.ButtonClicked" RegistrationType="ContentType" RegistrationId="0x0101" Location="EditControlBlock" ImageUrl="/_layouts/IMAGES/workflows.gif" Sequence="600" Title="My custom menu" Description="Click to my custom menu."> <UrlAction Url="javascript:OpenPopUpPageWithTitle('~site/_layouts/SP/MyAppPage.aspx?ListId={ListId}&ItemId={ItemId}', RefreshOnDialogClose, 530, 300, 'My custom menu')"/> </CustomAction> </Elements> 

How do I format the URL? I found the sample that I used for my code here.

1 Answer 1

2

Ok, I found the solution. In the URL parameter of the JavaScript function, instead of ~site, I should have used {SiteUrl}.

So the UrlAction node should be:

<UrlAction Url="javascript:OpenPopUpPageWithTitle( '{SiteUrl}/_layouts/SP/MyAppPage.aspx?ListId={ListId}&ItemId={ItemId}', RefreshOnDialogClose, 530, 300, 'My custom menu')"/> 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.