SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an list of links in sharepoint foundation site. In this list I have a particular link lets say "" and I need to append querystring ?id=domain\userid to it. Let me know how to do it so that every user who is logged in his/her user id is appended in this particular link like :\userid


share|improve this question

This answer can diffenently help you.

You'll need a reference to this some where on your page. Add that JS file to your Layouts folder.

Add an HTML Form Web Part to the page and add a reference to the spservices.js file and then add the linked answer script below.

Your final result should look something like this:

<script type="text/javascript" src="/_layouts/myJavascripts/spservices.js"></script>
<script type="text/javascript">
    operation: "GetUserInfo",
    async: false,
    userLoginName: $().SPServices.SPGetCurrentUser(),
    completefunc: function (xData, Status) {
        $(xData.responseXML).find("User").each(function() {
            curUserId = $(this).attr("ID");
            curUserName = $(this).attr("Name");
            curFullUserName = $(this).attr("ID")+";#"+$(this).attr("Name");

All you have to do from here is add some javascript or jquery which will add the information to the link webpart's URls and then you should be good to go!

Hope this helps :)

share|improve this answer
Cant I do this through XLST ? – RHM Mar 12 '12 at 12:36
Yes, it is possible to implement in XSLT :) – Daniel Ziga Mar 12 '12 at 14:19

You could do it this way:

1) Create a custom Sharepoint application page, under _layouts.

2) Create links to this page, using a query string for the target url e.g. YOUR APP PAGE.aspx?

3) In the app page code, append the current user id to the target url and redirect.

share|improve this answer
Cant I do this through XLST ? – RHM Mar 12 '12 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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