问题描述
任务是编写代码,在不下载文件的情况下将敏感度标签应用于 SharePoint Online 文档库中的文档.
The task is to write a code that applies a sensitivity label to a document in a SharePoint Online document library without downloading the file.
到目前为止,我已经探索了以下 API:
I have explored the following APIs so far:
- SharePoint REST API v1:可用于设置保留标签,但不能用于设置敏感度标签.
- Microsoft Graph REST API:在此 API 中找不到用于设置任何标签的任何公共方法.所有与标签相关的属性似乎都是只读的.
- Microsoft 信息保护 (MIP) SDK:敏感度标签可应用于本地文件.流(例如内存流)也被接受为输入/输出,因此可以在内存中应用标签.但它仍然需要从 SharePoint 下载文件.
- SharePoint REST API v1: Can be used to set a Retention label but not a Sensitivity label.
- Microsoft Graph REST API: Can’t find any public methods for setting any labels in this API. All label-related properties seem to be read-only.
- Microsoft Information Protection (MIP) SDK: Sensitivity labels can be applied to a local file. A stream (e.g. memory stream) is also accepted as input/output so it is possible to apply labels in memory. But it still requires downloading the file from SharePoint.
推荐答案
@P-39 Airacobra
@P-39 Airacobra
可以通过PowerShell脚本完成:
Can be done by PowerShell script:
但我正在寻找相同的东西,比如使用无人参与的方式应用设置,比如 REST API,在 Microsoft Graph API BETA 中看到了一些东西:https://github.com/microsoftgraph/powershell-aad-样本/blob/master/ReassignSensitivityLabelToO365Groups.ps1但尚未测试.
But I'm looking for the same, like to apply settings using the unattended way, like REST API, saw something in Microsoft Graph API BETA:https://github.com/microsoftgraph/powershell-aad-samples/blob/master/ReassignSensitivityLabelToO365Groups.ps1But not tested yet.
好像发现了什么,稍后再看:https://docs.microsoft.com/en-us/sharepoint/dev/solution-guide/modern-experience-site-classification
Seems found something, will look later:https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-site-classification
这篇关于如何以编程方式将敏感度标签应用于 SharePoint Online 中的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!