Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there a way to get the currently logged user’s colleague list using ECMA client script?

Used the below script to pull the currently logged user name:

                <script type="text/javascript">
                    ExecuteOrDelayUntilScriptLoaded(getWebUserData, "sp.js");  
                    var context = null;
                    var web = null;
                    var currentUser = null;
                        function getWebUserData() {
                            context = new SP.ClientContext.get_current();
                            web = context.get_web();
                            currentUser = web.get_currentUser();
                            currentUser.retrieve();
                            context.load(web);
                            context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
                        }
                        function onSuccessMethod(sender, args) {
                            var userObject = web.get_currentUser();
                            alert('User name:' + userObject.get_title() + '\n Login Name:' + userObject.get_loginName());
                        }
                        function onFailureMethod(sender, args) {
                            alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
                        }
                        //getWebUserData();
                </script>
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I don't think it is possible with ECMA as it allows only a limited functionalities, HttpHandler would a solution.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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