0

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>
0

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

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.