【问题标题】:How to get user profiles from sharepoint into asp .net core app?如何将用户配置文件从共享点获取到 asp .net 核心应用程序?
【发布时间】:2020-02-13 20:26:23
【问题描述】:

我使用 Razor 页面方法通过 ASP.NET Core 构建了一个应用程序,但现在我需要从共享点页面的用户配置文件中获取数据。实际上,我需要访问它们的所有属性。

有没有办法做到这一点?还是必须将该数据发送到应用程序的共享点页面?

【问题讨论】:

    标签: c# asp.net-core web sharepoint razor-pages


    【解决方案1】:

    使用webApi SharePoint

    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'
    

    【讨论】:

      猜你喜欢
      • 2020-04-25
      • 2018-03-30
      • 1970-01-01
      • 2018-11-24
      • 2021-10-13
      • 2018-04-16
      • 1970-01-01
      • 2019-08-13
      • 1970-01-01
      相关资源
      最近更新 更多