Get Current Sharepoint User Account from Silverlight Application

Is it possible to get the current user login used in sharepoint from the embedded Silverlight 4 application?

+4
source share
2 answers

In SharePoint 2010

Use the client object model ( http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.web.currentuser.aspx ).

Sort of:

public void DoStuff() { ClientContext clientContext = ClientContext.Current; clientContext.Load(clientContext.Web, s => s.CurrentUser); clientContext.ExecuteQueryAsync((sender, args) => { var currentUser = clientContext.Web.CurrentUser; }, null); } 

In SharePoint 2007

Unfortunately, the client object model does not exist on SP2007. I have done this before:

I assume that there is a WebService that you can use directly in Silverlight, but I do not know one on top of my head.

+4
source

You can use object models as long as you stay in the Silverlight application in your field. If you want to work on a site located in a foreign system. Then the object model will not work. Try using your own Sharepoint web services.

Take a look at the Authentication.asmx authentication method for forms-authenticated sites. You should find it here http: //server/site/_vti_bin/Authentication.asmx (look at this sample site http://www.wssdemo.com/Pages/_vti_bin/Authentication.asmx )

For a Windows authenticated site, you will need to look at NetworkCredentials to get the current user credentials.

0
source

All Articles