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); }
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); }
/// <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); }
/// <remarks/> public void GetPolicyListAsync(LyncPolicyType type, string name) { this.GetPolicyListAsync(type, name, null); }
/// <remarks/> public System.IAsyncResult BeginGetPolicyList(LyncPolicyType type, string name, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetPolicyList", new object[] { type, name}, callback, asyncState); }
public string[] GetPolicyList(LyncPolicyType type, string name) { object[] results = this.Invoke("GetPolicyList", new object[] { type, name}); return ((string[])(results[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()); }
internal virtual string[] GetPolicyListInternal(LyncPolicyType type, string name) { throw new NotImplementedException(); }
public virtual string[] GetPolicyList(LyncPolicyType type, string name) { return(GetPolicyListInternal(type, name)); }
public string[] GetPolicyList(int itemId, LyncPolicyType type, string name) { return(LyncController.GetPolicyList(itemId, type, name)); }
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(); }
public string[] GetPolicyList(LyncPolicyType type, string name) { return GetPolicyListInternal(type, name); }
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; }
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; }