Outlook对象模型

时间:2019-01-01 18:46:16

标签: powershell outlook com

我正在编写PowerShell脚本以共享日历。 该脚本可以工作,但问题是我无法编辑权限,默认值为“仅可用”。我想提供“详细信息”。

P.S。 -无法使用本机Exchange cmdlet。

Add-Type -Assembly "Microsoft.Office.Interop.Outlook"
$Outlook = New-Object -ComObject Outlook.Application
$namespace = $Outlook.GetNameSpace("MAPI")

$Calendar = $Outlook.Session.Session.Folders.Item(1)
$Calendar = $Calendar.Folders.Item("Calendar")

$CalendarShare = $namespace.CreateSharingItem($Calendar)
$CalendarShare.To = "somemail@mail.com"
$CalendarShare.Send()

1 个答案:

答案 0 :(得分:1)

为什么要使用Outlook,VS使用本机Exchange cmdlet设置ACL来执行此操作?

您只需授予Reviewer的日历权限角色,这与尝试设置“详细信息”日历权限时提供的功能相同。

例如。

Add-MailboxFolderPermission for every Mailbox

Set-CalendarPermissions#当然,这是库中的脚本,但它使用的是Exchange cmdlet。

它真的在做这样的事情...

# Review permissions
Get-MailboxFolderPermission -identity 'username:\Calendar'

# Set permissions
Add-MailboxFolderPermission -identity 'username:\Calendar' -user 'personalassistant' -AccessRights Reviewer