User Profiles
Interact with SharePoint user profiles via the User Profile Service:
view profile properties, manage followers, explore social features, and
access OneDrive URLs.
Prerequisites
| Requirement |
Description |
Reference |
| Read access to user profiles |
Required to view profile properties. User context needed for follow/social features. |
SharePoint admin roles |
How the User Profile Service works
graph TD
site["User Profile Service\n(tenant-wide)"]
props["Profile Properties\ndepartment, skills,\nmanager, photo"]
social["Social Features\nfollowing, followers,\ntrending tags"]
onedrive["OneDrive URL\npersonal site link"]
site --> props
site --> social
site --> onedrive
props --> user["User A"]
props --> user2["User B"]
social --> follows["A follows B"]
social --> trending["#tags"]
The User Profile Service is a tenant-level service that stores user
metadata separately from site permissions. It is accessed via
ctx.people_manager for profile properties, social operations, and
profile picture / property updates.
Examples
Profile properties
Social (following)
Quick start
from office365.sharepoint.client_context import ClientContext
ctx = ClientContext("https://contoso.sharepoint.com/sites/team").with_client_certificate(
"contoso.onmicrosoft.com", client_id="client_id", thumbprint="thumbprint", cert_path="./cert.pem"
)
# Get current user's profile properties
props = ctx.people_manager.get_properties_for(ctx.web.current_user).execute_query()
print(f"Display name: {props.display_name}")
print(f"Department: {props.department}")
print(f"Skills: {props.skills}")
# Get trending tags (note: the API takes the context)
tags = ctx.people_manager.get_trending_tags(ctx).execute_query()
for tag in tags.items:
print(f" #{tag.name} ({tag.count})")
API reference