none
InfoPath Form, GetUserProfileByName retrieving blank for non-admin users RRS feed

  • Question

  • I have an InfoPath form that retrieves the name of user when the user is an administrator. For non-administrators, it retrieves a blank message. Here is the error. 

    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.

     

    Would appreciate any reps. 

     

    Thanks

    V


    V
    Wednesday, March 9, 2011 9:47 PM

Answers

  • It's not retrieving a blank message...the query is being denied.  Your non-admins either do not have access to read from that web service, or their accounts do not exist in the profile database.  Notice the errors?  It shows you have access denied, so it's telling you directly.  It also mentions creating a user profile as if there IS no user profile for the user being queried.  Also, in 2007, users must have Read permissions to the Personal Features in your SSP's Personalization Services Permissions settings (also hinted at this in the error).
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Peng Lei Wednesday, March 16, 2011 9:41 AM
    Thursday, March 10, 2011 7:25 AM
  • What kind of admin user are you referring to? Are they administrator on a specific computer or a workstation admin or a domain admin?

    Regardless, it doesn't really matter whether the user is an administrator or not (at least not in my case). The web service can return data based on the username that was supplied to the query. If the user exist in your SharePoint's User Profile, it'll return the information to you. You'll probably need to check there.

    Clayton has a very good and detailed blog post on how to use this webservice to get user's information. See if this helps.

    http://claytoncobb.wordpress.com/2009/06/21/userprofileservice-extended/


    Pman
    http://www.pmansLab.com/
    • Marked as answer by Peng Lei Wednesday, March 16, 2011 9:41 AM
    Thursday, March 10, 2011 1:50 AM

All replies

  • What kind of admin user are you referring to? Are they administrator on a specific computer or a workstation admin or a domain admin?

    Regardless, it doesn't really matter whether the user is an administrator or not (at least not in my case). The web service can return data based on the username that was supplied to the query. If the user exist in your SharePoint's User Profile, it'll return the information to you. You'll probably need to check there.

    Clayton has a very good and detailed blog post on how to use this webservice to get user's information. See if this helps.

    http://claytoncobb.wordpress.com/2009/06/21/userprofileservice-extended/


    Pman
    http://www.pmansLab.com/
    • Marked as answer by Peng Lei Wednesday, March 16, 2011 9:41 AM
    Thursday, March 10, 2011 1:50 AM
  • It's not retrieving a blank message...the query is being denied.  Your non-admins either do not have access to read from that web service, or their accounts do not exist in the profile database.  Notice the errors?  It shows you have access denied, so it's telling you directly.  It also mentions creating a user profile as if there IS no user profile for the user being queried.  Also, in 2007, users must have Read permissions to the Personal Features in your SSP's Personalization Services Permissions settings (also hinted at this in the error).
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Peng Lei Wednesday, March 16, 2011 9:41 AM
    Thursday, March 10, 2011 7:25 AM
  •  All I needed to do is uncheck the "Automatically retrieve data when form is opened" and this took care of the error messages.

    Check the post below

    claytoncobb.com/2009/06/21/userprofileservice-extended

    "Hi Clayton, I have found the cause of that behaviour. When I tried using Itay’s post in which I did not specify value for the S0:AccountName. The form was working perfectly before assuming that it automatically passed current user’s AccountName to the web service. But it suddenly started giving dialogue box that : 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 ights even in the preview mode.

    When I manually provided my standard id as the value of S0:AccountName parameter I was able to make web service connection properly, however I had to uncheck automatically retrieved values when the form is opened because it was giving same kind of dialogue box for access denied. From this behavior I have figured out that, id(value for the account name parameter) that is sent out automatically as a value to parameter web service, does not exist/match in the user profile and because of that it gives that kind of the dialogue box for creating new user profile and access denied. Then I followed approach for passing value to the parameter and now web service doesnt give any dialogue box during preview or opening the form from the document library. But One strange thing that I have noticed is as I tested that sample form by my self, it showed my Name, I asked another user, form also showed his name but when I asked third user form gave dialue box “Some rules can not be executed” by clicking on show 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:
    A user with the account name I361953 could not be found. —> User Not Found: Could not load profile data from the database.” ——- eventhough the user is there in the database.
    when I close this dialogue box and open the form again at that time it doesn’t show me this dialogue box and it works fine and brings the name of the user. Can you provide me little bit insight in this issue if you can, I will appreciate your help.

    Steps I followed to achieve this are very simple
    1. I set the receive connection for the GetUserProfile, and unchecked store data and retrieve automatically(because when I check this option form gives me dialogue box for access denied)
    2. on the open event of the form, I set the parameter for the web service with the function AccountName = UserName() –> then queried the GetUserProfileByName datasource  then setting fields value with fieldname = value[name=FirstName]. As I just want to utilize current user’s name I want only first name.

    One more thing from your post that I noticed is in your steps for getting current user: Why you have not assigned AccountName = userName() directly and did this like
    1. strCurrentUser – Set field’s value to userName()
    2. AccountName – Set fields value to strCurrentUser
    In two steps, is there a specific reason doing this ? I have completed this in one step could that be a reason for that behavior : Some rules can not be executed?

    Thanks,
    Dhaval."

    Friday, August 7, 2015 12:58 PM