如何通过使用jQuery在SharePoint列表中插入当前用户详细信息 [英] how to insert current user details in SharePoint List by using jquery

查看:113
本文介绍了如何通过使用jQuery在SharePoint列表中插入当前用户详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了问题,我有共享点列表(我的用户),该列表中有4列,分别是:

1.用户名

2.用户邮件ID

3.登录日期和时间

4.注销日期和时间

当某人登录我的网站时,该用户详细信息(上述字段是什么)应该自动插入到我的SharePoint列表中.

我尝试了不同的代码但它不起作用.

请帮助我如何解决

解决方案

要获取用户名和电子邮件,您可以为此调用REST api,例如:

/_ api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName = @ v)? @ v ='contoso \ lee'

这里有一个线程通过ajax调用SharePoint REST api供您参考.

https://social.technet.microsoft.com/wiki/contents/articles/31995.sharepoint-2013-working- with-rest-api-using-jquery-ajax.aspx

对于登录日期",您需要为此创建自定义http模块,创建类并从IHttpModule实现.  

对于注销日期,没有直接的方法.

这里有一个线程供您参考.

https://social.technet.microsoft.com /Forums/zh-CN/12a61735-c50c-4f7b-9c7e-8f02d061e516/如何获取共享用户的登录和注销时间

最好的问候,


I have issue, i have sharepoint list(My Users) , in that list has 4 columns that column are:

1. User name 

2. User Mail ID 

3. Login Date and Time

4. Logout date and time

When someone login in my site, that user details should be (what are the above mentioned fields) insert in to my SharePoint list automatically. 

i have tried the different codes but it is not working.

please help me how to solve this problem.

解决方案

Hi,

For getting user name and email, you could call REST api for this, for example:

/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='contoso\lee'

Here is one thread for calling SharePoint REST api by ajax for your reference.

https://social.technet.microsoft.com/wiki/contents/articles/31995.sharepoint-2013-working-with-rest-api-using-jquery-ajax.aspx

For Login Date, you need create custom http module for that, create your class and implement from : IHttpModule.  

http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-and-http-module/

For Logout date, there is no direct way for that.

Here is one thread for your reference.

https://social.technet.microsoft.com/Forums/en-US/12a61735-c50c-4f7b-9c7e-8f02d061e516/how-to-get-the-login-and-logout-time-of-sharepoint-user

Best Regards,

Lee


这篇关于如何通过使用jQuery在SharePoint列表中插入当前用户详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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