基本上,我们的要求是下载现有的pdf文件(有MIP加密),然后解密PDF文件,修改PDF内容,然后加密回来。我正在使用File。在修改我能够执行的内容之前,我现在要对文件进行加密。在设置标签时(从protection.office.com中启用加密),将错误设置为"TemplateNotFoundException:无法识别的模板ID.“。请建议一下。
var result = Task.Run(async () => await handler.CommitAsync(options.OutputName)).Result;

发布于 2020-08-14 16:38:29
似乎与标签相关的RMS保护模板已被删除或设置为存档。您可以删除并重新创建该标签,或者您必须使用AIP服务cmdlet来调查您的模板是否已被设置为存档或删除。
您可以使用Get-AIPServiceTemplate列出模板。模板的名称应该与您的标签匹配。
如果将模板设置为存档,则使用Set-AIPSerivceTemplate将状态设置为已发布。如果模板不存在,您可以删除标签并重新开始(虽然模板会被删除),或者可以使用PowerShell更新保护设置。
这位医生描述了如何通过PowerShell管理标签。你会做这样的事情:
get-label | where {$_.displayname -eq "TOP SECRET"} | fl displayname,labelactions它的产出:
DisplayName : TOP SECRET
LabelActions : {{"Type":"encrypt","SubType":null,"Settings":[{"Key":"disabled","Value":"false"},{"Key":"protectiontype"
,"Value":"template"},{"Key":"templateid","Value":"0e7fea72-7bba-4438-a070-95c292cd6f8c"},{"Key":"templat
earchived","Value":"True"},{"Key":"linkedtemplateid","Value":"0e7fea72-7bba-4438-a070-95c292cd6f8c"},{"K
ey":"contentexpiredondateindaysornever","Value":"Never"},{"Key":"offlineaccessdays","Value":"-1"},{"Key"
:"rightsdefinitions","Value":"[{\"Identity\":\"miltor.onmicrosoft.com\",\"Rights\":\"VIEW,VIEWRIGHTSDATA
,DOCEDIT,EDIT,PRINT,EXTRACT,REPLY,REPLYALL,FORWARD,OBJMODEL\"},{\"Identity\":\"microsoft.com\",\"Rights\
":\"VIEW,VIEWRIGHTSDATA,OBJMODEL\"},{\"Identity\":\"test@milt0r.com\",\"Rights\":\"PROJECT\"}]"}]}, {"Ty
pe":"applycontentmarking","SubType":"header","Settings":[{"Key":"fontsize","Value":"10"},{"Key":"placeme
nt","Value":"Header"},{"Key":"text","Value":"Property of Contoso"},{"Key":"fontcolor","Value":"#000000"}
,{"Key":"margin","Value":"5"},{"Key":"alignment","Value":"Left"},{"Key":"disabled","Value":"false"}]}, {
"Type":"applycontentmarking","SubType":"footer","Settings":[{"Key":"fontsize","Value":"10"},{"Key":"plac
ement","Value":"Footer"},{"Key":"text","Value":"Property of Contoso"},{"Key":"fontcolor","Value":"#00000
0"},{"Key":"margin","Value":"5"},{"Key":"alignment","Value":"Left"},{"Key":"disabled","Value":"false"}]}
, {"Type":"applywatermarking","SubType":null,"Settings":[{"Key":"fontsize","Value":"10"},{"Key":"layout"
,"Value":"Diagonal"},{"Key":"fontcolor","Value":"#000000"},{"Key":"disabled","Value":"false"},{"Key":"te
xt","Value":"Property of Contoso"}]}}在该JSON中,查找linkedtemplateid:{"Key":"linkedtemplateid","Value":"0e7fea72-7bba-4438-a070-95c292cd6f8c"}
这是RMS中应该存在的模板ID,用于为标签提供保护操作。如果不存在,请使用EncryptionProtectionType创建一个新模板,通过定标更新标签,并提供AIPServiceTemplate和EncryptionRightsDefinitions.
https://stackoverflow.com/questions/63392894
复制相似问题