从Silverlight应用程序检索在Sharepoint当前用户登录 [英] Retrieve current user login in Sharepoint from a Silverlight application
问题描述
是否可以从嵌入式Silverlight 4应用程序检索共享点上使用的当前用户登录?
Is it possible to retrieve the current user login used on sharepoint from an embedded Silverlight 4 application?
推荐答案
在SharePoint 2010中强>
使用客户端对象模型( HTTP: //msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.web.currentuser.aspx ).
Use client object model (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.web.currentuser.aspx).
类似的东西:
public void DoStuff()
{
ClientContext clientContext = ClientContext.Current;
clientContext.Load(clientContext.Web, s => s.CurrentUser);
clientContext.ExecuteQueryAsync((sender, args) => {
var currentUser = clientContext.Web.CurrentUser;
}, null);
}
在SharePoint 2007上
不幸的是,客户端对象模型在SP2007上不存在.我所做之前是这样的:
Unfortunatly, the client object model does not exist on SP2007. What I did before is this:
- 使用jQuery SPServices LIB得到我需要什么(的 http://spservices.codeplex.com/wikipage?title=$().SPServices.SPGetCurrentUser&安培; referringTitle =文档)
- 将它传递给使用SL/JS桥我的Silverlight应用程序
我想有一个WebService你可以直接使用Silverlight的,但我不知道一个在我的头顶.
I guess there is a WebService you can use directly to Silverlight, but I don't know one on the top of my head.
这篇关于从Silverlight应用程序检索在Sharepoint当前用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!