powershell - 如何使用 powershell 将成员添加到分发列表?
问题描述
我尝试使用 powershell 将用户添加到分发列表,但我没有找到正确的命令。
$outlook = new-object -com Outlook.Application
$list= $outlook.Session.GetGlobalAddressList().AddressEntries.Item("TEST Liste")
$idnew = $outlook.Session.GetGlobalAddressList().AddressEntries.Item("Max Mustermann")
我得到了帮助
$list.Members.Add(
Add
AddressEntry Add (string, Variant, Variant)
并发现它应该是(字符串类型、对象名称、对象地址)(https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.outlook.addressentries.add?view= Outlook-pia#Microsoft_Office_Interop_Outlook_AddressEntries_Add_System_String_System_Object_System_Object_)
但我有一个错误
$list.Members.Add($idnew.Type, $idnew.Name, $idnew.Address)
Die Textmarke ist ungültig.
In Zeile:1 Zeichen:1
+ $list.Members.Add($idnew.Type, $idnew.Name, $idnew.Address)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
那么,有人可以帮助我吗?这是错误的方式吗?
解决方案
推荐阅读
- javascript - 如何将 xlink:href 绘制到画布上
- c++ - 使用 C++ 在 windows 下获取硬盘驱动器性能
- javascript - 如何在反应中使用json文件进行分页?
- java - 无法获取使用 selenium xpath 动态显示的双引号中的值
- wpf - Checkbox Command/IsChecked 执行顺序
- angular - Angular apollo - 执行查询突变更新后 UI 不更新
- c# - 枚举数据类型转换为字符串
- python - 如何从 unix 时间中获取正确的日期时间值?
- java - 使用多个命名空间解析 Youtube XML 响应
- ruby-on-rails - 仅当用户是当前用户的联系人时才显示用户的个人资料