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 to pass in the email address of the current user to a web service data source (run time) of a DataForm Web Part.

My Question is:

a) How can I get Email address of a user based on login in DVWP? I know we can get the CurrentUser using the CurrentUserName but how do we get the Email for the Current User.

b) After getting the Email how to we pass to the Web Service runtime?

Note: In XSL

share|improve this question
    
Have you subclassed the DVWP? –  Steve P Oct 12 '10 at 5:58
add comment

3 Answers

Embedding all of that in xsl is pretty painful. Your best bet is to use something like SPServices (jQuery) which has a GetCurrentUser function and put it on the page with the DVWP. The script can get the current user, call a web service, and even update the contents of the DVWP if needed.

share|improve this answer
add comment

I tried the SPSerives route on the master page that for some reason did not work for me. I took the server side approach wrote a custom control to get it working. Deployed the custom control project replaced <cc2:DataFormParameter ParameterKey="username" PropertyName="ParameterValues" DefaultValue="abc" Name="username"></cc2:DataFormParameter> with the new tag for the custom control <abc:UserProfileParameter PropertyName="WorkEmail" DefaultValue="abc" Name="UserEmailAddress"></abc:UserProfileParameter> within the SelectParameter in Data source String in the .webpart file. This way I got the user profile information pass to the web service.

share|improve this answer
add comment

This might help:

http://www.endusersharepoint.com/2010/05/24/sharepoint-mailto-hyperlink-in-a-dvwp/

share|improve this answer
1  
+1 for linking to my article :-) –  PirateEric Jul 28 '11 at 13:50
add comment

Your Answer

 
discard

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