Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have an list of links in sharepoint foundation site. In this list I have a particular link lets say "www.yahoo.com" 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 : www.yahoo.com?id=domain\userid

Thanks

share|improve this question

2 Answers 2

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?site=www.yahoo.com

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

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">
$().SPServices({
    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");
        });
    }
});
</script>

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

Your Answer

 
discard

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.