有人知道为什么在Exchange 2010 SP1中无法识别此命令:
Search-Mailbox -Identity "April Stewart" -SearchQuery 'Subject:"Your bank statement"' -DeleteContent
Run Code Online (Sandbox Code Playgroud) 我们使用EWS托管API将我们的CRM与Exchange-Server同步.只要我使用EWS Mangage API 1.1,一切都很完美.现在我更新到Api 2.0(Dll-version:15.0.516.14)并且如果我从不同的线程绑定到同一个文件夹并且不明白原因,我会收到ArgumentException.
这是一个引发异常的示例代码:
private void TestAsyncFolderGet()
{
try
{
ExchangeService service = this.GetService();
Parallel.For(0, 20, (i) =>
{
Folder fo = Folder.Bind(service, WellKnownFolderName.Inbox);
});
}
catch (Exception ex)
{
this.State = "Failed: " + ex.Message;
}
}
private ExchangeService GetService()
{
ExchangeService result = new ExchangeService(ExchangeVersion.Exchange2010);
result.AutodiscoverUrl("test@foo.com");
return result;
}
Run Code Online (Sandbox Code Playgroud)
我的真实场景是我使用pullsubscription更改项目并处理更改异步.在这样做时,我绑定到父文件夹以获取一些信息.
任何人都可以帮我避免异常吗?
Stacktrace和异常信息:
System.ArgumentException:已添加具有相同键的项.
在System.Collections.Generic.Dictionary 2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Exchange.WebServices.Data.ExchangeServiceBase.SaveHttpResponseHeaders(WebHeaderCollection headers)
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.ReadResponse(IEwsHttpWebResponse response)
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalFindFolders(IEnumerable1 parentFolderIds,SearchFilter searchFilter,FolderView视图,ServiceErrorHandling errorHandlingMode)在Microsoft.Exchange.WebServices.Data.ExchangeService.FindFolders(FolderId parentFolderId,FolderView视图)
我有以下 LogParser 2.2 查询,它将从 Exchange 2010 集线器传输的 SMTP 日志中查找所有 SMTP 错误,并将其输出到 SQL Server 2008 R2 数据库。这工作正常,但我想添加错误起源的日志文件的名称作为字段名称(这将使跟踪有关错误的更多详细信息变得更加容易)。有没有办法将日志文件名包含在字段列表中?
"C:\Program Files (x86)\Log Parser 2.2\logparser.exe"
"SELECT
'Prospect' as ExchangeServer,
'Receive' as SmtpType,
TO_LOCALTIME(TO_TIMESTAMP(STRCAT(STRCAT(EXTRACT_PREFIX(TO_STRING([#Fields: date-time]),0,'T'),' '),EXTRACT_PREFIX(EXTRACT_SUFFIX(TO_STRING([#Fields: date-time]),0,'T'),0,'.')),'yyyy-MM-dd HH:mm:ss')) as Timestamp,
connector-id as Connector,
EXTRACT_PREFIX(local-endpoint,0,':') as ServerIP,
TO_INT(EXTRACT_SUFFIX(local-endpoint,0,':')) as ServerPort,
REVERSEDNS(EXTRACT_PREFIX(local-endpoint,0,':')) as ServerName,
EXTRACT_PREFIX(remote-endpoint,0,':') as ClientIP,
TO_INT(EXTRACT_SUFFIX(remote-endpoint,0,':')) as ClientPort,
REVERSEDNS(EXTRACT_PREFIX(remote-endpoint,0,':')) as ClientName,
TO_INT(EXTRACT_PREFIX(data,0,' ')) as Error, event as Event, data as Data,
context as Context
INTO SmtpLog
FROM 'E:\Log Files\SMTP\Receive\*.LOG'
WHERE (event = '>') and ((data …Run Code Online (Sandbox Code Playgroud) Exchange管理要求您传递$ null作为参数以从邮箱中删除转发:
Set-Mailbox -ForwardingAddress $ null -DeliverToMailboxAndForward $ false
这(恕我直言)转换为:
command = new PSCommand().AddCommand("Set-Mailbox");
command.AddParameter("Identity",task.TargetUser);
command.AddParameter("FowardingAddress", null);
command.AddParameter("DeliverToMailboxAndForward", false);
ps.Commands=command;
var results = ps.Invoke();
Run Code Online (Sandbox Code Playgroud)
不幸的是,"ForwardingAddress"设置上的Invoke chokes:找不到与参数名称'FowardingAddress'匹配的参数.
如何传递最终为$ null的参数?
在Exchange Server上创建或修改元素时,我会获得具有唯一ID的StreamingNotification以及有关该联系人/日历的其他信息,但是如何获取有关已删除项目的信息?
我从哪里获得身份证?或者至少是第一个电子邮件地址或主题?
我正在使用EWS托管API,这是我的代码:
StreamingSubscription subscription =
ser.SubscribeToStreamingNotifications(
new FolderId[] { WellKnownFolderName.Contacts,
WellKnownFolderName.Calendar },
EventType.Created,
EventType.Modified,
EventType.Deleted
);
Run Code Online (Sandbox Code Playgroud) Per Technet -使用PowerShell控制台添加或删除邮箱的电子邮件地址,以下成功删除邮箱中的电子邮件别名:
Set-Mailbox "GenMgr" -EmailAddresses @{remove="GenMgr@domain.com"}
Run Code Online (Sandbox Code Playgroud)
但是,通过远程运行空间调用下面的PSCommand对象会引发System.Management.Automation.RemoteException错误.
command.AddCommand("Set-Mailbox");
command.AddParameter("Identity", "GenMgr");
command.AddParameter("EmailAddresses", "@{remove='GenMgr@domain.com'}");
powershell.Commands = command;
powershell.Invoke();
Run Code Online (Sandbox Code Playgroud)
System.Management.Automation.RemoteException:无法处理参数'EmailAddresses'上的参数转换.无法将值"@ {remove='GenMgr@domain.com'}"转换为"Microsoft.Exchange.Data.ProxyAddressCollection".错误:"地址'@ {remove='GenMgr@domain.com'}'无效:"@ {remove='GenMgr@domain.com'}"不是有效的SMTP地址.域名不能包含空格,它必须有前缀和后缀,例如example.com."
在我看来,问题在于EmailAddresses参数中的'remove'指令.
如何在Windows 8上使用C#和PowerShell远程运行空间来使Exchange 2010删除电子邮件别名?
我有邮箱中文件夹的 folderId 属性。如何使用 EWS 找到文件夹的完整路径?
exchange-server exchangewebservices ews-managed-api exchange-server-2010
我有一个与交换同步并获取给定 itemids 的电子邮件消息对象的代码:
List<EmailMessage> emails = new List<EmailMessage>();
ServiceResponseCollection<GetItemResponse> response =
MyExchangeService.BindToItems(MyItemIds, PropertySet);
foreach (GetItemResponse getItemResponse in response)
{
if (getItemResponse.Item != null)
{
emails.Add((EmailMessage)getItemResponse.Item);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,emailmessage我得到的对象包含该DateTimeReceived属性,而9/15/2017 5:27:16 AM我希望它也包含时间的毫秒部分。是否可以?