UrlAction Element (Custom Action)
Specifies the page URL for an action.
<UrlAction Url = "Text"> </UrlAction>
For an example of how this element is used, see Custom Action Definitions.
<UrlAction Url="$Resources:osrvcore,List_Pages_UrlName;/Settings.aspx" />
On a SharePoint farm with the English and Dutch language packs installed, this will be replaced during runtime by either Pages or Paginas, depending on the language setting with which the SPWeb was created.
- 8/23/2010
- Koen Zomers
<UrlAction Url="javascript:void(your javascript code)"/>
I.e. the JavaScript must return null or you will get a redirect as SharePoint renders the UrlAction as "window.location =".
If you have:
<UrlAction Url="javascript:alert('hello')"/>
SharePoint renders it as:
onMenuClick="window.location = 'javascript:alert(\'hello\')';"
(This example works just fine as Alert returns null.)
If you have:
<UrlAction Url="javascript:document.getElementById('test').src = 'abc'"/>
Clicking the link redirects to a blank page and displaye "abc".
This works as expected:
<UrlAction Url="javascript:void(document.getElementById('test').src = 'abc')"/>
The JavaScript runs and there is no redirect.
- 1/31/2010
- Mike Smith MCT
- 1/31/2010
- Mike Smith MCT
SAFARI Browser...Please help!! Below works for IE and firefox but for safari for windows the 2nd query string value will not work because safari renders the & as "&" instead of "&" I tried using & but this dis not work either....Any ideas?
<UrlAction Url="~site/_layouts/SpecialActionsXY/MySpecialActionXY.aspx?List={ListId}&ID={ItemId}"/>
[tfl - 07 08 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at
http://www.microsoft.com/communities/newsgroups/en-us/
. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C
&
SQL Server :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C
&
.NET Framework :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell :
http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
All Public :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C
&
- 8/6/2009
- sg123
- 8/7/2009
- Thomas Lee
<UrlAction Url="javascript:window.location='{SiteUrl}/_layouts/mypage.aspx?List={ListId}&Source=' + encodeURIComponent(window.location)"/>This enables you to use <Template_Buttons>'s Cancel button.
The FEATURES folder also contains some url actions with the site-collection url like
<UrlAction Url="_Layouts/RedirectPage.aspx?Target={SiteCollectionUrl}_catalogs/masterpage" />
- 11/12/2007
- anonymous coward
- 6/9/2009
- DinSoft
TokenReplaced By~site/SPContext.Current.Web.ServerRelativeUrl~sitecollection/SPContext.Current.Site.ServerRelativeUrl{ItemId}item.ID.ToString(){ItemUrl}item.Url{SiteUrl}web.Url{ListId}list.ID.ToString(“B”){RecurrenceId}item.RecurrenceID
- 12/19/2008
- austegard
I have a blog post about this error at http://sharepointinsight.com/blog/Lists/Posts/Post.aspx?ID=32.
Here is most of the post:
I was building a feature that simply redirects a user to an ASPX Web Part page to allow some processing of items within that list. I needed to know which list that the user came from so I could open the list and execute some code to get my result. Simple right? When you create your features custom action simply use the token {ListId} in the UrlAction property. This actually works great. However, what you don't want to do, and what was causing me so much grief, is use the word list as your query string variable name. I used the following UrlAction: <UrlAction Url="/MyCustomPage.aspx?list={ListId}"/>. Every time I clicked on my features link it would throw the following error on the next page.
ERROR
List does not exist
The page you selected contains a list that does not exist. It may have been deleted by another user.
After much frustration I finally started playing with the query string and noticed that if I changed the word list everything started working instantly. Enter a moment of OHHHHHHHHHH THAT'S THE PROBLEM. So, now feeling enlightened that this seems to be a reserved query string by SharePoint I changed my UrlAction to <UrlAction Url="/MyCustomPage.aspx?listID={ListId}"/> . Presto everything works and I am happy that I can move on to customizing more of the menu. I have not tested to see if other tokens such as {SiteId} or {ItemId} cause the same problems with there respective query strings. So be careful using those as well. When in doubt make sure it's different from what SharePoint is using.
- 12/17/2007
- Michael Bollhoefer_1326429567
To build a custom action that points to the edit form of a single list/doc lib when selecting a list item you need to pass the itedmid and listid in the urlaction url.
Use the registrationId if you only want to have the feature for lists based on that particular content type.
<CustomAction
Id="MyId"
RegistrationType="ContentType"
RegistrationId="0x0101[Guid]"
Location="EditControlBlock"
ImageUrl="/_layouts/images/EDIT.GIF"
Sequence="106"
Title="Edit Procedure">
<UrlAction Url="~site/MyList/Forms/EditForm.aspx?ID={ItemId}&List={ListId}"/>
</CustomAction>
- 11/2/2007
- qtejane