如何使用Javascript/Jquery/REST将登录用户详细信息绑定到Sharepoint列表 [英] How to bind Login user details to Sharepoint List using Javascript/ Jquery/REST

查看:78
本文介绍了如何使用Javascript/Jquery/REST将登录用户详细信息绑定到Sharepoint列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我需要将登录用户详细信息设置为sharepoint newform.aspx页面字段.当用户登录到站点并将项目添加到共享点列表时,然后自动将登录用户"详细信息填充到字段中.

i need to set the login user details to sharepoint newform.aspx page fields. When user login to site and add items to sharepoint list, then automatically populate Login user details to fields.  

推荐答案

Hi

尝试以下提及的代码满足您的要求,并检查是否有帮助.

Try below mentioned code for you requirement and check whether it helps.

ExecuteOrDelayUntilScriptLoaded(loadUser, "SP.js"); function loadUser() { var clientContext = SP.ClientContext.get_current(); userSPObj = clientContext.get_web().get_currentUser(); clientContext.load(userSPObj); clientContext.executeQueryAsync(onUserSucceeded, onUserFailed); } function onUserSucceeded(sender, args) { userSP = userSPObj.get_title(); userIDSP = userSPObj.get_loginName();

alert(userSP + userIDSP);

alert(userSP + userIDSP);

//将所需的值绑定到字段. } 函数onUserFailed(sender,args){alert(args.get_message()+'\ n'+ args.get_stackTrace())}

//bind value you needed to the fields. } function onUserFailed(sender, args) { alert(args.get_message() + '\n' + args.get_stackTrace()) }

在document.ready函数中调用LoadUser函数

Call LoadUser function in document.ready function

此致

Gaurav

如果有帮助,则标记为答案...


这篇关于如何使用Javascript/Jquery/REST将登录用户详细信息绑定到Sharepoint列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆