In SharePoint 2007 in some occasions i see that when im redirected to some pages etc, i see a source in query string, and this i can use to be redirected back to the original page.

I've read on msdn that it exists and in url i can say something like:


But the token is not being replaced, maybe it is because in SP 2007 it isn't supported. This what i have in custom action:

<UrlAction Url="~site/_layouts/myAppPage.aspx?listid={ListId}&amp;source={Source}"/>

The result will be: page?listid=10&source={Source}

Any idea how can I get the source working in this case?


You need to substitute a value for {Source} with a valid URL to somewhere. Typically I use JavaScript to do this so I can get the page I am on using document.location.

For example, if I wanted to return them to the original page after completing an action I would use some JavaScript in the URL action like:

<UrlAction Url="javascript:window.location='~site/_layouts/myAppPage.aspx?listid={ListId}&amp;Source='+window.location" />

If the URL is persistent then you could just add it in there obviously.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.