【发布时间】:2020-02-13 20:26:23
【问题描述】:
我使用 Razor 页面方法通过 ASP.NET Core 构建了一个应用程序,但现在我需要从共享点页面的用户配置文件中获取数据。实际上,我需要访问它们的所有属性。
有没有办法做到这一点?还是必须将该数据发送到应用程序的共享点页面?
【问题讨论】:
标签: c# asp.net-core web sharepoint razor-pages
我使用 Razor 页面方法通过 ASP.NET Core 构建了一个应用程序,但现在我需要从共享点页面的用户配置文件中获取数据。实际上,我需要访问它们的所有属性。
有没有办法做到这一点?还是必须将该数据发送到应用程序的共享点页面?
【问题讨论】:
标签: c# asp.net-core web sharepoint razor-pages
1) 获取当前用户的所有属性:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties
2) 获取当前用户的单个属性:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties/PictureUrl
或
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl
3) 获取当前用户的多个属性:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl,AccountName
4) 获取特定用户的所有属性:
对于 Office 365/SharePoint Online:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'
对于 SharePoint 2013 本地:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\username'
5) 获取特定用户的特定 UserProfile 属性:
对于 Office 365/SharePoint Online:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'
对于 SharePoint 2013 本地:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='domain\username'
【讨论】: