Ejemplo n.º 1
0
        public static string[] GetPolicyList(int itemId, LyncPolicyType type, string name)
        {
            string[] ret = null;
            try
            {
                if (itemId == -1)
                {
                    // policy list in all lync servers
                    List <string>     allpolicylist = new List <string>();
                    List <ServerInfo> servers       = ServerController.GetAllServers();
                    foreach (ServerInfo server in servers)
                    {
                        List <ServiceInfo> services = ServerController.GetServicesByServerIdGroupName(server.ServerId, ResourceGroups.Lync);
                        foreach (ServiceInfo service in services)
                        {
                            LyncServer lync   = GetLyncServer(service.ServiceId, -1);
                            string[]   values = lync.GetPolicyList(type, name);
                            foreach (string val in values)
                            {
                                if (allpolicylist.IndexOf(val) == -1)
                                {
                                    allpolicylist.Add(val);
                                }
                            }
                        }
                    }
                    ret = allpolicylist.ToArray();
                }
                else
                {
                    Organization org = (Organization)PackageController.GetPackageItem(itemId);

                    int        lyncServiceId = GetLyncServiceID(org.PackageId);
                    LyncServer lync          = GetLyncServer(lyncServiceId, org.ServiceId);

                    ret = lync.GetPolicyList(type, name);
                }
            }
            catch (Exception)
            {
            }
            finally
            {
            }

            return(ret);
        }
Ejemplo n.º 2
0
        public string[] GetPolicyList(LyncPolicyType type, string name)
        {
            string[] ret = null;

            try
            {
                Log.WriteStart("{0}.GetPolicyList", ProviderSettings.ProviderName);
                ret = Lync.GetPolicyList(type, name);
                Log.WriteEnd("{0}.GetPolicyList", ProviderSettings.ProviderName);
            }
            catch (Exception ex)
            {
                Log.WriteError(String.Format("Error: {0}.GetPolicyList", ProviderSettings.ProviderName), ex);
                throw;
            }

            return(ret);
        }
Ejemplo n.º 3
0
 /// <remarks/>
 public void GetPolicyListAsync(LyncPolicyType type, string name, object userState) {
     if ((this.GetPolicyListOperationCompleted == null)) {
         this.GetPolicyListOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPolicyListOperationCompleted);
     }
     this.InvokeAsync("GetPolicyList", new object[] {
                 type,
                 name}, this.GetPolicyListOperationCompleted, userState);
 }
Ejemplo n.º 4
0
 /// <remarks/>
 public void GetPolicyListAsync(LyncPolicyType type, string name) {
     this.GetPolicyListAsync(type, name, null);
 }
Ejemplo n.º 5
0
 /// <remarks/>
 public System.IAsyncResult BeginGetPolicyList(LyncPolicyType type, string name, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("GetPolicyList", new object[] {
                 type,
                 name}, callback, asyncState);
 }
Ejemplo n.º 6
0
 public string[] GetPolicyList(LyncPolicyType type, string name) {
     object[] results = this.Invoke("GetPolicyList", new object[] {
                 type,
                 name});
     return ((string[])(results[0]));
 }
Ejemplo n.º 7
0
        internal override string[] GetPolicyListInternal(LyncPolicyType type, string name)
        {
            List <string> ret = new List <string>();

            switch (type)
            {
            case LyncPolicyType.Archiving:
            {
                Runspace runSpace            = OpenRunspace();
                Command  cmd                 = new Command("Get-CsArchivingPolicy");
                Collection <PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                if ((result != null) && (result.Count > 0))
                {
                    foreach (PSObject res in result)
                    {
                        string Identity = GetPSObjectProperty(res, "Identity").ToString();
                        ret.Add(Identity);
                    }
                }
            }
            break;

            case LyncPolicyType.DialPlan:
            {
                Runspace runSpace            = OpenRunspace();
                Command  cmd                 = new Command("Get-CsDialPlan");
                Collection <PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                if ((result != null) && (result.Count > 0))
                {
                    foreach (PSObject res in result)
                    {
                        string Identity    = GetPSObjectProperty(res, "Identity").ToString();
                        string Description = "" + (string)GetPSObjectProperty(res, "Description");
                        if (Description.ToLower().IndexOf(name.ToLower()) == -1)
                        {
                            continue;
                        }
                        ret.Add(Identity);
                    }
                }
            }
            break;

            case LyncPolicyType.Voice:
            {
                Runspace runSpace            = OpenRunspace();
                Command  cmd                 = new Command("Get-CsVoicePolicy");
                Collection <PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                if ((result != null) && (result.Count > 0))
                {
                    foreach (PSObject res in result)
                    {
                        string Identity    = GetPSObjectProperty(res, "Identity").ToString();
                        string Description = "" + (string)GetPSObjectProperty(res, "Description");
                        if (Description.ToLower().IndexOf(name.ToLower()) == -1)
                        {
                            continue;
                        }

                        ret.Add(Identity);
                    }
                }
            }
            break;

            case LyncPolicyType.Pin:
            {
                Runspace runSpace            = OpenRunspace();
                Command  cmd                 = new Command("Get-CsPinPolicy");
                Collection <PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                if ((result != null) && (result.Count > 0))
                {
                    foreach (PSObject res in result)
                    {
                        string Identity = GetPSObjectProperty(res, "Identity").ToString();
                        string str      = "" + GetPSObjectProperty(res, name);
                        ret.Add(str);
                    }
                }
            }
            break;
            }

            return(ret.ToArray());
        }
Ejemplo n.º 8
0
 internal virtual string[] GetPolicyListInternal(LyncPolicyType type, string name)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
 public virtual string[] GetPolicyList(LyncPolicyType type, string name)
 {
     return(GetPolicyListInternal(type, name));
 }
Ejemplo n.º 10
0
 public string[] GetPolicyList(int itemId, LyncPolicyType type, string name)
 {
     return(LyncController.GetPolicyList(itemId, type, name));
 }
Ejemplo n.º 11
0
        internal string[] GetPolicyListInternal(LyncPolicyType type, string name)
        {
            List<string> ret = new List<string>();

            switch (type)
            {
                case LyncPolicyType.Archiving:
                    {
                        Runspace runSpace = OpenRunspace();
                        Command cmd = new Command("Get-CsArchivingPolicy");
                        Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                        if ((result != null) && (result.Count > 0))
                        {
                            foreach (PSObject res in result)
                            {
                                string Identity = GetPSObjectProperty(res, "Identity").ToString();
                                ret.Add(Identity);
                            }
                        }
                    }
                    break;
                case LyncPolicyType.DialPlan:
                    {
                        Runspace runSpace = OpenRunspace();
                        Command cmd = new Command("Get-CsDialPlan");
                        Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                        if ((result != null) && (result.Count > 0))
                        {
                            foreach (PSObject res in result)
                            {
                                string Identity = GetPSObjectProperty(res, "Identity").ToString();
                                string Description = "" + (string)GetPSObjectProperty(res, "Description");
                                if (Description.ToLower().IndexOf(name.ToLower()) == -1) continue;
                                ret.Add(Identity);
                            }


                        }
                    }
                    break;
                case LyncPolicyType.Voice:
                    {
                        Runspace runSpace = OpenRunspace();
                        Command cmd = new Command("Get-CsVoicePolicy");
                        Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                        if ((result != null) && (result.Count > 0))
                        {
                            foreach (PSObject res in result)
                            {
                                string Identity = GetPSObjectProperty(res, "Identity").ToString();
                                string Description = "" + (string)GetPSObjectProperty(res, "Description");
                                if (Description.ToLower().IndexOf(name.ToLower()) == -1) continue;

                                ret.Add(Identity);
                            }


                        }
                    }
                    break;
                case LyncPolicyType.Pin:
                    {
                        Runspace runSpace = OpenRunspace();
                        Command cmd = new Command("Get-CsPinPolicy");
                        Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
                        if ((result != null) && (result.Count > 0))
                        {
                            foreach (PSObject res in result)
                            {
                                string Identity = GetPSObjectProperty(res, "Identity").ToString();
                                string str = "" + GetPSObjectProperty(res, name);
                                ret.Add(str);
                            }
                        }
                    }
                    break;

            }



            return ret.ToArray();
        }
Ejemplo n.º 12
0
 public string[] GetPolicyList(LyncPolicyType type, string name)
 {
     return GetPolicyListInternal(type, name);
 }
Ejemplo n.º 13
0
        public string[] GetPolicyList(LyncPolicyType type, string name)
        {
            string[] ret = null;

            try
            {
                Log.WriteStart("{0}.GetPolicyList", ProviderSettings.ProviderName);
                ret = Lync.GetPolicyList(type, name);
                Log.WriteEnd("{0}.GetPolicyList", ProviderSettings.ProviderName);
            }
            catch (Exception ex)
            {
                Log.WriteError(String.Format("Error: {0}.GetPolicyList", ProviderSettings.ProviderName), ex);
                throw;
            }

            return ret;
        }
Ejemplo n.º 14
0
 internal virtual string[] GetPolicyListInternal(LyncPolicyType type, string name)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 15
0
        public static string[] GetPolicyList(int itemId, LyncPolicyType type, string name)
        {
            string[] ret = null;
            try
            {
                if (itemId == -1)
                {
                    // policy list in all lync servers
                    List<string> allpolicylist = new List<string>();
                    List<ServerInfo> servers = ServerController.GetAllServers();
                    foreach (ServerInfo server in servers)
                    {
                        List<ServiceInfo> services = ServerController.GetServicesByServerIdGroupName(server.ServerId, ResourceGroups.Lync);
                        foreach (ServiceInfo service in services)
                        {
                            LyncServer lync = GetLyncServer(service.ServiceId, -1);
                            string[] values = lync.GetPolicyList(type, name);
                            foreach (string val in values)
                                if (allpolicylist.IndexOf(val) == -1)
                                    allpolicylist.Add(val);
                        }

                    }
                    ret = allpolicylist.ToArray();
                }
                else
                {

                    Organization org = (Organization)PackageController.GetPackageItem(itemId);

                    int lyncServiceId = GetLyncServiceID(org.PackageId);
                    LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId);

                    ret = lync.GetPolicyList(type, name);
                }
            }
            catch (Exception)
            {
            }
            finally
            {
            }

            return ret;
        }