尝试使用用户配置文件REST API

时间:2017-05-05 08:37:47

标签: rest sharepoint workflow sharepoint-designer sharepoint-online

我正在为我的SharePoint Online网站创建一个SP设计器工作流,以获取管理员的名称,位置,部门等用户属性。我在调用HTTP Web服务'动作

https:/siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Manager')?@v=%27i:0%23.f|membership|userid%27 .

我是网站集管理员,但我仍然收到错误 -

"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}"

我已经对工作流应用程序进行了完全控制。但是当我在浏览器中访问上面的REST URL时,我可以看到任何用户的所有属性。

请告诉我我在哪里犯错误。

2 个答案:

答案 0 :(得分:2)

工作流必须具有tenant-level permissions(In your case-Read)才能访问用户个人资料服务,而不是在网站集中拥有完全控制权

授予权限时,请确保使用以下XML:

<AppPermissionRequests>
    <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="Read" />
</AppPermissionRequests>

以下是有用的链接

答案 1 :(得分:-1)

我使用SP designer 2013中提供的SP 2010工作流模板创建了一个工作流程。在此模板中,我可以直接查询用户配置文件并从用户配置文件中获取所需的属性。 参考 - http://www.c-sharpcorner.com/UploadFile/anavijai/how-to-start-a-sharepoint-2010-workflow-within-a-sharepoint/

使用此选项不需要在租户级别进行任何访问。

干杯

相关问题