Problems with UserProfile service - InfoPath Dev
in

InfoPath Dev

Problems with UserProfile service

Last post 05-08-2008 07:39 PM by desperation. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-07-2008 08:23 PM

    Problems with UserProfile service

    Hi, friends

    I have created infopath browser-enabled forms and uploaded them to sharepoint server, but there is one function not working, that is to get the current user who is using the forms.

    I am using Infopath 07 and MOSS 07

    I implemented it refering to this article from Infopath Team Blog,

    Get the User Profile through MOSS Web Services

    http://blogs.msdn.com/infopath/archive/2007/03/07/get-the-user-profile-through-moss-web-services.aspx

     

    Following is my code, when I test it in console app, it works fine and return my domain id, but when I put it in web service and invoke it, it returns nothing.

     

    [Code]

    public static string CurrentUserName

    {

    get

    /*{

    System.Security.Principal.IPrincipal _User;

    _User = System.Web.HttpContext.Current.User;

    System.Security.Principal.IIdentity _Identity;

    _Identity = _User.Identity;

    string _Value;

    //_Value = _Identity.Name;

    _Value = _Identity.Name.Substring(_Identity.Name.IndexOf(@"\") + 1);

    return _Value;

    }*/

    {

    ProfileService.UserProfileService profileService = new ProfileService.UserProfileService();

    profileService.UseDefaultCredentials = true;

    ProfileService.PropertyData[] userProps = null;

    try

    {

    // Passing null to this method returns the profile of the current user.

    userProps = profileService.GetUserProfileByName(null);

    }

    catch { }

    if (userProps == null || userProps.Length == 0)

    {

    return null;

    }

    string userName;

    userName = userProps[1].Values[0].Value.ToString();

    return userName.Substring(userName.IndexOf(@"\") + 1);

    }

    /*{ return System.Environment.UserName.ToString(); }*/

    }

    [/Code]

     

    Anyone can help with this problem? really struggling to find the solution these days...

  • 05-08-2008 06:28 AM In reply to

    Re: Problems with UserProfile service

    I don't think this method of user identity is supported in browser based froms since the form is being rendered on the server and not the client. Therefore it is not running under the specific user.

    We use the Qdabra Active Directory web service which will identify the form user's somain authenticated login ID as well as the additional information stored in AD such as email, phone, manager, department, etc.

  • 05-08-2008 07:39 PM In reply to

    Re: Problems with UserProfile service

     thx for reply, but I am not using the commented method,

     I try to get user by calling the userprofile service, any problem with that?

     

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.