internal string GetResultObjectDN(Collection <PSObject> result) { HostedSolutionLog.LogStart("GetResultObjectDN"); if (result == null) { throw new ArgumentNullException("result", "Execution result is not specified"); } if (result.Count < 1) { throw new ArgumentException("Execution result does not contain any object"); } if (result.Count > 1) { throw new ArgumentException("Execution result contains more than one object"); } PSMemberInfo info = result[0].Members["DistinguishedName"]; if (info == null) { throw new ArgumentException("Execution result does not contain DistinguishedName property", "result"); } string ret = info.Value.ToString(); HostedSolutionLog.LogEnd("GetResultObjectDN"); return(ret); }
private void SetUserGeneralSettingsInternal(string instanceId, bool enabledForFederation, bool enabledForPublicIMConectivity, bool archiveInternalCommunications, bool archiveFederatedCommunications, bool enabledForEnhancedPresence) { HostedSolutionLog.LogStart("SetUserGeneralSettingsInternal"); try { if (string.IsNullOrEmpty(instanceId)) { throw new ArgumentException("instanceId"); } using (ManagementObject userObject = GetUserByInstanceId(instanceId)) { if (userObject == null) { throw new Exception(string.Format("OCS user {0} not found", instanceId)); } userObject["EnabledForFederation"] = enabledForFederation; userObject["PublicNetworkEnabled"] = enabledForPublicIMConectivity; userObject["ArchiveInternalCommunications"] = archiveInternalCommunications; userObject["ArchiveFederatedCommunications"] = archiveFederatedCommunications; if (enabledForEnhancedPresence) { userObject["EnabledForEnhancedPresence"] = true; } userObject.Put(); } } catch (Exception ex) { HostedSolutionLog.LogError("SetUserGeneralSettingsInternal", ex); throw; } HostedSolutionLog.LogEnd("SetUserGeneralSettingsInternal"); }
private void SetUserPrimaryUriInternal(string instanceId, string userUpn) { HostedSolutionLog.LogStart("SetUserPrimaryUriInternal"); try { if (string.IsNullOrEmpty(instanceId)) { throw new ArgumentException("instanceId"); } if (string.IsNullOrEmpty(userUpn)) { throw new ArgumentException("userUpn"); } using (ManagementObject userObject = GetUserByInstanceId(instanceId)) { if (userObject == null) { throw new Exception(string.Format("OCS user {0} not found", instanceId)); } string primaryUri = "sip:" + userUpn; userObject["PrimaryURI"] = primaryUri; userObject.Put(); } } catch (Exception ex) { HostedSolutionLog.LogError("SetUserPrimaryUriInternal", ex); throw; } HostedSolutionLog.LogEnd("SetUserPrimaryUriInternal"); }
/// <summary> Removes domain from allowed list.</summary> /// <param name="organizationId"> The organization identifier.</param> /// <param name="domainName"> The domain name.</param> /// <returns> The result.</returns> internal override bool RemoveFederationDomainInternal(string organizationId, string domainName) { HostedSolutionLog.LogStart("RemoveFederationDomainInternal"); HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId); HostedSolutionLog.DebugInfo("domainName: {0}", domainName); Runspace runspace = null; try { runspace = OpenRunspace(); var command = new Command("Remove-CsAllowedDomain"); command.Parameters.Add("Identity", domainName); ExecuteShellCommand(runspace, command, false); } catch (Exception ex) { HostedSolutionLog.LogError("RemoveFederationDomainInternal", ex); throw; } finally { CloseRunspace(runspace); } HostedSolutionLog.LogEnd("RemoveFederationDomainInternal"); return(true); }
public override void SetPeoplePickerOu(string site, string ou) { HostedSolutionLog.LogStart("SetPeoplePickerOu"); HostedSolutionLog.LogInfo(" Site: {0}", site); HostedSolutionLog.LogInfo(" OU: {0}", ou); Runspace runSpace = null; try { List <SharePointSiteCollection> siteCollections = new List <SharePointSiteCollection>(); runSpace = OpenRunspace(); Command cmd = new Command("Set-SPSite"); cmd.Parameters.Add("Identity", site); cmd.Parameters.Add("UserAccountDirectoryPath", ou); ExecuteShellCommand(runSpace, cmd); } finally { CloseRunspace(runSpace); } HostedSolutionLog.LogEnd("SetPeoplePickerOu"); }
/// <summary> Rollbacks the transaction.</summary> /// <param name="transaction"> The transaction.</param> internal void RollbackTransaction(SfBTransaction transaction) { HostedSolutionLog.LogStart("RollbackTransaction"); Runspace runspace = null; try { runspace = OpenRunspace(); for (int i = transaction.Actions.Count - 1; i > -1; i--) { try { RollbackAction(transaction.Actions[i], runspace); } catch (Exception ex) { HostedSolutionLog.LogError("Rollback error", ex); } } } catch (Exception ex) { HostedSolutionLog.LogError("Rollback error", ex); } finally { CloseRunspace(runspace); } HostedSolutionLog.LogEnd("RollbackTransaction"); }
/// <summary>Executes shell command.</summary> /// <param name="runspace">The runspace.</param> /// <param name="scripts">The scripts to be executed.</param> /// <param name="errors">The errors.</param> /// <returns>PSobjecs collection.</returns> private Collection <PSObject> ExecuteShellCommand(Runspace runspace, List <string> scripts, out object[] errors) { HostedSolutionLog.LogStart("ExecuteShellCommand"); var errorList = new List <object>(); Collection <PSObject> results; using (Pipeline pipeLine = runspace.CreatePipeline()) { foreach (string script in scripts) { pipeLine.Commands.AddScript(script); } results = pipeLine.Invoke(); if (pipeLine.Error != null && pipeLine.Error.Count > 0) { foreach (object item in pipeLine.Error.ReadToEnd()) { errorList.Add(item); string errorMessage = string.Format("Invoke error: {0}", item); HostedSolutionLog.LogWarning(errorMessage); throw new ArgumentException(scripts.First()); } } } errors = errorList.ToArray(); HostedSolutionLog.LogEnd("ExecuteShellCommand"); return(results); }
/// <summary>Opens PowerShell runspace.</summary> /// <returns>The runspace.</returns> private Runspace OpenRunspace() { HostedSolutionLog.LogStart("OpenRunspace"); if (runspaceConfiguration == null) { runspaceConfiguration = RunspaceConfiguration.Create(); PSSnapInException exception; runspaceConfiguration.AddPSSnapIn(SharepointSnapInName, out exception); HostedSolutionLog.LogInfo("Sharepoint snapin loaded"); if (exception != null) { HostedSolutionLog.LogWarning("SnapIn error", exception); } } Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration); runspace.Open(); runspace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); HostedSolutionLog.LogEnd("OpenRunspace"); return(runspace); }
/// <summary> Deletes user.</summary> /// <param name="userUpn"> The user UPN.</param> /// <returns> The result.</returns> internal override bool DeleteUserInternal(string userUpn) { HostedSolutionLog.LogStart("DeleteUserInternal"); HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn); Runspace runspace = null; try { runspace = OpenRunspace(); DeleteUser(runspace, userUpn); var command = new Command("Get-CsAdUser"); command.Parameters.Add("Identity", userUpn); ExecuteShellCommand(runspace, command, false); command = new Command("Update-CsAddressBook"); ExecuteShellCommand(runspace, command, false); command = new Command("Update-CsUserDatabase"); ExecuteShellCommand(runspace, command, false); } catch (Exception ex) { HostedSolutionLog.LogError("DeleteUserInternal", ex); throw; } finally { CloseRunspace(runspace); } HostedSolutionLog.LogEnd("DeleteUserInternal"); return(true); }
/// <summary> /// Checks the object from the shell execution result. /// </summary> /// <param name="result"></param> /// <returns>Distinguished name of the object if object exists or null otherwise.</returns> internal string CheckResultObjectDN(Collection <PSObject> result) { HostedSolutionLog.LogStart("CheckResultObjectDN"); if (result == null) { return(null); } if (result.Count < 1) { return(null); } PSMemberInfo info = result[0].Members["DistinguishedName"]; if (info == null) { throw new ArgumentException("Execution result does not contain DistinguishedName property", "result"); } string ret = info.Value.ToString(); HostedSolutionLog.LogEnd("CheckResultObjectDN"); return(ret); }
/// <summary> Gets allowed domains.</summary> /// <param name="organizationId"> The organization identifier.</param> /// <returns> Allowed domains.</returns> internal override SfBFederationDomain[] GetFederationDomainsInternal(string organizationId) { HostedSolutionLog.LogStart("GetFederationDomainsInternal"); HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId); SfBFederationDomain[] domains; Runspace runspace = null; try { runspace = OpenRunspace(); domains = GetFederationDomainsInternal(runspace); } catch (Exception ex) { HostedSolutionLog.LogError("GetFederationDomainsInternal", ex); throw; } finally { CloseRunspace(runspace); } HostedSolutionLog.LogEnd("GetFederationDomainsInternal"); return(domains); }
private void AddDomainInternal(string domainName) { HostedSolutionLog.LogStart("AddDomainInternal"); HostedSolutionLog.DebugInfo("Domain Name: {0}", domainName); try { if (string.IsNullOrEmpty(domainName)) { throw new ArgumentException("domainName"); } if (GetDomain(domainName) != null) { HostedSolutionLog.LogWarning("OCS internal domain '{0}' already exists", domainName); } else { using (ManagementObject newDomain = Wmi.CreateInstance("MSFT_SIPFederationInternalDomainData")) { newDomain["SupportedInternalDomain"] = domainName; newDomain.Put(); } } } catch (Exception ex) { HostedSolutionLog.LogError("AddDomainInternal", ex); throw; } HostedSolutionLog.LogEnd("AddDomainInternal"); }
private void DeleteDomainInternal(string domainName) { HostedSolutionLog.LogStart("DeleteDomainInternal"); HostedSolutionLog.DebugInfo("Domain Name: {0}", domainName); try { if (string.IsNullOrEmpty(domainName)) { throw new ArgumentException("domainName"); } using (ManagementObject domainObj = GetDomain(domainName)) { if (domainObj == null) { HostedSolutionLog.LogWarning("OCS internal domain '{0}' not found", domainName); } else { domainObj.Delete(); } } } catch (Exception ex) { HostedSolutionLog.LogError("DeleteDomainInternal", ex); throw; } HostedSolutionLog.LogEnd("DeleteDomainInternal"); }
private void DeleteUserInternal(string instanceId) { HostedSolutionLog.LogStart("DeleteUserInternal"); try { if (string.IsNullOrEmpty(instanceId)) { throw new ArgumentException("instanceId"); } using (ManagementObject userObject = GetUserByInstanceId(instanceId)) { if (userObject == null) { HostedSolutionLog.LogWarning("OCS user {0} not found", instanceId); } else { userObject.Delete(); } } } catch (Exception ex) { HostedSolutionLog.LogError("DeleteUserInternal", ex); throw; } HostedSolutionLog.LogEnd("DeleteUserInternal"); }
private ManagementObject GetDomain(string domainName) { HostedSolutionLog.LogStart("GetDomain"); ManagementObject objDomain = Wmi.GetWmiObject("MSFT_SIPFederationInternalDomainData", "SupportedInternalDomain='{0}'", domainName); HostedSolutionLog.LogEnd("GetDomain"); return(objDomain); }
private ManagementObject GetUserByInstanceId(string instanceId) { HostedSolutionLog.LogStart("GetUserByInstanceId"); ManagementObject objUser = Wmi.GetWmiObject("MSFT_SIPESUserSetting", "InstanceID = '{0}'", instanceId); HostedSolutionLog.LogEnd("GetUserByInstanceId"); return(objUser); }
/// <summary>Restores site collection under given url from backup.</summary> /// <param name="rootWebApplicationUri">Root web application uri.</param> /// <param name="siteCollection">Site collection to be restored.</param> /// <param name="filename">Backup file name to restore from.</param> /// <exception cref="InvalidOperationException">Is thrown in case requested operation fails for any reason.</exception> public void RestoreSiteCollection(Uri rootWebApplicationUri, SharePointEnterpriseSiteCollection siteCollection, string filename) { string url = siteCollection.Url; try { string siteCollectionUrl = String.Format("{0}:{1}", url, rootWebApplicationUri.Port); HostedSolutionLog.LogStart("RestoreSiteCollection"); HostedSolutionLog.DebugInfo("siteCollectionUrl: {0}", siteCollectionUrl); HostedSolutionLog.DebugInfo("backupFilePath: {0}", filename); Runspace runspace = null; try { string tempPath = Path.GetTempPath(); string expandedFile = filename; if (Path.GetExtension(filename).ToLower() == ".zip") { expandedFile = FileUtils.UnzipFiles(filename, tempPath)[0]; // Delete zip archive. FileUtils.DeleteFile(filename); } runspace = OpenRunspace(); DeleteSiteCollection(runspace, siteCollectionUrl, false); var command = new Command("Restore-SPSite"); command.Parameters.Add("Identity", siteCollectionUrl); command.Parameters.Add("Path", filename); ExecuteShellCommand(runspace, command); command = new Command("Set-SPSite"); command.Parameters.Add("Identity", siteCollectionUrl); command.Parameters.Add("OwnerAlias", siteCollection.OwnerLogin); ExecuteShellCommand(runspace, command); command = new Command("Set-SPUser"); command.Parameters.Add("Identity", siteCollection.OwnerLogin); command.Parameters.Add("Email", siteCollection.OwnerEmail); command.Parameters.Add("DisplayName", siteCollection.Name); ExecuteShellCommand(runspace, command); FileUtils.DeleteFile(expandedFile); } finally { CloseRunspace(runspace); HostedSolutionLog.LogEnd("RestoreSiteCollection"); } } catch (Exception ex) { throw new InvalidOperationException("Failed to restore site collection.", ex); } }
/// <summary> Deletes sip domain.</summary> /// <param name="runspace"> The runspace.</param> /// <param name="id"> The identifier.</param> internal void DeleteSipDomain(Runspace runspace, string id) { HostedSolutionLog.LogStart("DeleteSipDomain"); HostedSolutionLog.DebugInfo("SipDomain : {0}", id); var command = new Command("Remove-CsSipDomain"); command.Parameters.Add("Identity", id); command.Parameters.Add("Confirm", false); command.Parameters.Add("Force", true); ExecuteShellCommand(runspace, command, false); HostedSolutionLog.LogEnd("DeleteSipDomain"); }
/// <summary> Deletes user.</summary> /// <param name="runspace"> The runspace.</param> /// <param name="userUpn"> The user UPN.</param> internal void DeleteUser(Runspace runspace, string userUpn) { HostedSolutionLog.LogStart("DeleteUser"); HostedSolutionLog.DebugInfo("userUpn : {0}", userUpn); var command = new Command("Disable-CsUser"); command.Parameters.Add("Identity", userUpn); command.Parameters.Add("Confirm", false); ExecuteShellCommand(runspace, command, false); HostedSolutionLog.LogEnd("DeleteUser"); }
/// <summary> Deletes mobility policy.</summary> /// <param name="runspace"> The runspace.</param> /// <param name="policyName"> The policy name.</param> internal void DeleteMobilityPolicy(Runspace runspace, string policyName) { HostedSolutionLog.LogStart("DeleteMobilityPolicy"); HostedSolutionLog.DebugInfo("policyName : {0}", policyName); var command = new Command("Remove-CsMobilityPolicy"); command.Parameters.Add("Identity", policyName); command.Parameters.Add("Confirm", false); command.Parameters.Add("Force", true); ExecuteShellCommand(runspace, command, false); HostedSolutionLog.LogEnd("DeleteMobilityPolicy"); }
/// <summary> Backups site collection under give url.</summary> /// <param name="rootWebApplicationUri">Root web application uri.</param> /// <param name="url">Url that uniquely identifies site collection to be deleted.</param> /// <param name="filename">Resulting backup file name.</param> /// <param name="zip">A value which shows whether created backup must be archived.</param> /// <param name="tempPath">Custom temp path for backup</param> /// <returns>Full path to created backup.</returns> /// <exception cref="InvalidOperationException">Is thrown in case requested operation fails for any reason.</exception> public string BackupSiteCollection(Uri rootWebApplicationUri, string url, string filename, bool zip, string tempPath) { try { string siteCollectionUrl = String.Format("{0}:{1}", url, rootWebApplicationUri.Port); HostedSolutionLog.LogStart("BackupSiteCollection"); HostedSolutionLog.DebugInfo("siteCollectionUrl: {0}", siteCollectionUrl); if (String.IsNullOrEmpty(tempPath)) { tempPath = Path.GetTempPath(); } string backupFileName = Path.Combine(tempPath, (zip ? StringUtils.CleanIdentifier(siteCollectionUrl) + ".bsh" : StringUtils.CleanIdentifier(filename))); HostedSolutionLog.DebugInfo("backupFilePath: {0}", backupFileName); Runspace runspace = null; try { runspace = OpenRunspace(); var command = new Command("Backup-SPSite"); command.Parameters.Add("Identity", siteCollectionUrl); command.Parameters.Add("Path", backupFileName); ExecuteShellCommand(runspace, command); if (zip) { string zipFile = Path.Combine(tempPath, filename); string zipRoot = Path.GetDirectoryName(backupFileName); FileUtils.ZipFiles(zipFile, zipRoot, new[] { Path.GetFileName(backupFileName) }); FileUtils.DeleteFile(backupFileName); backupFileName = zipFile; } return(backupFileName); } finally { CloseRunspace(runspace); HostedSolutionLog.LogEnd("BackupSiteCollection"); } } catch (Exception ex) { throw new InvalidOperationException("Failed to backup site collection.", ex); } }
private string FindUserByPrimaryUri(string uri) { string ret = null; HostedSolutionLog.LogStart("FindUserByPrimaryUri"); using (ManagementObject objUser = Wmi.GetWmiObject("MSFT_SIPESUserSetting", "PrimaryURI = '{0}'", uri)) { if (objUser != null) { ret = (string)objUser["InstanceID"]; } } HostedSolutionLog.LogEnd("FindUserByPrimaryUri"); return(ret); }
private string GetPoolDistinguishedName(string poolFQDN) { HostedSolutionLog.LogStart("GetPoolDistinguishedName"); string ret = null; using (ManagementObject objPool = Wmi.GetWmiObject("MSFT_SIPPoolSetting", "PoolFQDN = '{0}'", poolFQDN)) { if (objPool != null) { ret = (string)objPool["PoolDN"]; } } HostedSolutionLog.LogEnd("GetPoolDistinguishedName"); return(ret); }
private string FindUserByDistinguishedName(string userDistinguishedName) { string ret = null; HostedSolutionLog.LogStart("FindUserByDistinguishedName"); using (ManagementObject objUser = Wmi.GetWmiObject("MSFT_SIPESUserSetting", "UserDN = '{0}'", userDistinguishedName)) { if (objUser != null) { ret = (string)objUser["InstanceID"]; } } HostedSolutionLog.LogEnd("FindUserByDistinguishedName"); return(ret); }
/// <summary> Gets organization distinguished name.</summary> /// <param name="organizationId"> The organization identifier.</param> /// <param name="runspace"> The runspace.</param> /// <returns> The distinguished name.</returns> private string GetResultObjectDN(string organizationId, Runspace runspace) { HostedSolutionLog.LogStart("GetResultObjectDN"); string path = GetOrganizationPath(organizationId); var scripts = new List <string> { string.Format("Get-ADOrganizationalUnit -Identity \"{0}\"", path) }; Collection <PSObject> result = ExecuteShellCommand(runspace, scripts); if (result != null && result.Any()) { return(result.First().Properties["DistinguishedName"].Value.ToString()); } throw new ArgumentException("Execution result does not contain DistinguishedName property"); }
/// <summary> Opens runspace.</summary> /// <returns> The runspace.</returns> internal Runspace OpenRunspace() { HostedSolutionLog.LogStart("OpenRunspace"); if (session == null) { session = InitialSessionState.CreateDefault(); session.ImportPSModule(new[] { "ActiveDirectory", "SkypeForBusiness" }); } Runspace runspace = RunspaceFactory.CreateRunspace(session); runspace.Open(); runspace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); HostedSolutionLog.LogEnd("OpenRunspace"); return(runspace); }
/// <summary> /// Returns the identity of the PS object /// </summary> /// <param name="obj"></param> /// <returns></returns> internal string GetPSObjectIdentity(PSObject obj) { HostedSolutionLog.LogStart("GetPSObjectIdentity"); if (obj == null) { throw new ArgumentNullException("obj", "PSObject is not specified"); } PSMemberInfo info = obj.Members["Identity"]; if (info == null) { throw new ArgumentException("PSObject does not contain Identity property", "obj"); } string ret = info.Value.ToString(); HostedSolutionLog.LogEnd("GetPSObjectIdentity"); return(ret); }
/// <summary> Gets users general settings.</summary> /// <param name="organizationId"> The organization identifier.</param> /// <param name="userUpn"> The user UPN.</param> /// <returns> User settings.</returns> internal override SfBUser GetSfBUserGeneralSettingsInternal(string organizationId, string userUpn) { HostedSolutionLog.LogStart("GetSfBUserGeneralSettingsInternal"); HostedSolutionLog.DebugInfo("organizationId: {0}", organizationId); HostedSolutionLog.DebugInfo("userUpn: {0}", userUpn); var sfbUser = new SfBUser(); Runspace runspace = null; try { runspace = OpenRunspace(); var command = new Command("Get-CsUser"); command.Parameters.Add("Identity", userUpn); Collection <PSObject> result = ExecuteShellCommand(runspace, command, false); PSObject user = result[0]; sfbUser.DisplayName = (string)GetPSObjectProperty(user, "DisplayName"); sfbUser.SipAddress = (string)GetPSObjectProperty(user, "SipAddress"); sfbUser.LineUri = (string)GetPSObjectProperty(user, "LineURI"); sfbUser.SipAddress = sfbUser.SipAddress.ToLower().Replace("sip:", ""); sfbUser.LineUri = sfbUser.LineUri.ToLower().Replace("tel:+", ""); sfbUser.LineUri = sfbUser.LineUri.ToLower().Replace("tel:", ""); } catch (Exception ex) { HostedSolutionLog.LogError("GetSfBUserGeneralSettingsInternal", ex); throw; } finally { CloseRunspace(runspace); } HostedSolutionLog.LogEnd("GetSfBUserGeneralSettingsInternal"); return(sfbUser); }
/// <summary> Executes shell command.</summary> /// <param name="runspace"> The runspace.</param> /// <param name="command"> The command.</param> /// <param name="useDomainController"> True - if domain controller should be used.</param> /// <param name="errors"> Errors list.</param> /// <returns> The result.</returns> internal Collection <PSObject> ExecuteShellCommand(Runspace runspace, Command command, bool useDomainController, out object[] errors) { HostedSolutionLog.LogStart("ExecuteShellCommand"); var errorList = new List <object>(); if (useDomainController) { var dc = new CommandParameter("DomainController", PrimaryDomainController); if (!command.Parameters.Contains(dc)) { command.Parameters.Add(dc); } } HostedSolutionLog.DebugCommand(command); Collection <PSObject> results; Pipeline pipeLine = runspace.CreatePipeline(); using (pipeLine) { pipeLine.Commands.Add(command); results = pipeLine.Invoke(); if (pipeLine.Error != null && pipeLine.Error.Count > 0) { foreach (object item in pipeLine.Error.ReadToEnd()) { errorList.Add(item); string errorMessage = string.Format("Invoke error: {0}", item); HostedSolutionLog.LogWarning(errorMessage); } } } errors = errorList.ToArray(); HostedSolutionLog.LogEnd("ExecuteShellCommand"); return(results); }
private OCSUser GetUserGeneralSettingsInternal(string instanceId) { HostedSolutionLog.LogStart("GetUserGeneralSettingsInternal"); try { if (string.IsNullOrEmpty(instanceId)) { throw new ArgumentException("instanceId"); } using (ManagementObject userObject = GetUserByInstanceId(instanceId)) { if (userObject == null) { throw new Exception(string.Format("OCS user {0} not found", instanceId)); } OCSUser user = new OCSUser(); user.InstanceId = instanceId; user.PrimaryUri = (string)userObject["PrimaryURI"]; user.DisplayName = (string)userObject["DisplayName"]; user.EnabledForFederation = (bool)userObject["EnabledForFederation"]; user.EnabledForPublicIMConectivity = (bool)userObject["PublicNetworkEnabled"]; user.ArchiveInternalCommunications = (bool)userObject["ArchiveInternalCommunications"]; user.ArchiveFederatedCommunications = (bool)userObject["ArchiveFederatedCommunications"]; user.EnabledForEnhancedPresence = (bool)userObject["EnabledForEnhancedPresence"]; HostedSolutionLog.LogEnd("GetUserGeneralSettingsInternal"); return(user); } } catch (Exception ex) { HostedSolutionLog.LogError("GetUserGeneralSettingsInternal", ex); throw; } }