Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

How to pull up user properties in sharepoint 2013 in VB

$
0
0

I am new to SharePoint 2013 programming.  I am trying to create a web part in SP 2013 where when the web part loads it will get the current user who is viewing the page and then display the properties i want for that user in the web part.  Here is the code I have been trying to work with, but it keeps failing with a 401 Unauthorized when loading and checking the permissions they do show valid.  Any ideas?

Dim siteURL As String = "http://server"

'  String Variable to store the account name
                Dim accountName As String = SPContext.Current.Web.CurrentUser.Name


                '  To get the context of the Sharepoint site to access the data
                Dim clientContext As ClientContext = New ClientContext(siteURL)

                Dim peopleManager As PeopleManager = New PeopleManager(clientContext)

                Dim personProperties As PersonProperties = peopleManager.GetPropertiesFor(accountName)
                'clientContext.Load(personProperties, Function(w) w.DisplayName)
                'clientContext.ExecuteQuery()

                lblCompany2.Text = personProperties.DisplayName


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>