InfoPath - Get the current user without writing code - itaysk

InfoPath - Get the current user without writing code

Posted Thursday, April 05, 2007 12:56 PM by Itay Shakury

I've just read IP team blog post about getting the current user's details using Web Services.
Actually the exact same result can be achieved without writing any code. It's a very common thing to do and I couldn't find any guide for that, so here it is:
* If you are already familiar with this, this post might still be useful. I have included the complete set of default properties get returned and their proper naming syntax at the bottom.
* This works at InfoPath as well as InfoPath Forms Services.
*Clayton Cobb has a great follow up post if you to take the this a step further.

  1. With InfoPath opened go to Tools > Data Connections, and click 'add...' to add a new data connection to the form. This opens up the Data Connection Wizard.
  2. We want to receive data from the WS about the current user, so choose receive data' and click next.
  3. Our data source is a WS so choose 'Web Service' and next.
  4. Now you will have to point the wizard to the WS. Type an address similar to this: http://ServerName/_vti_bin/UserProfileService.asmx  and click next.
  5. Here you get a list of all methods for that WS, choose GetUserProfileByName and click next.
  6. In this screen you can specify what parameters are sent to the method, we are relying on the method's ability to return the current user name if no value is passed to it, so we will leave this as is (no value is passed to the method) and click next.
  7. Click next and make sure 'Automatically retrieve data when form is opened' is checked.
  8. Finish the wizard.

The GetProfileByName method returns a PropertyData array. You can think of it as a repeating table of name and value pairs.
So Now that you have a data connection that can get the current users, you can use it values. In this example I will show the user's first name in a textbox.

  1. Add a textbox to the form.
  2. Go to the first textbox's properties (double click it).
  3. In the 'Default Value' part, click the 'fx' button next to the 'Value' field. this opens up the formula builder dialog.

    vc
  4. Click 'Insert field or group'.


  5. In the data sources drop down, choose the GetUserProfileByName data source.
  6. Expand all groups under the 'dataFields' group, and choose the 'value' field. Don't click OK yet!


  7. With data 'value' field selected, click the 'Filter Data...' button and 'Add...'.
  8. In the first drop down (value) select 'Select a field or group...' and choose the 'Name' field under the 'PropertyData' group.




  9. Leave the middle drop down as is ('is equal to') and in the last drop down choose 'type a text...'.


  10. This is the part where you specify which property to put in the textbox. As we said the method returns multiple properties about the user. For this textbox we want to put the user's first name in, so type 'FirstName' (this is case sensitive!). I have included the property list you can use here (just below), so if you want some other property, just type its name instead.
  11. That's it, all we have to do is to confirm everything so Click 'OK' for every open dialog box until you are back in the design mode.
  12. click 'Preview' and see the wonder!
  13. If you want more details repeat steps 1-11 and enter different property names in step 10.

Finally, as I Promised, here is the complete list of default profile properties get returned by the userprofileservice. I think they are pretty self explained:

UserProfile_GUID
AccountName
FirstName
LastName
PreferredName
WorkPhone
Office
Department
Title
Manager
AboutMe
PersonalSpace
PictureURL
UserName
QuickLinks
WebSite
PublicSiteRedirect
SPS-Dotted-line
SPS-Peers
SPS-Responsibility
SPS-Skills
SPS-PastProjects
SPS-Interests
SPS-School
SPS-SipAddress
SPS-Birthday
SPS-MySiteUpgrade
SPS-DontSuggestList
SPS-ProxyAddresses
SPS-HireDate
SPS-LastColleagueAdded
SPS-OWAUrl
SPS-ResourceAccountName
SPS-MasterAccountName
Assistant
WorkEmail
CellPhone
Fax
HomePhone

Comments

# re: InfoPath - Get the current user without writing code

Wednesday, May 23, 2007 12:25 PM by pmdci

Great post! It works like a charm on InfoPath 2007.

BUT when you publish this form on a SharePoint (MOSS 2007) server and tries to use it, it gives you an error. The same form worked without any issues before.

1. Go to my Expenses Form Library on MOSS.

2. Click on New -> New Document. The InfoPath Forms Services load (Loading Form...) and then a dialog box appears on the browser that says:

Warning

There has been an error while processing the form.

Click Continue to resume filling out the form. You may want to check your form data for errors.

Click Start Over to load a new copy of the form.

Show error details

An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566

3. I have two options to click: CONTINUE or START OVER. Clicking on CONTINUE will loop from point 1 to point 3 (this point). That is, the error doesn't go away. By clicking on continue, the form loads, but the field where the employee name should be is empty.

Any Ideas?

Thank you,

Pedro

# re: Get the Full user name in web hosted InfoPath Form

Friday, May 25, 2007 2:43 PM by Skullcrusher's Blog

# re: InfoPath - Get the current user without writing code

Tuesday, May 29, 2007 11:37 AM by arosen

Thank you for this nice guide that provided exactly what I was looking for. Unfortunately I experienced exactly the same problems as described by Pedro (pmdci) in the first comment. I could'nt figure out how to fix it by now. Seems to be a permission problem - but why?

Andreas

# re: InfoPath - Get the current user without writing code

Thursday, May 31, 2007 8:04 PM by choudharyn

Hi Itaysk,

Thanks for ur posting. It is indeed very useful.

I was trying this out to get the user details and Manager details.

I could only see the Current user ID and not any other details.

What may be the issue.

Is it also possible to get the manager's email id.

Kindly help. It is urgent.

Thanks in advance.

# How to display current user's full name, email and other info in InfoPath?

Friday, June 01, 2007 3:50 AM by Jingmei Li's MSDN Blog

Itay has blogged the exact steps and screenshots on how to display current user info (email, full name,

# re: InfoPath - Get the current user without writing code

Friday, June 01, 2007 4:05 PM by choudharyn

Thanx for ur comment Jingmel.

I am aware of his blog and following the same.

Let me chk again, if I am missing on anything.

# middle school study skills lesson plans

Saturday, September 08, 2007 2:47 AM by middle school study skills lesson plans

middle school study skills lesson plans

# re: InfoPath - Get the current user without writing code

Tuesday, September 25, 2007 12:40 AM by Sean Coleman

When I don't specify a parameter for the GetUserProfileByName method, InfoPath returns an error when attempting to preview or open the form. It says that null or void is not a valid parameter for that method. When I specify an account name as the parameter it works and InfoPath will pull the FirstName value from the array and display it. But that does me no good as I need the information for the current user who is logged in. Is there a parameter that will get the current user? The assumption that a null or empty parameter will get the current user is not working for me. I am also using SharePoint 2003 and not MOSS 2007 if that makes a difference.

I do appreciate this great post and hopefully this will solve a lot of headaches for me.

# re: InfoPath - Get the current user without writing code

Thursday, September 27, 2007 5:31 PM by Damien

Pedro,

Regarding your post regarding log id 5566. I was having the same issue. I was able to fix it from my end by turning of anonymous access.

Once I turned off anonymous access I no longer received the error and the connection worked beautifully.

# re: InfoPath - Get the current user without writing code

Thursday, October 04, 2007 11:52 AM by yannis

Any idea how to get custom AD attributes (extensionAttribute1 - 10) for the MOSS 2007 user profile? Is it possible using MOSS 2007's web services?

# re: InfoPath - Get the current user without writing code

Thursday, October 04, 2007 9:04 PM by KevinHou

For those getting the 5556 error accessing data source, take a look at this post.  It seems to indicate a priv issue at the root level.  This may be helpful.  For me, I don't get the error, but another of the system does.  When I check his privs, they all look the same as mine.  Here's the post:

blogs.msdn.com/.../how-to-display-current-user-s-full-name-email-and-other-info-in-infopath.aspx

# re: InfoPath - Get the current user without writing code

Tuesday, October 09, 2007 9:09 AM by Nicholas

Hi.. i need some help in my infopath form. i have followed all the methods provided online.. but the form i created.. keep retrieving only the administrator profile. even when i signed in as other user.. the form still retrieve only the admin profile... do anyone out there know how to solve this problem?

# re: InfoPath - Get the current user without writing code

Tuesday, October 23, 2007 7:12 AM by Doug Patterson

Thanks for the info.  I'm a newbie and wanting to do something very similiar but am lost.  How would I configure a field in Infopath to submit a different AccountName to the method for query rather than leaving the query field 'null'?  Any help  would be much appreciated.  thanks

# re: InfoPath - Get the current user without writing code

Monday, October 29, 2007 11:52 PM by ehaze

Thank you!

# re: InfoPath - Get the current user without writing code

Friday, November 02, 2007 12:07 PM by PAtrick

i did everything but it's not working why

# re: InfoPath - Get the current user without writing code

Wednesday, November 14, 2007 3:59 PM by jfl

I installed the infopath template in MOSS so I can use it as a content type.

But when I create a new form using that template, I don't get the current user data, the fields are always filled with the System Account data.

Any idea?

Thanks in advance.

# re: InfoPath - Get the current user without writing code

Thursday, November 15, 2007 2:01 PM by Nick

Hi, this is great. It works :)

But I do have a question.

I can eg get the Manager and WorkEmail of the logged on User.

But how can I get the WorkEmail of the Manager ?

# re: InfoPath - Get the current user without writing code

Thursday, December 06, 2007 9:18 PM by Clayton

It's working wonderfully for me, but now I need to know how to send a parameter so that I can get info for other people in AD who are associated with the form originator.  I can easily get the Manager details, but the info it returns is in the form of domain\name.  This is fine for some of my purposes, but I need the full name of the manager in order to do some filtering in the SharePoint list, since [ME] looks for a full name.  

So, I basically want to setup another Data Connection just like this one but that passes the control in my form named "ManagerUserName."  I want to send that dynamically and return the PreferredName of the manager, but when I go to set that parameter in the Web Service Data Connection setup, it only asks for text, not a control or function.  Is that my only option, or can I set it up where I send the Manager's user name as the AccountName query value associated with this web service?  I mean, I know it's passing the current user by default, so there must be a way to pass another user specified by a control in the form itself, yah?  

# re: InfoPath - Get the current user without writing code

Thursday, December 06, 2007 9:42 PM by Clayton

Sorry, I may have answered my own question as well as Nick's above me.  I started experimenting with the myriad of other Web Services available from the same place as GetUserProfileByName, and I got lucky when trying GetCommonManager.  Like the Profile one, it passes the current user by default, but then it returns details about just the Manager, such as Account Name (domain\name), Name (full name), Email, etc.  This was exactly what I needed, although I still need to test it in order to ensure it works for all users.

# re: InfoPath - Get the current user without writing code

Tuesday, December 11, 2007 8:19 PM by Jason

Clayton did you do anything special to get the getcommonmanager working?  I receive an error when I use that web service.  It states that object reference is not set to an instance of an object.  I am able to pull the user profile information just fine but not the manager info.

# re: InfoPath - Get the current user without writing code

Friday, December 14, 2007 10:53 PM by SethMW

Has there been a resolution found to this error:

An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566

The annonymous access thing didn't work for me.

I am stumped. I don't see anything in the logs. Could this have to do with SP1? It was working yesterday. They applied SP1 this morning, and now I am getting this error when trying to access this Web Service from a browser based form. (It works when opened in the client.)

# re: InfoPath - Get the current user without writing code

Tuesday, December 18, 2007 7:37 PM by Jason

Seth, I was getting this error because we were using a alternate access map to access our sharepoint site, when I removed this then setup the URL we wanted as its own web application it worked fine.

# re: InfoPath - Get the current user without writing code

Wednesday, December 19, 2007 2:14 AM by Jeremy

Thank you so much for the post. I have it working, in preview mode. However when i post it to MOSS using form services I get the "Warning - There has been an error while processing the form". Any ideas? The only two options i get are "Try Again" and "Exit Form"

# re: InfoPath - Get the current user without writing code

Wednesday, December 19, 2007 9:22 PM by Jason

Anybody know how to get the Sharepoint groups of a logged in user?

# re: InfoPath - Get the current user without writing code

Friday, December 28, 2007 7:45 PM by Clayton

Jason, in response to your question about GetCommonManager, this is what I do:

1) First, I create a new data field for Manager, and I set the default value to the Manager element coming from GetUserProfileByName.  

2) That data comes in as <domain>\<account name>, so I do a substring-after...

substring-after(Value[Name = "Manager"],"<domain>\")

...to strip the <domain>\ portion off so that I only have the account name remaining, which is what the GetCommonManager query requires.

3) I then have a rule set on the Manager field that sets the GetCommonManager query field (AccountName) to the Manager's account name, and then it queries the WS

# re: InfoPath - Get the current user without writing code

Friday, December 28, 2007 8:30 PM by Clayton

I've been using this religiously on my browser-enabled forms to increase efficiency and reduce the amount of required user interaction (reduce errors, too).  However, one thing I can't figure out is how to display results that have multiple values (i.e. interests, schools, responsibilities, etc.).  I started out by doing a repeating table hoping it would add a new row for each piece of data for a given element, but it only ever shows the first piece of data.  This makes me think it's something simple, but right now I can only retrieve the first piece of data, whether it's a repeating field or not.

# re: InfoPath - Get the current user without writing code

Wednesday, January 02, 2008 6:36 PM by Joel

I too was trying to pass the AccountName to the GetUserProfileByName field.  The GetCommonManager get's me most of what I need, but I also need the WorkPhone which is not in GetCommonManager.

I can pass the AccountName during the DataConnection, but that is text and I can't do this codeless in the field.  

I want to pass the AccountName to GetUserProfileByName from the GetCommonManager information so I can get to WorkPhone.

Any suggestions for someone trying to do this in InfoPath 2003 without using code?

# How public exposure can help you blog popularity

Monday, January 07, 2008 11:00 AM by itaysk

This is how: This graph shows the overall traffic in my blog. Notice the steep rise in blog traffic on

# Employee Schedule Request--Part 2

Thursday, January 10, 2008 2:53 AM by Mirrored Blogs

In part one I created an InfoPath form that employees could use to create a work schedule. Now I&#39;m

# Capture SharePoint User Data in InfoPath

Thursday, January 10, 2008 2:53 AM by Mirrored Blogs

Requirement: Submit schedule change requests to SharePoint so supervisors can approve them through workflow

# re: InfoPath - Get the current user without writing code

Monday, January 28, 2008 6:22 PM by Andy

I followed this exactly but it failed with:

"Infopath contacted a data source but failed to recieve data. The form will load without the requested data.

Details: The query cannot be run for the following DataObject: GetUserProfileByName

InfoPath cannot run the specified query.

The SOAP response indicates that an error occurred on the server:

Unable to read in användarprofilhanterarobjektet. ---> Value cannot be null.

Parameter name: serverContext"

Anyone got any ideas on this??

# re: InfoPath - Get the current user without writing code

Thursday, January 31, 2008 6:16 PM by Avia

Well , wonderful document. Thanks.

But i'm still getting only administrator's account instead of the longon account.

Any idea ?

Thanks

# EventID 5566 Troubleshooting in InfoPath Form Services

Tuesday, February 05, 2008 5:01 AM by Just Another Web Application

This post has been snatched from the headlines of Premier Support. The names have been changed to protect

# re: InfoPath - Get the current user without writing code

Thursday, February 07, 2008 7:23 PM by Sallisha

I was reading Clayton's post in hope of getting the Manager Details:

"3) I then have a rule set on the Manager field that sets the GetCommonManager query field (AccountName) to the Manager's account name, and then it queries the WS"

I have created the rule, but am unsure how to get the query going after the Manager Field is populated...

Please advise....Thanks

# re: InfoPath - Get the current user without writing code

Wednesday, February 20, 2008 2:36 AM by Jenny Liou

HELP PLEASE!!!

I have been using this method successfully for the past few weeks, and it works great to get the user in Sharepoint for filling a web enabled Infopath form.  

But now I need to work out a solution for the next step in my scenario:

On initiation of the form, (process 1)I get the current logged in user account details in text box 'a', on submit I write the current user account to text box 'b' which shows who completed Process 1 and clear text box 'a'.  

Now here is where the problem occurs.  The next user who opens the form for Process 2, but the same text box 'a' does not retrieve the next users credentials.

How can I resolve the reuse of a retrival of the next users login to the same control?

Jenny

# re: InfoPath - Get the current user without writing code

Tuesday, February 26, 2008 7:48 PM by Kip

For Clayton: You can create a second instance of GetUserProfileByName data connection but this time dont set it to query when the form is opened. I called mine GetUserProfileByNameMGR.

Go ahead and get the Manager accountname (I applied it to a Manager field) using the techniques shown in this blog but don't place it on the form.

Add a rule to the Manager field with two actions:

1. Set a field's value: Accountname = .

2. Query using a data connection: GetUserProfileByNameMGR

This will set the Accountname for data connection GetUserProfileByNameMGR to the Manager Account and then query GetUserProfileByNameMGR for that account. You can then populate a Manager section similar to how you populated the User section but this time using the GetUserProfileByNameMGR data connection.

Now the challenge is to only do all of this when the form is initiated (new) since you don't want to do it again if someone else opens it. Can this be done without code?

# re: InfoPath - Get the current user without writing code

Tuesday, March 04, 2008 7:30 AM by Siamac Nikoo

Regarding error 5566, if you use a Load Balancer it may cause this error. Change the URL to point directly at the MOSS server to resolve issue.

Siamac

# re: InfoPath - Get the current user without writing code

Tuesday, March 04, 2008 10:17 PM by Patrik

I followed the instructions, but I get following error in the error logs of SharePoint:

Data adapter failed during OnLoad

The following query failed: GetUserProfileByName

It seems to have something to do with the fact that my Domain Controllor and my SharePoint web server site are on a different machine, though in the same domain.

I needed to set up basic authentication only on the webserver, as else the Active Directory users were not accessible for users outside the domain trying to log in. I needed to uncheck integrated windows authentication on the web server to be able to let them access the SharePoint site.

What else should I check why the Active Directory values cannot be queried with the web service?

# re: InfoPath - Get the current user without writing code

Thursday, March 20, 2008 6:59 PM by Preet

I am having issues with it if I use this in a form which is needed to be deployed from Central Admin (as its mobile enabled).

Please suggest what can be done to get this working. Thanks in advance for the suggesions.

Regards,

Preet

# re: InfoPath - Get the current user without writing code

Wednesday, March 26, 2008 7:06 PM by George

Dear all,

I have few infopath forms and diffrent wf. In those form there is a search button that it is been used for searching users. So that i can find a user i'm using UserGroup.asmx?WSDL and GetUserCollectionFromSite. It is working fine but my problem is that it bring one the user that have allready login . the same problem i have also with spweb.siteusers.

Could you please give an idea how i can

1) Find all users that are in profile database

2) Use an spusercollection object that can take any login name that exist in profile database without the need to have first login

# re: InfoPath - Get the current user without writing code

Thursday, March 27, 2008 4:56 AM by Vuthy

Thanks for your post. It's work fine for me.

However I have another requirement.

I want to populate a list of users based on value of a profile property. I am strugling for several days, still can't make it yet.

Could anyone give some idea on how to go through this problem.

Thanks.

# re: InfoPath - Get the current user without writing code

Thursday, March 27, 2008 10:45 AM by HOSSAM

hi;

Thanks alooot for this post.

but i have this error"An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566"

as the rest.

another thing when i opened in client application, it gives me always the name of the system admin.

appreciate your help

# re: InfoPath - Get the current user without writing code

Thursday, March 27, 2008 12:33 PM by George

Dreal all i have found the solution.

You can use Microsoft.Office.Workflow.Tasks.dll which is installed with sharepoint sdk. There is a library called Microsoft.Office.Workflow.Utitlites.

Get the login name of the user  and user the code below

string userLogin;

                       Contact usr;

                       userLogin =  this.ReviewerName; (domain name)

                      // item["ManagerPerson"] = currentWeb.SiteUsers[userLogin];

                       usr = Contact.FromName(userLogin, this.workflowProperties.Web); //load contact object

                       item["ManagerPerson"] = usr.GetPrincipal(workflowProperties.Web); //Get principal people group type

# re: InfoPath - Get the current user without writing code

Tuesday, April 01, 2008 8:14 AM by Panakj

hi ,

I am facing a problem, i always got 5337 error and it always display admin data not the current user data . please help me.

# re: InfoPath - Get the current user without writing code

Friday, April 04, 2008 12:31 PM by Win_E

hi you

I did everything  but it not run when i pressed Preview button.

It shows "Failed connection to data source" that:

"One or more data sources that are required to open this form are not available. They may be temporarily offline or your computer may not be connected to the network"

I use Info Path 2007 and I installed MOSS 2007 in a local computer.

Anyone get the same issue??? Help me!!!

# re: InfoPath - Get the current user without writing code

Wednesday, April 09, 2008 12:19 PM by Esther

This is a great post and worked for me on a single server environment but when published to a Load balanced multi-server environment I keep getting datasoure- 401 errors. I think this is because the web service call is being served by another server. Does anyone know how to get around this? UDC won't work right? - as I need to use the credential of the current user, not an admin account.

When I remote into the servers themselves and open a browser to access the form, it works great, but from a client machine it works 20% of the time

# re: InfoPath - Get the current user without writing code

Thursday, April 10, 2008 4:15 AM by Rob

Can anyone tell me how to use this approch when loading a drop-down list box?  Basically, I want to initialize a drop-down list to contain all entries from GetUserProfileByName where the Name (the default profile property) is set to 'PreferredName' and the Value field contains 'somename' like 'Rob'.  Instead of returning a single entry, I want it to return all entries where the Value contains Rob, but I am just getting back the first entry following the instruction at the top of this blog. Currently, the drop-load shows a single entry (not all possible entries).  Thanks!

# re: InfoPath - Get the current user without writing code

Tuesday, April 15, 2008 7:59 PM by Martin

Hi all,

Excuse me if this question is so basic. But I can not understand how this web service matches some terms with the specific of AD.

For example, the WS uses FirstName but when I browse into the AD the value is in givenName attribute and I can not find the FirstName one. I'm quite confused because the value is finally obtained.......is there some alias stuff involved? I have a lot of AD attributes to use but I can't not get the value using this web service.

Could someone explain me how it works?...and being specific....why do I have to use FirstName instead of givenName?

Thanks a lot in advanced.

Martin.-

# re: InfoPath - Get the current user without writing code

Wednesday, April 16, 2008 4:22 PM by Tal Winter

Great article.

Itay, why are you sick? :)

I did what you told me about using User Profiles and using a permanant query for a department. works well.

Is there any way to make a contact list in InfoPath to get all the users from the User Profiles?

# re: InfoPath - Get the current user without writing code

Thursday, April 17, 2008 12:21 AM by Greg

After following the steps outlined, my error is pasted below. Any help would be appreciated.....

The following DataObject either cannot be created or cannot be initialized: GetUserProfileByName

The query cannot be run for the following DataObject: GetUserProfileByName

InfoPath cannot run the specified query.

The SOAP response indicates that an error occurred:

Invalid input for account name, cannot be empty or null.

# re: InfoPath - Get the current user without writing code

Sunday, April 20, 2008 1:24 PM by Ali

I am facing the same infopath issue with Error ID :5566,I get the following

There has been an error while processing the form.

Click Continue to resume filling out the form. You may want to check your form data for errors.

Click Start Over to load a new copy of the form.

Show error details

An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566

Please share the solution ,

appreciate your help :)

# re: InfoPath - Get the current user without writing code

Tuesday, April 22, 2008 5:32 PM by Helgi

Has anyone got an answer on Esther's problem from April 9th.

"This is a great post and worked for me on a single server environment but when published to a Load balanced multi-server environment I keep getting datasoure- 401 errors. I think this is because the web service call is being served by another server. Does anyone know how to get around this? UDC won't work right? - as I need to use the credential of the current user, not an admin account.

When I remote into the servers themselves and open a browser to access the form, it works great, but from a client machine it works 20% of the time"

I am having exactly the same problem and wondering if this a farm configuration issue or an udcx limitation?

Thanks, Helgi

# While I&#8217;m here&#8230;&#8230;. &laquo; Lights on a Stick

Friday, April 25, 2008 10:33 PM by While I’m here……. « Lights on a Stick

Pingback from  While I&#8217;m here&#8230;&#8230;. &laquo; Lights on a Stick

# re: InfoPath - Get the current user without writing code

Wednesday, April 30, 2008 2:20 PM by Iver

Hey Itay

Beautiful article and it works perfectly. Is there any way to get / request the same properties on a different user? It needs to work with InfoPath Forms Services.

Best regards

Iver

# InfoPath - Get the current user without writing code

Monday, May 05, 2008 10:39 PM by SaurabhKV

A very good link to g et the current user without writing code in an InfoPath form.

# re: InfoPath - Get the current user without writing code

Monday, May 19, 2008 9:42 PM by janet

AWESOME BLOG

# re: InfoPath - Get the current user without writing code

Wednesday, May 21, 2008 12:12 AM by Elaine

This information is exactly what we need, however we are using SharePoint 2003 and InfoPath 2003.  Is there any way to retrieve user info using the 2003 products?

# re: InfoPath - Get the current user without writing code

Wednesday, May 21, 2008 12:12 AM by Elaine

This information is exactly what we need, however we are using SharePoint 2003 and InfoPath 2003.  Is there any way to retrieve user info using the 2003 products?

# re: InfoPath - Get the current user without writing code

Thursday, May 29, 2008 12:41 PM by Hezekiel

i am geting the following error, does any one now how to solve it.

An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566

# re: InfoPath - Get the current user without writing code

Friday, May 30, 2008 7:43 PM by yzzuF

Instead of tieing the rules to the textbox, try going to tools->form options->Open and Save-> Rules

Put all the same code in there.

It will read the user upon opening the form, this post only reads the current user on the original form load.

# re: InfoPath - Get the current user without writing code

Thursday, June 12, 2008 4:31 PM by Bob George

This works great for AD properties but

I have no idea what to expect from SPS profile properties.  Are they actually part of AD also?   Can you can me an example of how to use SPS-Dotted-line?

# re: InfoPath - Get the current user without writing code

Friday, June 13, 2008 10:50 AM by Carsten

Great post, worked first time, and saved me a lot og time, thanks!

# re: InfoPath - Get the current user without writing code

Thursday, June 19, 2008 6:36 AM by Sara

Hi there.

Im trying to capture the current user details. I have tried your above steps and get the following error:

The following DataObject either cannot be created or cannot be initialized: GetUserProfileByName

The query cannot be run for the following DataObject: GetUserProfileByName

InfoPath cannot run the specified query.

Access is denied.

Anyideas?

# re: InfoPath - Get the current user without writing code

Thursday, June 19, 2008 2:21 PM by Yannis

Excellent post!

It works but I have a small issue. What I would like to get as default value in my field is both 'Last name' and 'First Name' of the current user. The closest property to that I believe is the 'PreferredName' which returns 'Last name' comma 'First Name' (Doe, John). However, because of the 'comma' the control picker considers this as two values (and returns a recipient list to choose form for each name).

Is there a way to remove the comma or use some kind of formula? Or another name property without the comma? Thank you in advance.

# re: InfoPath - Get the current user without writing code

Tuesday, June 24, 2008 2:22 PM by McRibIsBack

awesome post! Works perfectly on 2003.  Many thanks!

# re: InfoPath - Get the current user without writing code

Tuesday, June 24, 2008 9:41 PM by Kuinten

This is a great entry, I used this but I want to use repeating tables so that when the a user presses the button on the screen it gets their information. I have that down packed the problem comes when they press the button another table comes down but, we cant put any information in the field once the button is pressed How do I make this work with the repeating tables

# re: InfoPath - Get the current user without writing code

Friday, July 04, 2008 1:49 PM by Bob

# InfoPath Resources URL

Saturday, July 05, 2008 6:46 AM by I'm small, so share nothing...

InfoPath Resources URL

# re: InfoPath - Get the current user without writing code

Thursday, July 10, 2008 11:15 PM by Gopikrishnaega@gmail.com

i end up with the following error, does any one now how to solve it.

An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566

had anybody over come this?

# InfoPath - Get the current user without writing code 取得当前用户

Tuesday, July 15, 2008 8:39 AM by aguest

www.ceapet.com InfoPath-Getthecurrentuserwithoutwritingcode

I'vejust

# re: InfoPath - Get the current user without writing code

Friday, July 18, 2008 7:19 PM by MikeB

This solution works great when a new form is created. However, when someone opens up an existing form  for editing it does not refresh the name in the textbox. It still has the name of the person who initially created the form. I have my data connection to refresh upon opening the form but that isnt working. Any ideas?

# re: InfoPath - Get the current user without writing code

Saturday, July 19, 2008 12:55 AM by MikeB

I answered my own question.

If anyone else has the same issue where the data connection is not being refreshed everytime the form is being opened, create a rule to refresh the data connection everytime the form is opened. To do this:

1. Click on tools, then form options.

2. under the Open and Save section, add a rule to the open behavior section.

3. Set the action to Query using a data connection and select your data connection

This will cause your data connection to refresh everytime the user opens the form.

# re: InfoPath - Get the current user without writing code

Tuesday, July 22, 2008 5:56 PM by Clayton

Please, all of you who are having an error accessing the data source, make sure your IIS site is not set to allow anonymous.  I have used this web service for a long time now without any issues until yesterday when I suddenly couldn't get anything to work.  It was hard for me to believe, but it actually just came down to the fact that my IIS site was set to allow anonymous after some anonymous user testing I had been doing.

# re: InfoPath - Get the current user without writing code

Tuesday, July 29, 2008 2:55 AM by Esther

Hey Helgi,

sorry to take so long but if you are interested, I finally figured out why my form was working 20% of the time and always on the server-

Its a question of load balancing! When a request to the web service went out from the form, our LB server recieved the request and assigned it to 1 of the 3 MOSS servers. If it happened to be the same server serving the form, it worked, if not we saw an unauthorised exception. What worked for me was to ensure our servers included the farm host header mapped to 127.0.0.1 in the host files. So now, the web service request is always served by the same server serving the form.

# Intermittent InfoPath Forms Services Error &laquo; All the Goss about MOSS

Pingback from  Intermittent InfoPath Forms Services Error  &laquo; All the Goss about MOSS

# re: InfoPath - Get the current user without writing code

Tuesday, July 29, 2008 6:55 AM by ravikanth K

To get the User Name in the  Web Browser form

we need to add the shared services providers  in the server and add our web application to that SSP

that way after doing the above process we dont get any error.

thanks

# re: InfoPath - Get the current user without writing code

Tuesday, July 29, 2008 7:44 AM by Shiva ram

I followed this exactly but it failed with:

"Infopath contacted a data source but failed to recieve data. The form will load without the requested data.

Details: The query cannot be run for the following DataObject: GetUserProfileByName

InfoPath cannot run the specified query.

The SOAP response indicates that an error occurred on the server:

Unable to read in användarprofilhanterarobjektet. ---> Value cannot be null.

Parameter name: serverContext"

Anyone got any ideas on this??

To get the User Name in the  Web Browser form

we need to add the shared services providers  in the server and add our web application to that SSP

that way after doing the above process we dont get any error.

thanks

# re: InfoPath - Get the current user without writing code

Tuesday, August 05, 2008 5:22 PM by Dennis

Is it possible to retrieve user infomation (Email, Phone, Department, etc) by manually entering a user name or selecting a user name from a drop down field?

# re: InfoPath - Get the current user without writing code

Tuesday, September 02, 2008 12:45 PM by Clayton

UNBELIEVABLE, after a month+ of everything working great, I suddenly got a bunch of emails and calls saying people were getting this dang error again.  I checked a bunch of stuff and determined it was my User Profile web service again.  After trying lots of other things, I decided to check ISS again, and sure enough, the stinkin Anonymous access had reset itself somehow.  No one else works on this server or does any IIS changes, so I have no idea how anonymous access got re-checked on this web app.  I know I had been doing some testing with extending the web app and trying different zones, but I don't know which part of that could reset anonymous.

Anyway, I unchecked it, recycled the app pool, and then it all worked again.  Dumb!!

Dennis, to get info from this web service, you need to pass the username (i.e. ccobb for me) so that it can return the relevant info.  to have a drop down field of actual names, you'd need some SharePoint list somewhere that matched real names with usernames, and then display those usernames in the dropdown while applying the username as the value.  You could then pass that value back to the webservice as a rule when someone selects the name.  I don't know if that's worth your while, though, and I don't know of any automatica way to pull in all those names associated with username.

# MindBusiness Blog &raquo; Rollen in InfoPath &uuml;ber SharePoint-Liste festlegen

Pingback from  MindBusiness Blog &raquo; Rollen in InfoPath &uuml;ber SharePoint-Liste festlegen

# re: InfoPath - Get the current user without writing code

Thursday, September 11, 2008 11:02 PM by Michael

This is a great start, but what I am trying to achieve is:

1. When user opens the form, a combo-list displays the current users name (from a list of MOSS Users)

2. The user can select another user from the combo-list (e.g. they are completing the form on behalf of another user.

Anyone have any ideas on how this can be done?

Michael - Sydney

# Get the current user without writing code in InfoPath 2007 &laquo; Benoit808&#8217;s Weblog

Pingback from  Get the current user without writing code in InfoPath 2007 &laquo; Benoit808&#8217;s Weblog

# re: InfoPath - Get the current user without writing code

Tuesday, September 23, 2008 4:08 AM by DummyDumb

Ok, I found a solution for the constant display of the administrator account problem. When a rule is assigned to a textbox, which retrieves the current user via the web service, the rule is executed exactly once (during the creation of the form). So if you create a form as an administrator and open the form as user X afterwards, the form still shows administrator. However when you alter the Tools/Form Options/ Open/Save settings and assign a rule to a textbox during form opening, the rule gets applied each time the form is opened resulting in a display of the "current" user.

# re: InfoPath - Get the current user without writing code

Thursday, September 25, 2008 1:08 PM by Adrian

Hello everybody,

For the 5566 log error, please change the proxy settings on the server's web config file, so that it will look like this.

 <system.net>

   <defaultProxy>

     <proxy autoDetect="false" />

   </defaultProxy>

 </system.net>

I had tried several things but none of them seemed to work, until I changed this.

I hope it helps.

Adrian

# re: InfoPath - Get the current user without writing code

Friday, October 03, 2008 4:50 AM by Torbjørn Meland

I am performing a lookup. I use the web service's parameter AccountName to lookup another user. If the user exists, everything is fine. If I try to look up a non existing account, then a Soap Exception is thrown. Is there a way to handle the exception without writing code? I would like the users of the form not to get en error message.

# re: InfoPath - Get the current user without writing code

Saturday, October 11, 2008 2:43 AM by alf

can i get all information of my Manager data with only using that "Manager" property ?

for example : my AccountName is "Alf", and my direct manager is "Bianca Margareth" (define on AD), so how can i get all property of the manager "Bianca" like i did for "Alf" ? thanks..

notes :

i can only get "CONTOSO\b.margareth" for that "Manager" property, can i get all of the manager property ?

# re: InfoPath - Get the current user without writing code

Sunday, October 12, 2008 9:38 PM by alf

thanks God, finally i found the answer and now i want to share..

so, here it is.. (maybe its helpful, thanks..)

first, i go to Tools->Form Options->Open & Save->Rules, below the "Init Form Status and Author" rules (where i used it get the "Manager" property), i add a new rule where the value of the "ManagerAccount" (CONTOSO\.b.margareth) i used as a new parameter to query the webservice "GetUserProfileByName", and then.. voila, i get all of the information i need.. (notes : with this "way", i can get all information that related to the first person i get from this webservice)

best regards,

-- alf --

# re: InfoPath - Get the current user without writing code

Wednesday, October 15, 2008 7:07 PM by Mike Sanlon

Ok. this works great for inserting manager details into a form - but what about the reverse?

I'm building a form for Managers, and I need to query their direct reports. I looks like GetUserProfileByName doesn't have Direct Reports. The Organisation Hierarchy in MOSS will show them but I can't see anywhere in the web service where I can query them.

Any ideas?

# re: InfoPath - Get the current user without writing code

Friday, October 17, 2008 7:56 AM by AJIT

Can someone help ?

There is infopath from published on SharePoint portal, but the prolem is DropDown List Box control of the infopath form retrive text field value from SharePoint list not in sorted order i.e."Alphabatically" when the form opened in browser. Infact it is taking the values by "itemid" property value of sharepoint list.

But when i open it in InfoPath installed on local machine it shows in "Alphabatical" order i.e. sorted.

# re: InfoPath - Get the current user without writing code

Monday, October 20, 2008 10:03 PM by Aniket

Great Article. How can I use this MOSS Form based authentication?

# re: InfoPath - Get the current user without writing code

Monday, November 03, 2008 12:45 PM by Liz Elizondo

AJIT:

I've had a couple of situations where my SharePoint list does not display in Alpha order in a drop-down list box when the form is being viewed in the browser.  It displays correctly in the client.  I did a work-around to get this working.  I think this happens when you have a long list, not sure at what number this happens at but I'm sure it has to do with the amount of items.  

I created a data connection to the SharePoint list as XML:  Refer to this post:

www.sharepoint-tips.com/.../infopath-form-services-implementing.html

Set up your connection as:

server/.../owssvr.dll{ListGUID}&XMLDATA=TRUE

Then use that data connection to apply to your drop down and your items will display in Alpha order when you view it in the browser.  Hope that helps!

# re: InfoPath - Get the current user without writing code

Thursday, November 13, 2008 11:01 AM by Brian Merrifield

Why does the manager value return as "domain\user" instead of preferred name for example?

Is this an issue with our profile import on SharePoint or active directory? Other parts of SharePoint show the manager correctly, so it makes me think its something in this test form.

Thanks,

Brian

# re: InfoPath - Get the current user without writing code

Sunday, November 23, 2008 5:00 AM by Syed Raheel Noor

This article is really nice but to make sure that you come up with the current loged-In user in SharePoint   , You need to publish the form in some form's library of SharePoint and open this published-form through the create menu of that libaray.

other wise if you preview it via InfoPath then you keep on viewing the log-in machine user.

Hope this helps someone!

# re: InfoPath - Get the current user without writing code

Sunday, November 23, 2008 4:26 PM by jim

absolutely outstanding! works great.....

# re: InfoPath - Get the current user without writing code

Tuesday, November 25, 2008 11:36 AM by Tedybb

Great Article, the only thing is that it works for me only with Administrator. If I try to use the prepared form with another user I'm getting Server was unable to process the request - Attempt to perform un unauthorized operation ...

Any Ideas ?

# re: InfoPath - Get the current user without writing code

Thursday, December 04, 2008 11:54 PM by Ginni

How can i get the other details of user by just manually putting the user's name???

That is, i just want to put the manager's name and rest information about that particular user should come automatically.

# re: InfoPath - Get the current user without writing code

Tuesday, December 16, 2008 4:51 PM by Inginero

Here is the solution that worked for me in addressing error 5566.

Our environment:  Medium farm behind Cisco Load Balancer.  We are also using host headers in our configuration.

Suggested solutions attempted:  

*  Pointing to the web service at the site collection scope instead of the top of the server.

*  Updating the web config to say Proxy AutoDetect = false

*  Confirmed we were not allowing anonymous access to the web app.

Our scenario:  Intermittent success or partial success of SharePoint web service calls when form was rendered in web browser.  A 5566 application event was logged in on the application server and review of the IIS logs indicated the GET calls used to render the form were being logged to a different WFE then the POST statements used to query the web service.

Pre-solution IIS Log:

2008-12-16 21:26:38 W3SVC1723786348 [WFE IP] POST /sites/test01/_vti_bin/UserProfileService.asmx - 80 – [NLB IP] InfoPathDA 401 1 0

Post-solution IIS Log: 2008-12-16 21:27:27 W3SVC1723786348 127.0.0.1 POST /sites/test01/_vti_bin/UserProfileService.asmx - 80 DOMAIN\TestUser 127.0.0.1 InfoPathDA 200 0 0

Solution:

*  On each front end node add an entry in IIS for the web application allowing traffic on 127.0.0.1 when the host header contains the name associated with the Public URL AAM mapping used for the zone you are configuring.  (e.g.  "INTRANET"

*  In the hosts file for each node add a line pointing the name referenced above to 127.0.0.1 (e.g. "INTRANET"

With these changes in play the POST web service calls initiated by InfoPath Forms Web Services resolve to the same WFE node as the GET and you are back in action... assuming this is the particular 5566 Infopath web service error you were attempting to solve.

# re: InfoPath - Get the current user without writing code

Tuesday, December 16, 2008 9:44 PM by swastik

thanks....Great Post.

works like a charm..

# re: InfoPath - Get the current user without writing code

Monday, December 22, 2008 6:19 PM by Hiran Salvi

If you are getting error 5566 Try to modify Registry as mentioned in Following Article that worked for me.

support.microsoft.com/.../926642

# re: InfoPath - Get the current user without writing code

Tuesday, December 30, 2008 7:04 PM by Gloriann O'Brien

Works perfect and solved a problem I was having with the code in onload.  

# re: InfoPath - Get the current user without writing code

Wednesday, December 31, 2008 8:45 PM by Joaquin

For those that are having the following error:

"An error occurred accessing a data source. An entry has been added to the Windows event log of the server. Log ID:5566"

This problem occurs because Windows Server 2003 SP1 includes a new security feature named loopback check functionality. By default, loopback check functionality is turned on in Windows Server 2003 SP1, and the value of the DisableLoopbackCheck registry entry is set to 0 (zero).

Solution:

1. Click Start, click Run, type regedit, and then click OK.

2. Locate and then click the following registry subkey:

   HKEY_LOCAL_MACHINE

   -->SYSTEM

        -->CurrentControlSet

             -->Control

                  -->Lsa

3. Right-click Lsa, point to New, and then click DWORD Value.

4. Type DisableLoopbackCheck, and then press ENTER.

5. Right-click DisableLoopbackCheck, and then click Modify.

6. In the Value data box, type 1, and then click OK.

7. Exit Registry Editor.

8. Restart the computer.

# re: InfoPath - Get the current user without writing code

Monday, January 05, 2009 8:17 AM by web services

InfoPath will pull the FirstName value from the array and display it. But that does me no good as I need the information for the current user who is logged in. It works perfect and solved a problem I was having with the code in onload.  

www.torontowebservices.com

# re: InfoPath - Get the current user without writing code

Friday, January 09, 2009 5:10 PM by Steve B

These were great instructions!  I wish all data connections were as simple as this inside infopath - I'm starting to see how powerful a tool this can be when paired with Sharepoint.

Thanks Itay.

# re: InfoPath - Get the current user without writing code

Saturday, January 17, 2009 9:59 PM by Mike

This works perfectly for me. However, I'm curious to know if anyone has a solution for expanding on this.

Once I've retrieved my user's ID, how to I compare this to a SharePoint list? Here's the scenario. Think of it as a sort of "Advanced Conditional Formatting."

1. User opens form and ID is retrieved (using above instructions).

2. InfoPath needs to determine whether to show an approve button by comparing this ID to a SharePoint list and answering two questions: Is this ID in the SharePoint list? Is the Approver column marked "Yes"?

3. If this ID is in the SharePoint list AND if the ID is marked as an "Approver" then InfoPath should show the Approve button.

I'm going at it this way to avoid User Roles. I have many users who serve multiple roles - Infopath only will assign to the first role it finds them in, even if that particular role has no bearing on the role they're playing at a particular time or phase of our internal approval process.

Any suggestions? A step-by-step guide to something like this would be perfect, however I'll take what I can get!

Thanks,

Mike

# Display the Current User on a Browser-Enabled Form | keyongtech

Pingback from  Display the Current User on a Browser-Enabled Form | keyongtech

# Error 5566 | keyongtech

Thursday, January 22, 2009 6:18 AM by Error 5566 | keyongtech

Pingback from  Error 5566 | keyongtech

# re: InfoPath - Get the current user without writing code

Sunday, February 08, 2009 9:08 PM by Danijel

This method is working only for the accounts who have permitions to access the web service. How can I grant access to all users to the a/m web service?

# re: InfoPath - Get the current user without writing code

Friday, February 20, 2009 1:54 PM by Jesper Simonsen

There's an article on support.microsoft.com/.../896861 that describes one of the possible reasons for getting the 'error accessing datasource' as described in several comments. We user this solution to solve a similar problem in InfoPath forms. Click on my name for further details.

# re: InfoPath - Get the current user without writing code

Tuesday, March 10, 2009 12:41 AM by HenryK

Does this method work on Windows Sharepoint Services (WSS) installs?  I can't find a UserProfileService.asmx  anywhere on the WSS box.

Thanks.

# re: InfoPath - Get the current user without writing code

Wednesday, March 11, 2009 7:47 AM by Andrei

Should I configure this form with such web service as a "full trust" for publishing ? Thanks

# Infopath developer

Wednesday, March 11, 2009 4:43 PM by svendsen's blog

Infopath developer

# re: InfoPath - Get the current user without writing code

Wednesday, March 11, 2009 6:37 PM by Itay Shakury

Hello Everyone,

Thank you very much for you feedback it means a lot!

Thanks for everyone who responded to other people's questions!

I am sorry I haven't been able to address your questions. From now on I will try to keep up and provide some answers. Starting with few of the latest questions who weren't answered:

Andrei - If your form resides in a form library in the same server you don't have to set full trust for the form. make sure the url to the web service contains the full path including the site itself. for example portal/.../_vti_bin...

HenryK - This solution is using MOSS profile services and therefore not available for WSS.

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Thursday, March 12, 2009 8:35 AM by Andrei

Thank you Itay, it works ! Great article.

# re: InfoPath - Get the current user without writing code

Sunday, March 15, 2009 6:48 PM by Prasad

I am not able to get my Type, Managers name as Mentioned here. can you give with detailed data

# re: InfoPath - Get the current user without writing code

Friday, March 20, 2009 6:59 PM by Itay Shakury

Hi Prasad,

How are you trying to get the manager's name? is it using the "Manager" attribute of the returned profile?

Are you sure the manager attribute is maintained in AD? is it imported to MOSS?

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Thursday, March 26, 2009 12:47 PM by Stuart

Works like a dream!

Thanks Itak.

I would also like to bring back a full list of AD users (depending on country) then be able to select one and bring back their details (phone number)

This would work like a simple way to get a phone number.

Is this possible?  could you point me in the right direction please?

Thanks

Stu

# re: InfoPath - Get the current user without writing code

Wednesday, April 01, 2009 12:30 AM by Michael Bierly

I was getting the 5566 error too after I published to my server and found this out

it worked fine in the InfoPath app, but through forms services on the server I got the  5566 error.

The problem was that I was calling a web service on my production server but had deployed my form on a dev server.

Since I am using NTLM, I was getting that multiple hop issue.  I changed the data connection to call the web service on the dev machine and all was fine.  I suppose that switching to Kerberos would work too, but that isnt the way the client has the authentication set up.

# re: InfoPath - Get the current user without writing code

Saturday, April 04, 2009 1:40 AM by Itay Shakury

Stu, I'm afraid the built-in web services doesn't provide a method to enumerate all the users in the profiles store.

You'll have to create you own service.

Michael, You can test the form on the dev site using the dev's service address. when you are ready to go live, change the web service address in the data connections wizard, and publish the form to the production site. I know it's a bit cumbersome, but deployment hasn't been SharePoint's strong side.

Itay Shakury.

# Save Username in InfoPath form | keyongtech

Monday, April 06, 2009 10:06 AM by Save Username in InfoPath form | keyongtech

Pingback from  Save Username in InfoPath form | keyongtech

# re: InfoPath - Get the current user without writing code

Monday, April 06, 2009 6:20 PM by UnisouceGuy

I'm new to InfoPath.  I tryied the above steps, but I keep receiving an error.

"4) Now you will have to point the wizard to the WS. Type an address similar to this: servername/.../UserProfileService.asmx  and click next."

The message I'm receiving is

"InfoPath cannot find or access the specified Web service description."

Is there a way to very if my sharepoint UserProfileService file exist or if i have access to it?

Thanks.

# re: InfoPath - Get the current user without writing code

Tuesday, April 07, 2009 12:40 AM by Jorge

Wow, man. Thank you so much!

# re: InfoPath - Get the current user without writing code

Tuesday, April 07, 2009 11:41 AM by Itay Shakury

UnisouceGuy,

What address are you typing?

About your quiestion - you can verify the WS exists by looking at IIS manager, at the web site you are using, inside the virtual folder called "_vti_bin". This folder should contain the list of Web Services, look for UserProfileService.asmx in there.

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Tuesday, April 07, 2009 6:50 PM by UnisourceGuy

I was able to get access to the _Vti_Bin.  When i followed the steps above I get a message:

"InfoPath Cannot create a New, Blank Form. The Form Template is not Valid"

I removed the default value, and rec'd the message again.

I removed the Dataconnection and the Message dissapears.

The Form works without the _Vti_Bin link.

Is there a security setting that I need to change?  I'm using InfoPath 2003.  My company has not made the transition yet to 2007.

# re: InfoPath - Get the current user without writing code

Tuesday, April 07, 2009 6:53 PM by UnisourceGuy

This is the Help File Detail:

"The following DataObject either cannot be created or cannot be initialized: GetUserProfileByName

The query cannot be run for the following DataObject: GetUserProfileByName

InfoPath cannot run the specified query.

The SOAP response indicates that an error occurred:

Invalid input for account name, cannot be empty or null."

Thanks for your help.

# re: InfoPath - Get the current user without writing code

Wednesday, April 08, 2009 1:55 PM by Itay Shakury

UnisourceGuy,

What default value are you referring to?

You pasted an error message : "Invalid input for account name, cannot be empty or null." When are you receiving it?

It sounds odd that you are getting this because The GetUserProfileByNeme must receive a nulll input in order to return the current user's details.

Maybe it's an IP2003 thing, I don't know, this solution hasn't been tested with 2003 (by me).

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Thursday, April 09, 2009 5:36 PM by Jay

To any others that have been getting the error 5566, this was what happened in my case.

I did all of the suggested steps of others such as clear the Anonymous checkbox, mess with the data connection settings, etc.  None of it worked in my case.

So before taking a bat to my server, I decided to just create a test web application and site collection from scratch since all I had been doing is wrestling with an existing site.

I went into Central Administration and just created a new web application with a new database.  In creating the web application, I made sure to use my designated SharePoint Service account (rather than using a network service).

Then created a new site collection associated with that web application.  I left the Anonymous off (for now).  Jumped into InfoPath and followed Itay's VERY helpful instructions and simply created a genric form with a first name, last name, and email textboxes.

Worked like a charm.  So I apparently have some underlying issue with my existing sites that are getting the Error 5566.  I double-checked that the underlying web applications for those "faulting sites" were using the SharePoint Service account but there's still an issue somewhere.  I also made sure they all had the correct SQL database permissions, etc.  Still no luck.

So for those having the Error 5566 no matter what you've tried, perhaps just create a fresh test web application and site collection to ensure that your SharePoint & SQL are at least working in that capacity?

In my case I'll just be dumping the "faulty" sites and web applications and starting afresh because I have the source InfoPath forms stored and can easily re-create our SharePoint sites since we don't have too much defined as of yet.

Thanks to all who've contributed to this and other blogs.  It's helped me to at least eventually narrow down my problem.  Hoping my feedback here will be of help to someone else having the same grief as I went through with Error 5566.  And thanks Itay for your article!

# re: InfoPath - Get the current user without writing code

Thursday, April 09, 2009 9:40 PM by Jay

***Update***

After further testing, I was able to re-create the Error 5566.  It has to do with using Basic Authentication vs. Integrated Windows (or otherwise) methods.  With Integrated Windows (NTLM) on, form worked fine and filled in data correctly from user's profile (first name, last name, email address, etc.)  I then started adjusting options one by one to find out when it would break.

I then tested flipping on Anonymous access.  Still worked.  Then I tried adding Basic Authentication along with Integrated Windows (NTLM).  Still worked, however, the site was only accepting Integrated Windows logins and wouldn't accept a Basic Authentication attempt.  By this, I mean that I'd have to enter a login using "Domain Name\Account Name" method.  My goal is to not have to force the user to enter in the "domain name\" part.

So I tried turning off Integrated Windows and using just Basic Authentication.  In IIS Manager, for the website I'm working on, I also added in the default domin name under Basic Authentication.  After having done that, I went to test the site.  I can get to the site as Anonymous, I can login using just an account name and password without "domain name\".  But when I go to open the InfoPath form...  BOOM!  Error 5566 again.

So it appears I'll have to use Forms based authentication or SSO unless there's another way of being able to allow an Integrated Windows style login without having to include the domin name.  Our target client audience will be people outside of our domain and I'm hoping to have their logins be their email address and then whatever password we assign.  I had been creating their logins on our domain which means their login name would be something like JDoe@Acme.Com@Jay.Org (because the ending @Jay.Org would be our domain name).  Using Basic Authentication and a default domain name in IIS set to @Jay.Org, I was able to get users to login with their email address and the password we issued to them.

But apparently Basic Authenication won't work with the GetUserProfile method because the domain name isn't passed in the authentication which is why Error 5566 is nagging about failing to connect to a data source.

If anyone has advice for me on a better method, I'd appreciate it.  Otherwise, I'm venturing in to Forms Based/SSO waters.  Thanks!

# re: InfoPath - Get the current user without writing code

Wednesday, April 22, 2009 5:37 AM by bela1

I was wondering if anyone knows how to remove the [Submitted by ...] information that InfoPath Forms automatically generates?

I need a form that is Anonymous.  

# re: InfoPath - Get the current user without writing code

Wednesday, April 22, 2009 5:39 AM by bela1

I was wondering if anyone knows how to remove the 'submitted by' information that is automatically generated by InfoPath forms, when forms are submitted.

I need to generate an anonymous form for fraud alerts.

# WSS 3.0 & MOSS: Preguntas & Respuestas (I)!

Monday, April 27, 2009 6:44 PM by Blog del CIIN

Sin duda, una de las ventajas de realizar formaci&oacute;n tecnol&oacute;gica especializada es que aprenden

# WSS 3.0 &amp; MOSS: Preguntas &amp; Respuestas (I)! &laquo; Pasi??n por la tecnolog??a&#8230;

Pingback from  WSS 3.0 &amp; MOSS: Preguntas &amp; Respuestas (I)! &laquo; Pasi??n por la tecnolog??a&#8230;

# re: InfoPath - Get the current user without writing code

Tuesday, April 28, 2009 8:40 PM by Suzanne

You rock!  This was so easy to follow.  Thank you :)  Bookmarked it for when I have to do this again!!

# re: InfoPath - Get the current user without writing code

Thursday, May 14, 2009 1:13 PM by BS

Thanks great post - it works in preview mode for me, but when i upload form template to MOSS, i get an unknown error.  Anyone one know why this may be?

# re: InfoPath - Get the current user without writing code

Thursday, May 14, 2009 10:42 PM by Itay Shakury

Jay,

Great investigation. Thank you very much for sharing it. Unforunatly, I don't know of a way to login without entering domain.

bela1,

How about removing the "Created By" collumn from the Forms library view?

BS,

We will need some more informaion on your problem. exactly what are you doing, how are you doing it, and what is the result.

Itay Shakury.

# Get current user information in Infopath form

Friday, May 15, 2009 1:00 PM by Information-Worker.nl

Get current user information in Infopath form

# re: InfoPath - Get the current user without writing code

Monday, May 18, 2009 1:00 PM by BS

Itay,

I've followed the steps you have above.  When I do preview mode within in InfoPath, and test my form, the username does pull through.  However I am using my form integrated with SharePoint.  So when I try to upload the form it gives me an unknown error.  When I remove the changes I made using your steps, the form uploads correctly.  So am not sure why SharePoint is not liking this?

# re: InfoPath - Get the current user without writing code

Tuesday, May 19, 2009 11:15 AM by Itay Shakury

Hi BS,

How are you publishing the form?

When are you getting the Unknown Error? during upload? when you try to fill the form?

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Wednesday, May 27, 2009 11:19 AM by Shiri

Hi Itay.

Thank you for this post, helps a lot.

Do you know how to connect a self created attribute using this method (i need to get the employee number filed which we created in AD)?

Thanks!

# re: InfoPath - Get the current user without writing code

Wednesday, May 27, 2009 2:43 PM by Itay Shakury

Hi Shiri,

You will need to create a new custom profile property in the profile store (it's in the SSP admin site). Then map your custom AD attribute to that property.

Then, in the web service call you will receive the custom property among the other properties.

Itay Shakury.

# DevTechBlog &raquo; InfoPath aktueller Benutzer

Wednesday, May 27, 2009 7:59 PM by DevTechBlog » InfoPath aktueller Benutzer

Pingback from  DevTechBlog  &raquo; InfoPath aktueller Benutzer

# re: InfoPath - Get the current user without writing code

Thursday, May 28, 2009 9:38 AM by Shiri

Hi Itay,

Thanks!

I Have created the custom property on SSP (and import it), and tried to use it on the form, but it is not working. The properties has different names GivenName=FirstName, and i couldn't find the FirstName in the property properties. So where is it?  where do i connect this property as FirstName is givenname?

# re: InfoPath - Get the current user without writing code

Thursday, May 28, 2009 10:58 AM by Shiri

Never mind..I did a full import instead of incremental and it is working now.

Thanks anyway :)

# re: InfoPath - Get the current user without writing code

Thursday, May 28, 2009 9:54 PM by DanP

Excellent post and the basis is well formed.  I also found the questions and answers helpful as I have encountered most of the problems identified.

The InfoPathh form is working now but when I try to open it up to the user community I discovered that only users within the site collection administrators group can access their data.  The others get a message stating that one of the connections failed.

Any ideas as to why this level of access would be required to get your user profile data?

Thanks

# re: InfoPath - Get the current user without writing code

Saturday, May 30, 2009 5:25 PM by Itay Shakury

Danp,

There is no reason why this should happen.

Please recheck your other Data Connections, and the details of the Data Connection to the profiles service.

Itay Shakury.

# Get current user information in Infopath form

Tuesday, June 02, 2009 9:09 PM by Get current user information in Infopath form

Pingback from  Get current user information in Infopath form

# re: InfoPath - Get the current user without writing code

Friday, June 05, 2009 10:56 PM by BS

Itay,

Publishing the form to a SharePoint Site, get the unknown error when uploading the form in Upload templates.

Any ideas?

BS

# re: InfoPath - Get the current user without writing code

Saturday, June 06, 2009 4:42 PM by Itay Shakury

Hi BS,

What do you mean by "upload templates"?

You should publish the form to a SharePoint library from infopath (file --> publish).

Itay Shakury.

# The GetCommonManager webservice in Infopath 2007

Tuesday, June 09, 2009 5:52 PM by The GetCommonManager webservice in Infopath 2007

Pingback from  The GetCommonManager webservice in Infopath 2007

# re: InfoPath - Get the current user without writing code

Wednesday, June 10, 2009 9:48 PM by Ned

Tried it and now my form won't work. Test this on a small form first, don't do what I did and wait till your form is all completed. Now I can't get it to open no matter what I do.

# re: InfoPath - Get the current user without writing code

Thursday, June 11, 2009 4:43 PM by Amod

Hey Itay and all,

Your blog on getting user name info worked wonders for me.

You being an expert on this, can I ask you one question:

I am trying to get group name of a SHarePoint site in InfoPath 2007 form. Can you suggest which web service to use and which method.

Please help.

Thanks in advance!

Amod

# re: InfoPath - Get the current user without writing code

Thursday, June 11, 2009 9:28 PM by Itay Shakury

Hi Amod,

I didn't quite get your question.

What do you mean by "group name of a SharePoint site"?

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Friday, June 12, 2009 9:21 AM by Tuddy

{{QUOTE}}# re: InfoPath - Get the current user without writing code

Sunday, October 12, 2008 9:38 PM by alf

thanks God, finally i found the answer and now i want to share..

so, here it is.. (maybe its helpful, thanks..)

first, i go to Tools->Form Options->Open & Save->Rules, below the "Init Form Status and Author" rules (where i used it get the "Manager" property), i add a new rule where the value of the "ManagerAccount" (CONTOSO\.b.margareth) i used as a new parameter to query the webservice "GetUserProfileByName", and then.. voila, i get all of the information i need.. (notes : with this "way", i can get all information that related to the first person i get from this webservice)

best regards,

-- alf --{{QUOTE}}

Hi Alf, Are you able to give a more detailed step by step guide on what you actually did, I'm confusing myself im sure and can't get it to work.

Of if anyone else who has done it able to detail step by step how they do it.

I simply can't figure out how to tell that text box to use the Managers details. I have a 'hidden' textbox that gets the manager by the logged in users Getprofilebyname "manager" parameter but then I am stuck.

Thank You!

# User Roles in Browser-Enabled Forms &laquo; Clayton&#039;s SharePoint Madness

Pingback from  User Roles in Browser-Enabled Forms &laquo; Clayton&#039;s SharePoint Madness

# re: InfoPath - Get the current user without writing code

Monday, June 15, 2009 11:35 PM by Abdul Latif

Its an excellent example. Thank you very much.

# Inforpath &#8211; Get current userdetails with no coding - PeteStilgoe.com

Pingback from  Inforpath &#8211; Get current userdetails with no coding - PeteStilgoe.com

# re: InfoPath - Get the current user without writing code

Friday, June 19, 2009 12:18 PM by Stu

Hi Itay,

This is superb - thank you once again my friend.

Is it possible to get the current user's, Country, Company, Site and Department from Active Directory?

Thanks in advance.

Stu

# re: InfoPath - Get the current user without writing code

Friday, June 19, 2009 5:45 PM by Itay Shakury

Hi Stu,

Thanks for the feedback, appreciate it.

About your question, You can get practically every attribute from AD.

Just make sure it's synced to MOSS profile store, then use the list of attributes (provided in the bottom of this post) to use it in InfoPath.

Good Luck.

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Friday, June 19, 2009 5:47 PM by Itay Shakury

Hi Stu,

Thanks for the feedback, appreciate it.

About your question, You can get practically every attribute from AD.

Just make sure it's synced to MOSS profile store, then use the list of attributes (provided in the bottom of this post) to use it in InfoPath.

Good Luck.

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Friday, June 19, 2009 11:10 PM by iab

Hi Itay,

I followed your suggested approach portal/.../_vti_bin... and still getting this issue. Its works fine o issue if I preview it or test on browser.

Is there stil any hope to solve this issue.

Appreciate your help.

# re: InfoPath - Get the current user without writing code

Friday, June 19, 2009 11:15 PM by iab

forgot to mention issue

An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566

# re: InfoPath - Get the current user without writing code

Saturday, June 20, 2009 11:30 AM by Itay Shakury

Hi iab,

I'm guessing it's a security issue. URL you have entered in the Web Service data connection includes the path to the site were you deployed the form to.

If that's not the case, I'm afraid I can't help based on the information you provided..

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Saturday, June 20, 2009 9:58 PM by Clayton

Iab, did you verify that the IIS site for your respective SharePoint site does not have Anonymous Access enabled?

Itay and others, I am currently creating a new blog post that is an extension of this one so that everyone can learn exactly how to leverage the Manager node to get manager information as well as information about any other user besides the current user.  I will post the link here when I'm done, but you can already see my blog URL here:  claytoncobb.wordpress.com.  I have 3 codeless programming blog entries so far, and this new one will be my 4th.

# InfoPath &#8211; Get the current user without writing code (extended) &laquo; Clayton&#039;s SharePoint Madness

Pingback from  InfoPath &#8211; Get the current user without writing code (extended) &laquo; Clayton&#039;s SharePoint Madness

# re: InfoPath - Get the current user without writing code

Sunday, June 21, 2009 9:20 AM by Clayton

Ok, I just finished it, and it's HUGE.  Hopefully, people can spend the time to follow it through, because it's worth it:

claytoncobb.wordpress.com/.../userprofileservice-extended

This is how you take Itay's great blog entry and extend it...

# re: InfoPath - Get the current user without writing code

Wednesday, June 24, 2009 5:35 PM by Amod

Hi Itay,

In regard to my question on June 11 about SharePoint Group.

I want to check (conditional formatting for certain buttons in InfoPath )if the current user is added to a certain Group.

Hence I was trying to get a webservice and a web-method to retrieve the group name. How is that possible?

Thanks for the help.

# re: InfoPath - Get the current user without writing code

Wednesday, June 24, 2009 7:21 PM by Itay Shakury

Hi Amod,

I have never tried it, but would have started by looking at

UserGroup.asmx web service, and the GetGroupCollectionFromUser method.

msdn.microsoft.com/.../ms772552.aspx

Itay Shakury.

# re: InfoPath - Get the current user without writing code

Thursday, June 25, 2009 9:30 PM by jcurl

If you are getting the Log Id:5566 error, make sure the logged in user has the "Personal Features" right in the Shared Service Provider. This right is required to access the User Profile web service.  To manage Share Service Rights:

Browse to http://[your Shared Services Administration site]/ssp/admin/_layouts/ManageServicePermissions.aspx

   OR

Click on the name of your Shared Services provider from left (Quick Launch) menu on the SharePoint Central Administration home page and then click on Personalization services permissions under the User Profiles and My Sites section.  

# re: InfoPath - Get the current user without writing code

Monday, June 29, 2009 12:36 AM by Clayton

Amod, if you want to check to see if the current user (or any user) is a member of a specific group (AD or SharePoint), then you can use the GetCommonMemberships method to see all the groups a user is a member of, and then you can use that info to restrict/hide/disable controls/sections using conditional formatting.  I will be writing this up as a fix to my User Roles in Browser Forms blog entry.  I took my previous method down until I include this new method.

# re: InfoPath - Get the current user without writing code

Thursday, July 02, 2009 5:24 AM by david J

Hi Itay,

I tried this on my development server - worked first time :-)

I tried this on my production server - and got a security error.

The error I got was...

The query cannot be run for the following DataObject: GetUserProfileByName

InfoPath cannot run the specified query.

The SOAP response indicates that an error occurred on the server:

Server was unable to process request. ---> Access Denied: To create a user profile, you must be an administrator, or create your own profile and have personal features rights.

Do you know how or where I would fix this?

many thanks in advance!

regards

David

# re: InfoPath - Get the current user without writing code

Thursday, July 02, 2009 12:14 PM by Itay Shakury

check out jcurl's comment from 25.6 just 2 comments above yours.

# InfoPath &#8211; User Roles in Browser-Enabled Forms using GetCommonMemberships &laquo; Clayton&#039;s SharePoint Madness

Pingback from  InfoPath &#8211; User Roles in Browser-Enabled Forms using GetCommonMemberships &laquo; Clayton&#039;s SharePoint Madness

# re: InfoPath - Get the current user without writing code

Friday, July 17, 2009 4:58 AM by SJ

Perfect!!!

Thanks A million

# InfoPath &#8211; User Roles in Browser-Enabled Forms Using Groups &laquo; Clayton&#039;s SharePoint Madness

Pingback from  InfoPath &#8211; User Roles in Browser-Enabled Forms Using Groups &laquo; Clayton&#039;s SharePoint Madness

# re: InfoPath - Get the current user without writing code

Tuesday, July 21, 2009 11:34 PM by nld

Hey Itay,

Thanks for the post. This seems to work the first time the form is opened, but when the form is submitted and saved in a library, and opened by a different person from the one who initially opened the form; how do I refresh the data connection so that I can retrieve the information of the current viewer of the form.

Thanks

NLD

# re: InfoPath - Get the current user without writing code

Thursday, July 23, 2009 2:36 PM by saer

ddddddddddddddddddddddddd

# re: InfoPath - Get the current user without writing code

Wednesday, July 29, 2009 4:29 PM by Mohsin

how can i get Initials of User from AD

# re: InfoPath - Get the current user without writing code

Thursday, July 30, 2009 8:53 PM by Larry

Great article - I use it all the time!

# re: InfoPath - Get the current user without writing code

Tuesday, August 04, 2009 12:27 PM by Infoment

Great Post - very helpful. We are using this method in almost any of our forms. THX for the outstanding work and explanation.

# re: InfoPath - Get the current user without writing code

Tuesday, August 04, 2009 3:08 PM by Arvin

Brillilent Stuff... I also had the error

An error occurred accessing a data source.

An entry has been added to the Windows event log of the server.

Log ID:5566

Turned off Anonymous Access.. and converted the datasource for the webservice to UDCX.

# re: InfoPath - Get the current user without writing code

Thursday, August 13, 2009 8:14 PM by Mariya

Thanks ,

I was able to get the Manager details.Now how can I get my Manager Managers E-mail,name?

# re: InfoPath - Get the current user without writing code

Friday, August 14, 2009 5:23 PM by DOD

For KIP...

RE: your reply to Clayton dated, Tuesday, February 26, 2008 7:48 PM

Simple but Brilliant!!!

# Twitter Trackbacks for InfoPath - Get the current user without writing code - itaysk [microsoft.co.il] on Topsy.com

Pingback from  Twitter Trackbacks for                 InfoPath - Get the current user without writing code - itaysk         [microsoft.co.il]        on Topsy.com

# re: InfoPath - Get the current user without writing code

Thursday, September 03, 2009 12:24 AM by MAV

Hey this is a great post!

Works great when the form is opened the first time, however does anyone know how to update "AccountName" when the same form, not a new form, is opened by someone other than the person who initially filled out the form?

Any suggestions or help is appreciated. Thank you.

# re: InfoPath - Get the current user without writing code

Monday, September 07, 2009 10:44 PM by subash das

can we find in infopath wheather the current user is present in a sharepoint group or not without writing code.

# re: InfoPath - Get the current user without writing code

Monday, October 12, 2009 3:13 PM by Amit

This is great post and works fine, do you have any idea how to get Manager's full name instead of "Username" of manger that we get from "Manager" Property Name.

# re: InfoPath - Get the current user without writing code

Monday, October 19, 2009 2:03 PM by Alan

Great post! helped me a lot. thanks

# re: InfoPath - Get the current user without writing code

Thursday, October 29, 2009 1:35 PM by chessy

# Things I&rsquo;ve Found Out About InfoPath and Forms Services &laquo; The WorkerThread Blog

Pingback from  Things I&rsquo;ve Found Out About InfoPath and Forms Services &laquo;  The WorkerThread Blog

# Things I&rsquo;ve Learned About InfoPath and Forms Services &laquo; The WorkerThread Blog

Pingback from  Things I&rsquo;ve Learned About InfoPath and Forms Services &laquo;  The WorkerThread Blog

# Things I&rsquo;ve Learnt About InfoPath and Forms Services &laquo; The WorkerThread Blog

Pingback from  Things I&rsquo;ve Learnt About InfoPath and Forms Services &laquo;  The WorkerThread Blog

# SharePoint Blog &raquo; Blog Archive &raquo; WebService &#8211; GetUSerProfileByName

Pingback from  SharePoint Blog  &raquo; Blog Archive   &raquo; WebService &#8211; GetUSerProfileByName

# SharePoint: Things I???ve Learnt About InfoPath and Forms Services | End User SharePoint

Pingback from  SharePoint: Things I???ve Learnt About InfoPath and Forms Services | End User SharePoint

# SharePoint List &ndash; using [Me] filter on a column with AD user information populated from InfoPath (without code) &laquo; Gareth M Davies

Pingback from  SharePoint List &ndash; using [Me] filter on a column with AD user information populated from InfoPath (without code) &laquo; Gareth M Davies

# sharepointblog &raquo; Blog Archive &raquo; GetUserProfileByName

Friday, November 13, 2009 3:13 PM by sharepointblog » Blog Archive » GetUserProfileByName

Pingback from  sharepointblog  &raquo; Blog Archive   &raquo; GetUserProfileByName

# re: InfoPath - Get the current user without writing code

Tuesday, November 24, 2009 9:07 PM by Mohamed Sadek

All people find this post great. However this posted neglected a very important aspect which is "multi-valued" properties. Use this approach and you are going to fail miserably in getting a multi-valued property

# re: InfoPath - Get the current user without writing code

Wednesday, December 02, 2009 6:26 PM by Stefanie

This is awesome! Thank you - I added it to my infopath form and it works great setting the default value.

I would like to use a similar method on the same form which would be a listbox to select from of ALL users

I was going to go through the same steps using this

GetUserCollectionFromSite but I receive this alert [you must select a repeating group or field].

How can I populate a listbox of all users? Will it be sorted?

# re: InfoPath - Get the current user without writing code

Wednesday, December 09, 2009 11:12 AM by markus

hello itay,

(i posted the same on clayton cobbs blog and than i realized that the walkthrough comes from here)

first thank you for your blog i tried to realize this solution but an error comes up on my application. so i want to ask for help. i'm not the administrator of the server the application runs on and i have no acces to the central administration but maybe after that i can give the administrators of the server some hints so this solution could run.

thank you in advance and greetings from germany (and please excuse my english)

markus

The error-message is:

This query can not be performed on the object "GetUserProfileByName" of type "Data Object".

The specified query can not be run from InfoPath.

The SOAP response indicates that a server error has occurred:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.

  at Microsoft.Office.Server.UserProfiles.PublishedLinksService.EnsureUserProfileReadPermissions()

  at Microsoft.Office.Server.UserProfiles.UserProfileService..ctor()

  --- End of inner exception stack trace ---

# re: InfoPath - Get the current user without writing code

Thursday, December 10, 2009 8:54 AM by Hazem Elshabini

I tested the instructions on this post and it worked fine, however it was always getting the current user of InfoPath (which always happens to be the current windows user) not the current user logged onto SharePoint.

I tested this in a non web enabed form. maybe that's why?

please clarify what do you mean by the "current user"...

Thanks and it's a great post

# re: InfoPath - Get the current user without writing code

Thursday, December 10, 2009 1:08 PM by Lily

As quoted from above #4: Now you will have to point the wizard to the WS. Type an address similar to this: servername/.../UserProfileService.asmx  and click next.

Where or how can I get the URL which is simillar to this?

# re: InfoPath - Get the current user without writing code

Thursday, December 17, 2009 11:19 AM by Haris Askano

He means you should replace the "servername" with the name of your sharepoint portal server.

# re: InfoPath - Get the current user without writing code

Thursday, January 21, 2010 12:36 PM by Faisal

Thanks a lot for this..............

# re: InfoPath - Get the current user without writing code

Friday, January 22, 2010 11:22 PM by BeautifulMonster

Don't stop posting such articles. I love to read blogs like that. By the way add some pics :)

# Sites &laquo; Dot Net Solutions

Monday, January 25, 2010 4:43 PM by Sites « Dot Net Solutions

Pingback from  Sites &laquo; Dot Net Solutions

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: