0

I have a scenario. I installed a new SharePoint Server 2016. It is in AD. I created a toplevel site. Since my organisation has many users i cannot add them individually. So there are couple of questions now to ask 1.) Since my server is in AD and the user who logged into his PC, can he access sharepoint site even though i did not add him in any group 2.) Is there any way when the user type the url example : http://companyintranet then check whether the user is available if not add him to a default group and let him access the site. If possible how to do it.

0

From your description, now your requirement is that user can log on to the site directly without credentials and also the site must show the user properties like name,email.

To log on to the site directly without credentials, set ‘Automatic logon with current user name and password in Local intranet zone and Trusted sites of IE.

Navigate to IE->Internet options->Security tab->Local intranet and Trusted sites->Custom level->choose automatic logon with current user name and password: enter image description here

To show the user properties like name,email, We can get user info from User Information List using JSOM,add content edit web part in home page, add the following code into a content editor web part.

<script type="text/ecmascript">
ExecuteOrDelayUntilScriptLoaded(getUserProfile, "sp.js");
function getUserProfile(){
    var userID= _spPageContextInfo.userId;
    var clientContext = new SP.ClientContext.get_current();
    var web = clientContext.get_web();
    var userInfoList = web.get_siteUserInfoList();
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='ID'/><Value Type='Number'>" + userID + "</Value></Eq></Where></Query><RowLimit>1</RowLimit></View>");
    this.collListItem = userInfoList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded(sender, args){
    var item = collListItem.itemAt(0);   
    var userName =  item.get_fieldValues().UserName;
    var displayName= item.get_fieldValues().Title;
    var email= item.get_fieldValues().EMail;
    var html="";
    if(userName!=null){
        html+="<img src='/_layouts/15/userphoto.aspx?size=S&username=" + userName + "'/>";      
    }
    if(displayName!=null){
        html+="<p><span>Name:"+ displayName+"</span></p>";      
    } 
    if(email!=null){
        html+="<p><span>Email: "+ email+"</span></p>";       
    }   
    var profileDiv = document.getElementById("CurrentUserProfile");
    profileDiv.innerHTML = html;     
}
function onQueryFailed(sender, args) {
    //alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
<div id="CurrentUserProfile">   
<div>

enter image description here

1

If you want Everyone to have access to all sites, you can adjust permissions for the Web Application in Central Admin to allow "Everyone" read access.

If you want them to have access to the site you created, but want different rules for different sites/webs that are created in the future, in site permissions add "Everyone" with the level of access you want them to have.

The connection to AD means that all users have the ability to log in without creating a user in SharePoint, but individual permissions are managed within SharePoint. If you have created the UserProfileService, it will create full profiles for the users, whether they have site level permissions or not.

0

Do you have an 'all users' group (or similar) in AD to which all users get automatically added when they are created? If so, I'd use that group and assign minimum required permissions to the site collection.

You could also add 'NT AUTHORITY\Authenticated Users' as an AD group with the appropriate permission level to the root site collection of SharePoint to provide all users who can authenticate to your domain with access to SharePoint. Or you could also use the 'Everyone' group for this purpose.

Note that you need to do this for all content site collections created to which you want users to have access.

  • Dear Andy,Thanks for your response. Now my only requirement is when the employee log in to his pc where he is now under the company domain and he types let us say mycompanyintranet then the browser must not ask any credentials and the sharepoint intranet site must open and also the site must show the user properties like name,email e.t.c. Can i acheive that – balagangadhar T Feb 28 '18 at 8:36
  • As Lisa said in her response, using the intranet zone settings will allow users to auto login using IE. Note that you can achieve the same with Chrome and Firefox as well. I'd add the AuthForwardServerList registry settings to machines as well (see support.microsoft.com/en-us/help/943280/… for details) which allows Office client software to also automatically provide the current user's credentials to SharePoint when they open a document as well. – Andy Dawson Feb 28 '18 at 10:52
  • Thanks guys. For now atleast i can tell my network team to update the group policy to include the site in local intranet zone. But Lisa one more thin gi wanted to confirm is if you are able to access the site after doing the changes Sharepoint does automatically show the user logged in on top right hand side . But if i want to exclusively get the user data then i will use your code – balagangadhar T Mar 1 '18 at 10:32

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.