1

I'm using this tutorial http://www.codeproject.com/Articles/331606/How-to-set-Current-User-Name-to-InfoPath-Person-Gr to insert the name of the current user in an infopath form. I got the connection to the web service but then it returns this:

InfoPath Impossibile verificare il nome utente. Verifica non consentita dalle impostazioni di sicurezza del modulo.

Error durante una llamada a la propiedad o método 'get-UserName'.

It seems that is a security problem but my user is OK. For example if I use a person picker I can get all the information clicking in the person picker. there is another method to get this feature?

UPDATE: I solved it thanks to the excellent people in this site, thanks John. What I did was to follow the instructions in this url: http://saadiyadad.blogspot.com.es/2012/04/user-information-within-infopath-forms.html

but I had to change some things in the rule number 1, I had to use the query field "Account" and not the "User Name". User name contains only the user name and the formula userName contains also the domain and anohter information, I suppose is a problem with the infopath and sharepoint versions.

  • To avoid the pain in Infopath I tend to create (and deploy) custom webservices that get all the needed information. During the form load I simply call these webservices and store the returned values in a (hidden) field. – Wout Jul 18 '14 at 7:54
  • good idea, but I would like to focus on using ootb features of sharepoint. – Luis Molina Jul 18 '14 at 12:34
1

I know some of the environments I've worked with have issues with the UserProfileService...

It may be easier to simply use the 'User Information List' from the site you're working with if all you need is the user's name; just set the q:User_name field to the userName() function when you load the form then query the data from the list

  • Hi John, I think this has to be with my environment, I remember that one time I saw the "User information list", but if I try now I don't see it, what I see is "Remove leader", "add leader", maybe I'm not using the url that I had to, for example maybe this is the url to the central administration? I'm using xx.xx/_vti_bin/UserProfileService.asmx?WSDL but when I see the site it is in xx.xx.xx.196/_layouts/15/start.aspx# I've tried 85.159.202.196/_layouts/15/_vti_bin/UserProfileService.asmx that I can see in the browser but infopath it says that xml is bad. – Luis Molina Jul 20 '14 at 7:19
  • I've found how to use the "user information list", I've followed the steps in saadiyadad.blogspot.com.es/2012/04/… but when I see the form nothing appears, I got no data, is possible to debug the data I get from the server?. – Luis Molina Jul 20 '14 at 7:40
  • at last, I got it, the problem is that in the url they say that we got to use the query field name but is incorrect (in my case at least) I used the query field "account", surprise: it puts "Name" in the wizard although I selected "account" and now it works. – Luis Molina Jul 20 '14 at 7:49
  • Luis I'm glad you got it working! the start.aspx/# url is part of SP2013's Minimal Download Strategy (which is really complicated so I won't go into detail about it here...); if you are looking to access something in _vti_bin you want to use something like //server/sitecollection/_vti_bin/UserProfileService.asmx?WSDL – John-M Jul 20 '14 at 21:08
  • Also, that's odd it wanted you to populate the q:account field, I just implemented this the other day on a project in my environment and I used the user_name field, I wonder how in place upgrades and stuff effect that though -- again glad you're up and running! – John-M Jul 20 '14 at 21:09
1

Have you tried the jQuery library SPServices (SPGetCurrentUser)?

var thisUserName = $().SPServices.SPGetCurrentUser({
fieldName: "Title",
debug: false
});
  • He's using InfoPath - I guess you could do something with a JavaScript call on your page, but getting JavaScript to interact well with an InfoPath form is usually a frustrating exercise (and what he's trying to do is already built in to InfoPath) – John-M Jul 18 '14 at 16:19

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.