public string CPOGetCurrentOOF(string organization, string userprincipalname) { try { using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetOOFMessage(organization, userprincipalname); PSObject result = ps.Invoke().Single(); return(new JavaScriptSerializer().Serialize(new AjaxGetCurrentOOF() { StartTime = result.Members["StartTime"].Value.ToString(), EndTime = result.Members["EndTime"].Value.ToString(), AutoReplyState = result.Members["AutoReplyState"].Value.ToString(), InternalMessage = result.Members["InternalMessage"].Value.ToString(), ExternalMessage = result.Members["ExternalMessage"].Value.ToString(), ExternalAudience = result.Members["ExternalAudience"].Value.ToString() })); } } catch (Exception exc) { return(new JsonException(exc).ToString()); } }
public string CPOGetDistributionGroups(string organization) { try { List <AjaxDistributionGroup> distributionGroups = new List <AjaxDistributionGroup>(); using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetDistributionGroups(organization); IEnumerable <PSObject> result = ps.Invoke(); foreach (PSObject group in result) { Dictionary <string, object> properties = CommonCAS.GetPSObjectProperties(group); distributionGroups.Add(new AjaxDistributionGroup() { Name = properties["DisplayName"].ToString(), PrimarySmtpAddress = properties["PrimarySmtpAddress"].ToString() }); } } return(new JavaScriptSerializer().Serialize(distributionGroups)); } catch (Exception exc) { return(new JsonException(exc).ToString()); } }
public string CPOGetSendAsGroups(string organization) { try { List <AjaxSendAsGroups> groups = new List <AjaxSendAsGroups>(); using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetSendAsGroups(organization); IEnumerable <PSObject> result = ps.Invoke(); foreach (PSObject Group in result) { Dictionary <string, object> properties = CommonCAS.GetPSObjectProperties(Group); groups.Add(new AjaxSendAsGroups() { Name = properties["Name"].ToString(), DistinguishedName = properties["DistinguishedName"].ToString(), Description = properties["Description"].ToString(), }); } } return(new JavaScriptSerializer().Serialize(groups)); } catch (Exception exc) { return(new JsonException(exc).ToString()); } }
public string CPOGetCTXGoldenServers(string solution, bool mcsenabled) { try { List <AjaxCTXGoldenServers> servers = new List <AjaxCTXGoldenServers>(); using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetCTXGoldenServers(solution, mcsenabled); IEnumerable <PSObject> result = ps.Invoke(); foreach (PSObject Server in result) { Dictionary <string, object> properties = CommonCAS.GetPSObjectProperties(Server); servers.Add(new AjaxCTXGoldenServers() { Name = properties["Name"].ToString(), }); } } return(new JavaScriptSerializer().Serialize(servers)); } catch (Exception exc) { return(new JsonException(exc).ToString()); } }
public string CPOGetAcceptedDomain(string organization) { try { List <CPOAjaxAcceptedDomain> domains = new List <CPOAjaxAcceptedDomain>(); using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetAcceptedDomain(organization); IEnumerable <PSObject> result = ps.Invoke(); foreach (PSObject domain in result) { Dictionary <string, object> properties = CommonCAS.GetPSObjectProperties(domain); domains.Add(new CPOAjaxAcceptedDomain() { Name = properties["Name"].ToString(), DomainName = properties["DomainName"].ToString(), }); } } return(new JavaScriptSerializer().Serialize(domains)); } catch (Exception exc) { return(new JsonException(exc).ToString()); } }
public string CPOGetMailbox(string organization, string name) { try { List <AjaxMailbox> mailboxes = new List <AjaxMailbox>(); using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetMailbox(organization, name); IEnumerable <PSObject> result = ps.Invoke(); foreach (PSObject mailbox in result) { Dictionary <string, object> properties = CommonCAS.GetPSObjectProperties(mailbox); mailboxes.Add(new AjaxMailbox() { Name = properties["Name"].ToString(), UserPrincipalName = properties["UserPrincipalName"].ToString(), RecipientTypeDetails = properties["RecipientTypeDetails"].ToString(), EmailAddresses = properties["EmailAddresses"].ToString().Split(' ') }); } } return(new JavaScriptSerializer().Serialize(mailboxes)); } catch (Exception exc) { return(new JsonException(exc).ToString()); } }
public string CPOGetCalendarPermissions(string organization, string userprincipalname) { try { List <CPOAjaxMailboxFolderPermission> folderPermissions = new List <CPOAjaxMailboxFolderPermission>(); using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetCalendarPermissions(organization, userprincipalname); IEnumerable <PSObject> result = ps.Invoke(); foreach (PSObject folderPermission in result) { Dictionary <string, object> properties = CommonCAS.GetPSObjectProperties(folderPermission); folderPermissions.Add(new CPOAjaxMailboxFolderPermission() { User = properties["User"].ToString(), AccessRights = properties["AccessRights"].ToString() }); } } return(new JavaScriptSerializer().Serialize(folderPermissions)); } catch (Exception exc) { return(new JsonException(exc).ToString()); } }
public string CPORemoveCalendarPermissions(string organization, string userprincipalname, string user) { try { string[] users = new JavaScriptSerializer().Deserialize <string[]>(user); using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.RemoveCalendarPermissions(organization, userprincipalname, users).Invoke(); } return("[]"); } catch (Exception exc) { return(new JsonException(exc).ToString()); } //return "Org: " + organization + ", Id: " + identity + ", User: "******" & ", new JavaScriptSerializer().Deserialize<string[]>(user)); }
// Ajax function - returns the current mailforward set on a mailbox public string CPOGetMailforward(string organization, string userprincipalname) { try { using (CPOMyPowerShell ps = new CPOMyPowerShell()) { ps.GetMailforward(organization, userprincipalname); PSObject result = ps.Invoke().Single(); return(new JavaScriptSerializer().Serialize(new AjaxMailForward() { Organization = result.Members["Organization"].Value.ToString(), UserPrincipalName = result.Members["UserPrincipalName"].Value.ToString(), Name = result.Members["Name"].Value.ToString(), ForwardingAddress = result.Members["ForwardingAddress"].Value.ToString(), DeliverToMailboxAndForward = bool.Parse(result.Members["DeliverToMailboxAndForward"].Value.ToString()) })); } } catch (Exception exc) { return(new JsonException(exc).ToString()); } }