SmarterMail Pro™ Administration Web Services

svcUserAdmin.GetUserStats Method 

Returns user account statistics for the specified time period.

public StatInfoResult GetUserStats(
   string AuthUserName,
   string AuthPassword,
   string EmailAddress,
   DateTime Start,
   DateTime End
);

Parameters

AuthUserName
User name with domain administrative privileges
AuthPassword
Password for AuthUserName
EmailAddress
Account to get statistics for
Start
Start of date range
End
End of date range

Return Value

A StatInfoResult instance containing the results of the GetUserStats action.

Example

In this sample, the number of message sent and received, in the last 7 days, for each user in the domain is returned.

using System;
using svcUserAdmin;

class svcUserAdminGetUserStats
{
 static void Main()
 {
   string usr = "admin@domain.net";
   string pss = "alskdjfhtt";
   string dom = "domain.net";
   DateTime e = DateTime.Today;
   DateTime s = e.Subtract(new TimeSpan(TimeSpan.TicksPerDay * 7));
   StatInfoResult stats;

   svcUserAdmin admin = new svcUserAdmin();
   UserInfoListResult domain = admin.GetUsers(usr, pss, dom);
  
   if(domain.Result)
   {
     foreach(UserInfo user in domain.Users)
     {
       stats = admin.GetUserStats(usr, pss, user.UserName, s, e);

       Console.WriteLine("Account Name: {0}\r\nDate Range: {1:d} - {2:d}\r\nSent: {3} Messages\r\nReceived: {4} Messages\r\n",
                         user.UserName,
                         s,
                         e,
                         stats.MessagesSent,
                         stats.MessagesReceived);
     }
   }else{
     Console.WriteLine (domain.Message);
   }
 }
}

See Also

svcUserAdmin Class | svcUserAdmin Namespace