Fixed lync out of index error and added ability to verify if organization is a
valid Tenant Proxies not generated
This commit is contained in:
parent
5b75dc1b0b
commit
16ec864a09
4 changed files with 132 additions and 16 deletions
|
@ -35,6 +35,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
public interface ILyncServer
|
public interface ILyncServer
|
||||||
{
|
{
|
||||||
string CreateOrganization(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice);
|
string CreateOrganization(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice);
|
||||||
|
string GetOrganizationTenantId(string organizationId);
|
||||||
bool DeleteOrganization(string organizationId, string sipDomain);
|
bool DeleteOrganization(string organizationId, string sipDomain);
|
||||||
|
|
||||||
bool CreateUser(string organizationId, string userUpn, LyncUserPlan plan);
|
bool CreateUser(string organizationId, string userUpn, LyncUserPlan plan);
|
||||||
|
|
|
@ -112,6 +112,11 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
return CreateOrganizationInternal(organizationId, sipDomain, enableConferencing, enableConferencingVideo, maxConferenceSize, enabledFederation, enabledEnterpriseVoice);
|
return CreateOrganizationInternal(organizationId, sipDomain, enableConferencing, enableConferencingVideo, maxConferenceSize, enabledFederation, enabledEnterpriseVoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetOrganizationTenantId(string organizationId)
|
||||||
|
{
|
||||||
|
return GetOrganizationTenantIdInternal(organizationId);
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteOrganization(string organizationId, string sipDomain)
|
public bool DeleteOrganization(string organizationId, string sipDomain)
|
||||||
{
|
{
|
||||||
return DeleteOrganizationInternal(organizationId, sipDomain);
|
return DeleteOrganizationInternal(organizationId, sipDomain);
|
||||||
|
@ -277,7 +282,42 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
return TenantId;
|
return TenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetOrganizationTenantIdInternal(string organizationId)
|
||||||
|
{
|
||||||
|
HostedSolutionLog.LogStart("GetOrganizationTenantIdInternal");
|
||||||
|
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
|
||||||
|
|
||||||
|
string tenantIdStr = string.Empty;
|
||||||
|
|
||||||
|
Runspace runSpace = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
runSpace = OpenRunspace();
|
||||||
|
|
||||||
|
Command cmd = new Command("Get-CsTenant");
|
||||||
|
cmd.Parameters.Add("Identity", GetOrganizationPath(organizationId));
|
||||||
|
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
|
||||||
|
if ((result != null) && (result.Count > 0))
|
||||||
|
{
|
||||||
|
Guid tenantId = (Guid)GetPSObjectProperty(result[0], "TenantId");
|
||||||
|
|
||||||
|
tenantIdStr = tenantId.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
HostedSolutionLog.LogError("GetOrganizationTenantIdInternal", ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
|
||||||
|
CloseRunspace(runSpace);
|
||||||
|
}
|
||||||
|
HostedSolutionLog.LogEnd("GetOrganizationTenantIdnInternal");
|
||||||
|
return tenantIdStr;
|
||||||
|
}
|
||||||
|
|
||||||
private bool DeleteOrganizationInternal(string organizationId, string sipDomain)
|
private bool DeleteOrganizationInternal(string organizationId, string sipDomain)
|
||||||
{
|
{
|
||||||
|
@ -508,7 +548,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
|
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
|
||||||
HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn);
|
HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn);
|
||||||
|
|
||||||
LyncUser lyncUser = new LyncUser();
|
LyncUser lyncUser = null;
|
||||||
Runspace runSpace = null;
|
Runspace runSpace = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -517,8 +557,13 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
Command cmd = new Command("Get-CsUser");
|
Command cmd = new Command("Get-CsUser");
|
||||||
cmd.Parameters.Add("Identity", userUpn);
|
cmd.Parameters.Add("Identity", userUpn);
|
||||||
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
|
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
|
||||||
|
|
||||||
|
if ((result != null) && (result.Count > 0))
|
||||||
|
{
|
||||||
PSObject user = result[0];
|
PSObject user = result[0];
|
||||||
|
|
||||||
|
lyncUser = new LyncUser();
|
||||||
|
|
||||||
lyncUser.DisplayName = (string)GetPSObjectProperty(user, "DisplayName");
|
lyncUser.DisplayName = (string)GetPSObjectProperty(user, "DisplayName");
|
||||||
lyncUser.SipAddress = (string)GetPSObjectProperty(user, "SipAddress");
|
lyncUser.SipAddress = (string)GetPSObjectProperty(user, "SipAddress");
|
||||||
lyncUser.LineUri = (string)GetPSObjectProperty(user, "LineURI");
|
lyncUser.LineUri = (string)GetPSObjectProperty(user, "LineURI");
|
||||||
|
@ -527,6 +572,10 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:+", "");
|
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:+", "");
|
||||||
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:", "");
|
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:", "");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
HostedSolutionLog.LogInfo("GetLyncUserGeneralSettingsInternal: No info found");
|
||||||
|
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
HostedSolutionLog.LogError("GetLyncUserGeneralSettingsInternal", ex);
|
HostedSolutionLog.LogError("GetLyncUserGeneralSettingsInternal", ex);
|
||||||
|
|
|
@ -112,6 +112,11 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
return CreateOrganizationInternal(organizationId, sipDomain, enableConferencing, enableConferencingVideo, maxConferenceSize, enabledFederation, enabledEnterpriseVoice);
|
return CreateOrganizationInternal(organizationId, sipDomain, enableConferencing, enableConferencingVideo, maxConferenceSize, enabledFederation, enabledEnterpriseVoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetOrganizationTenantId(string organizationId)
|
||||||
|
{
|
||||||
|
return GetOrganizationTenantIdInternal(organizationId);
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteOrganization(string organizationId, string sipDomain)
|
public bool DeleteOrganization(string organizationId, string sipDomain)
|
||||||
{
|
{
|
||||||
return DeleteOrganizationInternal(organizationId, sipDomain);
|
return DeleteOrganizationInternal(organizationId, sipDomain);
|
||||||
|
@ -276,7 +281,42 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
return TenantId;
|
return TenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetOrganizationTenantIdInternal(string organizationId)
|
||||||
|
{
|
||||||
|
HostedSolutionLog.LogStart("GetOrganizationTenantIdInternal");
|
||||||
|
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
|
||||||
|
|
||||||
|
string tenantIdStr = string.Empty;
|
||||||
|
|
||||||
|
Runspace runSpace = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
runSpace = OpenRunspace();
|
||||||
|
|
||||||
|
Command cmd = new Command("Get-CsTenant");
|
||||||
|
cmd.Parameters.Add("Identity", GetOrganizationPath(organizationId));
|
||||||
|
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd, false);
|
||||||
|
if ((result != null) && (result.Count > 0))
|
||||||
|
{
|
||||||
|
Guid tenantId = (Guid)GetPSObjectProperty(result[0], "TenantId");
|
||||||
|
|
||||||
|
tenantIdStr = tenantId.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
HostedSolutionLog.LogError("GetOrganizationTenantIdInternal", ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
|
||||||
|
CloseRunspace(runSpace);
|
||||||
|
}
|
||||||
|
HostedSolutionLog.LogEnd("GetOrganizationTenantIdnInternal");
|
||||||
|
return tenantIdStr;
|
||||||
|
}
|
||||||
|
|
||||||
private bool DeleteOrganizationInternal(string organizationId, string sipDomain)
|
private bool DeleteOrganizationInternal(string organizationId, string sipDomain)
|
||||||
{
|
{
|
||||||
|
@ -507,7 +547,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
|
HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId);
|
||||||
HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn);
|
HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn);
|
||||||
|
|
||||||
LyncUser lyncUser = new LyncUser();
|
LyncUser lyncUser = null;
|
||||||
Runspace runSpace = null;
|
Runspace runSpace = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -516,8 +556,13 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
Command cmd = new Command("Get-CsUser");
|
Command cmd = new Command("Get-CsUser");
|
||||||
cmd.Parameters.Add("Identity", userUpn);
|
cmd.Parameters.Add("Identity", userUpn);
|
||||||
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
|
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
|
||||||
|
|
||||||
|
if ((result != null) && (result.Count > 0))
|
||||||
|
{
|
||||||
PSObject user = result[0];
|
PSObject user = result[0];
|
||||||
|
|
||||||
|
lyncUser = new LyncUser();
|
||||||
|
|
||||||
lyncUser.DisplayName = (string)GetPSObjectProperty(user, "DisplayName");
|
lyncUser.DisplayName = (string)GetPSObjectProperty(user, "DisplayName");
|
||||||
lyncUser.SipAddress = (string)GetPSObjectProperty(user, "SipAddress");
|
lyncUser.SipAddress = (string)GetPSObjectProperty(user, "SipAddress");
|
||||||
lyncUser.LineUri = (string)GetPSObjectProperty(user, "LineURI");
|
lyncUser.LineUri = (string)GetPSObjectProperty(user, "LineURI");
|
||||||
|
@ -526,6 +571,10 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:+", "");
|
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:+", "");
|
||||||
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:", "");
|
lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:", "");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
HostedSolutionLog.LogInfo("GetLyncUserGeneralSettingsInternal: No info found");
|
||||||
|
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
HostedSolutionLog.LogError("GetLyncUserGeneralSettingsInternal", ex);
|
HostedSolutionLog.LogError("GetLyncUserGeneralSettingsInternal", ex);
|
||||||
|
|
|
@ -70,6 +70,23 @@ namespace WebsitePanel.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public string GetOrganizationTenantId(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.WriteStart("{0}.GetOrganizationTenantId", ProviderSettings.ProviderName);
|
||||||
|
string ret = Lync.GetOrganizationTenantId(organizationId);
|
||||||
|
Log.WriteEnd("{0}.GetOrganizationTenantId", ProviderSettings.ProviderName);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.WriteError(String.Format("Error: {0}.GetOrganizationTenantId", ProviderSettings.ProviderName), ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[WebMethod, SoapHeader("settings")]
|
[WebMethod, SoapHeader("settings")]
|
||||||
public bool DeleteOrganization(string organizationId, string sipDomain)
|
public bool DeleteOrganization(string organizationId, string sipDomain)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue