使用Azure APP或Access令牌设置OneDrive [英] Provision OneDrive using Azure APP or Access token

查看:53
本文介绍了使用Azure APP或Access令牌设置OneDrive的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sharepoint API中的以下API调用来配置OneDrive, https://msdn.microsoft.com/zh-CN/library/dn790354.aspx#bk_ProfileLoaderCreatePersonalSiteEnqueueBulk ,我尝试使用仅应用程序令牌和用户令牌调用,并且已在我的应用程序中启用了所有权限,甚至使它成为我的应用的公司管理员 我想通过Add-MsolRoleMember -RoleName "Company Administrator" -RoleMemberType ServicePrincipal ...设置用户驱动器的公司,但没有成功,我总是会找回401 Access Denied. API调用工作正常 使用用户名/密码身份验证.知道这个API调用是否完全可以使用令牌吗?

I am using following API call in the sharepoint API to provision the OneDrive, https://msdn.microsoft.com/en-us/library/dn790354.aspx#bk_ProfileLoaderCreatePersonalSiteEnqueueBulk , which I've tried to call using both app-only and user tokens, having enabled all permissions in my app, even made it my app a Company Administrator of the company I wanted to provision user drives through Add-MsolRoleMember -RoleName "Company Administrator" -RoleMemberType ServicePrincipal ..., but without success, I would always get back a 401 Access Denied. The API call works fine with username/password authentication though. Any idea if this API call works with tokens at all?

推荐答案

在使用SharePoint在线OAuth授权时,您需要添加Authorization标头("Authorization":"Bearer" +<访问令牌>)发送OAuth访问令牌 您的REST API请求.

As you’re using SharePoint online OAuth Authorization, you need add Authorization header ("Authorization": "Bearer " + <access token>) to send the OAuth access token in your REST api requests.

您还可以检查以下用于预配用户OneDrive的解决方案.

带有CSOM的PowerShell.

<#
.SYNOPSIS
 This script adds an entry for each user specified in the input file 
 into the OneDrive provisioning queue
 
 
.DESCRIPTION
 This script reads a text file with a line for each user. 
 Provide the User Principal Name of each user on a new line.
 An entry will be made in the OneDrive provisioning queue for each
 user up to 200 users.

.EXAMPLE

 .\BulkEnqueueOneDriveSite.ps1 -SPOAdminUrl https://contoso-admin.sharepoint.com -InputfilePath C:\users.txt 

.PARAMETER SPOAdminUrl
 The URL for the SharePoint Admin center
 https://contoso-admin.sharepoint.com

.PARAMETER InputFilePath
 The path to the input file.
 The file must contain 1 to 200 users
 C:\users.txt

.NOTES
 This script needs to be run by a SharePoint Online Tenant Administrator
 This script will prompt for the username and password of the Tenant Administrator
#>

param
(
    #Must be SharePoint Administrator URL
    [Parameter(Mandatory =


true)] [ValidateNotNullOrEmpty()] [string]
true)] [ValidateNotNullOrEmpty()] [string]


SPOAdminUrl, [Parameter(必填=
SPOAdminUrl, [Parameter(Mandatory =


这篇关于使用Azure APP或Access令牌设置OneDrive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆