我想列出每個Outlook文件夾的權限。我可以添加權限,但是我的代碼會刪除所有舊權限並設置新權限。EWS文件夾權限
這是我的代碼添加權限:
private void updateFolderPermission(Folder folder, String mail, int per)
{
UserId delegateUser = new UserId(mail);
FolderPermission permission = new FolderPermission(delegateUser, FolderPermissionLevel.None);
switch (per)
{
case 0:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.Owner);
break;
}
case 1:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.PublishingEditor);
break;
}
case 2:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.Editor);
break;
}
case 3:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.PublishingAuthor);
break;
}
case 4:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.Author);
break;
}
case 5:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.NoneditingAuthor);
break;
}
case 6:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.Reviewer);
break;
}
case 7:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.Contributor);
break;
}
case 8:
{
permission = new FolderPermission(delegateUser, FolderPermissionLevel.None);
break;
}
}
folder.Permissions.Add(permission);
folder.Update();
}
我已經調試代碼,但功能_permissions_
顯示我_count = 0_
。
我的問題是現在: - 如何添加權限到現有的PermissionSet - 如何可以列出此文件夾的所有權限
沒有人有想法嗎? – TuVi
這裏是如何獲得一個文件夾的權限: '屬性集propset命令=新的屬性集(BasePropertySet.IdOnly,FolderSchema.DisplayName,FolderSchema.EffectiveRights);'' 文件夾calfld = Folder.Bind(服務,WellKnownFolderName.Calendar,propset命令);' 'Console.WriteLine(「+ calfld.DisplayName +」文件夾的有效權利是「+ calfld.EffectiveRights);' –
對不起,我看到你問的是燙髮而不是權利。我會看看我能否弄清楚。 –