Use JS to read user profile properties from the Add-in program in SharePoint 2013

Source: Internet
Author: User

After countless experiments, only this program can run normal, code paste out of pure jsom, in my experimental environment always return unknown error, for this simple task, I have been engaged for 2 days, but finally made out, using various methods, there is also the use of code.

functiongetuserinformation (loginname,propertyname) {$.ajax ({Url:appweburl+ "/_api/sp.userprofiles.peoplemanager" + "/getuserprofilepropertyfor ([email protected],propertyname= '" +proper Tyname+ "')", type:"GET", Data:"@v=" + encodeuricomponent (Logintype + loginName) + "'", headers: {"Accept": "Application/json;odata=verbose"}, Success:function(Result) {D=eval (result); $("#ecPhone"). Val (d.d.getuserprofilepropertyfor); }, Error:function(Error) {alert ("Error" +error.responsetext); }});}

In my environment, var logintype = "i:0#.w| Ad\\ ";

is actually the identity of the declaration string, the last D.d.getuserprofilepropertyfor, is the return value, I do not know why to write this.

Use JS to read user profile properties from the Add-in program in SharePoint 2013

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.