僅應用上下文中的SharePoint Online批量更新用戶配置文件屬性


0

我正在編寫一個應用程序(計劃作業)以使用SharePoint Online user profile bulk update API批量更新SharePoint Online自定義用戶配置文件屬性。

我嘗試在連接到SharePoint Online並使用上述API時使用"僅應用程序"權限。根據本文看來,這是可能的(請參閱本文中的常見問題解答中的第一個問題),但是無論我授予客戶ID何種權限,我都會遇到"訪問被拒絕"的問題,因此在實現它方面面臨挑戰。

$workItemId = $o365.QueueImportProfileProperties($userIdType, $userLookupKey, $propertyMap, $importFileUrl);

有人可以指向我指向同一代碼/文章,該代碼/文章僅在應用程序上下文中使用上述API,並且我必須在Azure AD和SharePoint上分配哪些權限。

0

I was able to access this api using app only context. Turns out client id requires access to social api. Navigate to sharepoint online admin center and then navigate to app permission page (/_layouts/15/appinv.aspx). Lookup the client id and then use below permission xml to grant access.

<AppPermissionRequests AllowAppOnlyPolicy="true" > 

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

        <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="FullControl" /> 

    </AppPermissionRequests> 

This grants the app principal full control on the tenant and social api. The social api is important, without which bulk import api returns access denied.