簡體   English   中英

計算未讀電子郵件,以換取每個用戶

[英]Count the unread emails in exchange for each user

我想計算與C#交換的未讀電子郵件,所有這些郵件都已交換,並獲得所有用戶和相應的電子郵件。

對於連接我有..

    RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
                PSSnapInException snapInException = null;
                PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapInException);
                Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig);
                myRunSpace.Open();

                Pipeline pipeline = myRunSpace.CreatePipeline();
                Command myCommand = new Command("Get-Mailbox");

                pipeline.Commands.Add(myCommand);

                Collection<PSObject> commandResults = pipeline.Invoke();

                // Ok, now we've got a bunch of mailboxes, cycle through them
                foreach (PSObject mailbox in commandResults)
                {
                    //define which properties to get
                    foreach (String propName in new string[] { "Name", "EmailAddresses", "Database", "OrganizationalUnit", "UserPrincipalName" })
                    {
                        //grab the specified property of this mailbox
                        Object objValue = mailbox.Properties[propName].Value;
.......

您想要的命令是Get-MailboxStatistics 您可以獲取Inbox_Number_Unread返回的對象。

Glen Scales發布了此博客文章,內容涉及通過PowerShell提取類似信息。 它應該為您指明正確的方向。 它具有完整的腳本,可從所有郵箱中收集有用的屬性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM