1

I am trying to connect a AD to a SharePoint 2013 list form so that the SharePoint form is filled in automatically with data from the Active Directory (i.e. contact information). Is this possible?

I have currently found the partial solutions below, but do not know how to apply them. Please advise.

one:

$().SPServices({
operation: "GetUserInfo",
async: false,
userLoginName: $().SPServices.SPGetCurrentUser(),
completefunc: function (xData, Status) {
    $(xData.responseXML).find("User").each(function() {
        curUserId = $(this).attr("ID");
        curUserName = $(this).attr("Name");
        curFullUserName = $(this).attr("ID")+";#"+$(this).attr("Name");
    });
}
});

This little function will create three vars:

curUserId = the current users ID (Ex: 1)
curUserName = the current users Name (Ex: DOMAIN\user)
curFullUserName = the ID and Name combined in SP format (Ex: 1;#DOMAIN\user)

Two:

$().SPServices({
operation: "GetUserColleagues", 
AccountName: $().SPServices.SPGetCurrentUser({fieldName: "Name"}), 
completefunc:function(data,status) {
    //process GetUserColleaguesResult... 
}
});

How would I use either of the solutions, if i need to get the title(name), Product, and review group to be automaticly filled in when creating a new item form in the a list? Could someone please help me with the code.

$().SPServices({
operation: "GetUserInfo",
async: false,
userLoginName: $().SPServices.SPGetCurrentUser(),
completefunc: function (xData, Status) {
    $(xData.responseXML).find("User").each(function() {
        curUserId = $(this).attr("ID");
        curUserName = $(this).attr("Name");
        curFullUserName = $(this).attr("ID")+";#"+$(this).attr("Name");
    });
}
});

How would I use the other information from the AD? i.e product, and then how would i connect the requester name (maybe via username?)?

  • Depending on which parts you want to pull out, it's entirely possible. I've seen it done, but don't know exactly how to do it myself. – Pᴀᴜʟsᴛᴇʀ2 Nov 21 '15 at 2:13
  • 1
    That would depend entirely on the conventions in place. You can use SOAP Requests to get data from the user profile service, which is generally populated from Active Directory. – Clinton Person Nov 21 '15 at 3:51
  • How would i do this using SOAP? – joe 222 Nov 22 '15 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.