Fixed lync object index range exceeded and missing tenant ID

This commit is contained in:
robvde 2013-12-24 00:45:23 +04:00
parent 5193588f18
commit 34543153b5
2 changed files with 39 additions and 29 deletions

View file

@ -229,6 +229,34 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
} }
} }
if (lync.GetOrganizationTenantId(org.OrganizationId) == string.Empty)
{
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
org.LyncTenantId = lync.CreateOrganization(org.OrganizationId,
org.DefaultDomain,
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ALLOWVIDEO].QuotaAllocatedValue),
Convert.ToInt32(cntx.Quotas[Quotas.LYNC_MAXPARTICIPANTS].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_FEDERATION].QuotaAllocatedValue),
Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue));
if (string.IsNullOrEmpty(org.LyncTenantId))
{
TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ENABLE_ORG);
return res;
}
else
{
PackageController.UpdatePackageItem(org);
bReloadConfiguration = true;
}
}
LyncUserPlan plan = GetLyncUserPlan(itemId, lyncUserPlanId); LyncUserPlan plan = GetLyncUserPlan(itemId, lyncUserPlanId);
if (!lync.CreateUser(org.OrganizationId, user.UserPrincipalName, plan)) if (!lync.CreateUser(org.OrganizationId, user.UserPrincipalName, plan))

View file

@ -88,7 +88,7 @@ namespace WebsitePanel.Providers.Lync {
/// <remarks/> /// <remarks/>
public LyncServer() { public LyncServer() {
this.Url = "http://localhost:9004/LyncServer.asmx"; this.Url = "http://localhost:9003/LyncServer.asmx";
} }
/// <remarks/> /// <remarks/>
@ -193,28 +193,16 @@ namespace WebsitePanel.Providers.Lync {
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetOrganizationTenantId", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetOrganizationTenantId", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string GetOrganizationTenantId(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice) { public string GetOrganizationTenantId(string organizationId) {
object[] results = this.Invoke("GetOrganizationTenantId", new object[] { object[] results = this.Invoke("GetOrganizationTenantId", new object[] {
organizationId, organizationId});
sipDomain,
enableConferencing,
enableConferencingVideo,
maxConferenceSize,
enabledFederation,
enabledEnterpriseVoice});
return ((string)(results[0])); return ((string)(results[0]));
} }
/// <remarks/> /// <remarks/>
public System.IAsyncResult BeginGetOrganizationTenantId(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice, System.AsyncCallback callback, object asyncState) { public System.IAsyncResult BeginGetOrganizationTenantId(string organizationId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetOrganizationTenantId", new object[] { return this.BeginInvoke("GetOrganizationTenantId", new object[] {
organizationId, organizationId}, callback, asyncState);
sipDomain,
enableConferencing,
enableConferencingVideo,
maxConferenceSize,
enabledFederation,
enabledEnterpriseVoice}, callback, asyncState);
} }
/// <remarks/> /// <remarks/>
@ -224,23 +212,17 @@ namespace WebsitePanel.Providers.Lync {
} }
/// <remarks/> /// <remarks/>
public void GetOrganizationTenantIdAsync(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice) { public void GetOrganizationTenantIdAsync(string organizationId) {
this.GetOrganizationTenantIdAsync(organizationId, sipDomain, enableConferencing, enableConferencingVideo, maxConferenceSize, enabledFederation, enabledEnterpriseVoice, null); this.GetOrganizationTenantIdAsync(organizationId, null);
} }
/// <remarks/> /// <remarks/>
public void GetOrganizationTenantIdAsync(string organizationId, string sipDomain, bool enableConferencing, bool enableConferencingVideo, int maxConferenceSize, bool enabledFederation, bool enabledEnterpriseVoice, object userState) { public void GetOrganizationTenantIdAsync(string organizationId, object userState) {
if ((this.GetOrganizationTenantIdOperationCompleted == null)) { if ((this.GetOrganizationTenantIdOperationCompleted == null)) {
this.GetOrganizationTenantIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationTenantIdOperationCompleted); this.GetOrganizationTenantIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationTenantIdOperationCompleted);
} }
this.InvokeAsync("GetOrganizationTenantId", new object[] { this.InvokeAsync("GetOrganizationTenantId", new object[] {
organizationId, organizationId}, this.GetOrganizationTenantIdOperationCompleted, userState);
sipDomain,
enableConferencing,
enableConferencingVideo,
maxConferenceSize,
enabledFederation,
enabledEnterpriseVoice}, this.GetOrganizationTenantIdOperationCompleted, userState);
} }
private void OnGetOrganizationTenantIdOperationCompleted(object arg) { private void OnGetOrganizationTenantIdOperationCompleted(object arg) {