使用MIP SDK如何使用自定义权限进行保护

问题描述

我正在尝试使用C#MIP SDK在PDF文件上应用“具有自定义权限的保护”。我在MIP SDK中找不到启用文件自定义权限的选项。 MIP SDK中是否有任何选项可用于应用自定义权限。多谢您的协助。谢谢。

enter image description here

解决方法

不确定您是否找到了解决方案,但要创建自己的权限,您必须创建自己的保护设置。这是我所做的

public ProtectionDescriptor CreateAdhocDescriptor()
{

    List<UserRights> userRights = new List<UserRights>();

    List<string> viewRights = new List<string>()
    {
        Microsoft.InformationProtection.Protection.Rights.View
    };

    userRights.Add(new UserRights(userEmails,viewRights));

    List<string> printRights = new List<string>()
    {
        Microsoft.InformationProtection.Protection.Rights.Print,Microsoft.InformationProtection.Protection.Rights.Comment
    };

    userRights.Add(new UserRights(userEmails,printRights));

    ProtectionDescriptor protectionDescriptor = new ProtectionDescriptor(userRights)
    {
        ContentValidUntil = accessExpiration,AllowOfflineAccess = false
    };


    return protectionDescriptor;
}

ProtectionSettings settings = new ProtectionSettings();
handler.SetProtection(helper.CreateAdhocDescriptor(),settings);

这里,handler 是 fileEngine.CreateFileHandlerAsync 的结果。这不会显示在您的屏幕截图所在的程序中,但它允许在您保护文件时对文件应用一组自定义权限。