| Author |
Message |
kstriyhon
Guest
|
Posted:
Wed Aug 03, 2005 8:53 am Post subject:
Getting sharepoint logged on user information |
|
|
i need to get the login of the logged on user in sharepoint services how can
i do this?? is there any sharepoint web service i can use to get his data??
any help would be appreciate.
thanks in advance. |
|
| Back to top |
|
 |
Gustavo
Guest
|
Posted:
Wed Aug 03, 2005 8:53 am Post subject:
RE: Getting sharepoint logged on user information |
|
|
Hi,
The "Users and Groups Service" has different methods to find user's
information: "GetUserInfo", "GetUserLoginFromEmail" and a collection of users
that you can find with "GetUserCollection".
Saludes,
Gustavo
http://www.gavd.net/servers/default.aspx |
|
| Back to top |
|
 |
kstriyhon
Guest
|
Posted:
Wed Aug 03, 2005 4:52 pm Post subject:
RE: Getting sharepoint logged on user information |
|
|
hellow gustavo
i had tried the methods of Users and Groups Service but none of them seem to
return what i'm looking for. this methods return all kind of information
about users in sharepoint but none return the login name of the user i'm
logged on in that moment.
the thing is, i need to identify the user login name of the person that is
logged on in sharepoint i need to get this information for a web service i'm
working in.
thank you for your interest in my question.
any help would be appreciate. |
|
| Back to top |
|
 |
Arild Aarnes
Guest
|
Posted:
Wed Aug 03, 2005 8:53 pm Post subject:
Re: Getting sharepoint logged on user information |
|
|
Hi,
You can get the Current User in Sharepoint by using something like:
----
Dim mySite As SPWeb = SPControl.GetContextWeb(Context)
Dim myUser As SPUser = mySite.CurrentUser
Dim strUserName As String = myUser.LogonName
-----
Regards
Arild |
|
| Back to top |
|
 |
Gustavo
Guest
|
Posted:
Wed Aug 03, 2005 8:53 pm Post subject:
RE: Getting sharepoint logged on user information |
|
|
Hi again,
The method "GetUserInfo" give you a return value of the form:
<GetUserInfo xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">
<User ID="4" Sid="S-1-5-21-2127521184-1604012920-1887927527-34577"
Name="User1_Display_Name"
LoginName="DOMAIN\User1_Alias" Email="User1_E-mail"
Notes="Notes" IsSiteAdmin="False" IsDomainGroup="False" />
</GetUserInfo>
Using a xpath you can pull out the loginname without problems. Take a look
at the SDK under "GetUserInfo Method".
Suerte,
Gustavo
http://www.gavd.net/servers/default.aspx |
|
| Back to top |
|
 |
kstriyhon
Guest
|
Posted:
Wed Aug 03, 2005 8:53 pm Post subject:
RE: Getting sharepoint logged on user information |
|
|
hellow gustavo wath you say helped me in fact i allready got all that
information from the "GetUserInfo" web method but the thing is none of
that information tells me if the user is logged on sharepoint and wath i need
is the login of the user allready logged on sharepoint not of all the user in
sharepoint.
hellow Arild Aarnes i tried your code also but i get this error
COMException (0x81070552): The virtual server that is referenced here is not
in the config database.]
Microsoft.SharePoint.Library.SPRequestInternalClass.OpenWebInternal(String
bstrUrl, String& pbstrServerRelativeUrl, UInt32& pnLanguage, UInt32&
pnLocale, String& pbstrAlternateCSSUrl, String& pbstrCustomJSUrl, String&
pbstrAlternateHeaderUrl) +0
Microsoft.SharePoint.Library.a.a(String A_0, String& A_1, UInt32& A_2,
UInt32& A_3, String& A_4, String& A_5, String& A_6)
[SPException: The virtual server that is referenced here is not in the
config database.]
Microsoft.SharePoint.Library.a.a(String A_0, String& A_1, UInt32& A_2,
UInt32& A_3, String& A_4, String& A_5, String& A_6)
Microsoft.SharePoint.SPWeb.f()
Microsoft.SharePoint.SPWeb.get_ServerRelativeUrl()
Microsoft.SharePoint.SPWeb.get_Url()
Microsoft.SharePoint.SPWeb.get_CurrentUser()
ListTest.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\mcms\listtest\webform1.aspx.cs:57
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
any suggestions about both solutions??.
thanks in advance. |
|
| Back to top |
|
 |
Gustavo
Guest
|
Posted:
Wed Aug 03, 2005 8:53 pm Post subject:
RE: Getting sharepoint logged on user information |
|
|
Hi,
I thought you were looking to catch the information using a WebService, but
it is impossible to find what you are asking using this way. You need to take
it from the server directly, using the OM, as Arild suggest.
For the error, maybe the next KB of Microsoft can help:
http://support.microsoft.com/Default.aspx?kbid=827850&FR=1
Another possible solution is to take the reference to the site from the URL
and not from the Context, in the next way (sorry for my VB code, I use C#
only since a long time ago)
Dim site As SPSite = New SPSite("http:/[site]")
Dim thisWeb As SPWeb
thisWeb = site.OpenWeb()
Saludes,
Gustavo
http://www.gavd.net/servers/default.aspx |
|
| Back to top |
|
 |
ndbhatt
Joined: 09 Aug 2007
Posts: 1
|
Posted:
Thu Aug 09, 2007 8:13 pm Post subject:
I'm struggling to get GetUserLoginFromEmail method to work |
|
|
When I try to use the GetUserLoginFromEmail method of the Users and Groups
web service (e.g. http://toplevelsharepointsite/_vti_bin/usergroup.asmx?WSDL)
in web service calls from Infopath and I get the error listed below:
Does anyone else encounter this or have you and is there a way to fix it?
The SOAP response indicates that an error occurred on the server:
Server was unable to process request. --> The root element is missing.
GetUserLoginFromEmail Method Documenation on MSDN:
http://msdn2.microsoft.com/en-gb/library/ms995739.aspx
I am passing XML into the service as requested, e.g. <User
Email='useremail@yourdomain.com'/>, however I have also tried passing
useremail@yourdomain.com and the same error is occuring.
I would appreciate if someone could has an example that would give a walkthrough of GetUserLoginFromEmail method.
Thanks,
Nik |
|
| Back to top |
|
 |
|
|
|
|