public EmailExport(Uri APIUrl)
 {
     try
     {
         EndpointAddress endpoint = new EndpointAddress(APIUrl.ToString() + WSDL_LOCATION);
         client = new InvitationManagementServiceClient("BasicHttpBinding_IInvitationManagementService", endpoint);
     }
     catch (Exception e)
     {
         Console.WriteLine("Invalid URL");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a user to an email list panel's access list with the specified permissions.  If the user is already
        /// on the access list, the user's permissions will be updated to match the passed-in permissions.
        /// </summary>
        /// <param name="authenticationToken">Authentication ticket identifying calling user.</param>
        /// <param name="emailListId">ID of the email list panel.</param>
        /// <param name="uniqueIdentifier">Unique identifier of the user to add to the access list.</param>
        /// <param name="permissions">Permissions to set on the access list for the user.</param>
        private static bool AddUserToEmailListPanelAccessList(string authenticationToken, int emailListId, string uniqueIdentifier, string[] permissions)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.AddUserToEmailListPanelAccessList(authenticationToken, emailListId, uniqueIdentifier, permissions);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return false;
            }

            return true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add the specified email addresses to an email list panel.
        /// </summary>
        /// <param name="authenticationToken"></param>
        /// <param name="emailListId">ID of the panel to add addresses to</param>
        /// <param name="emailAddresses">Addresses to add to the panel.</param>
        private static bool AddEmailAddressesToEmailListPanel(string authenticationToken, int emailListId, string[] emailAddresses)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.AddEmailAddressesToEmailListPanel(authenticationToken, emailListId, emailAddresses);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return false;
            }

            return true;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a new email list.
        /// </summary>
        /// <param name="authenticationToken"></param>
        /// <param name="id"></param>
        /// <param name="languageCode"></param>
        /// <returns></returns>
        private static int CopyEmailListPanel(string authenticationToken, int id, string languageCode = "en-US")
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.CopyEmailListPanel(authenticationToken, id, languageCode);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return -1;
            }

            return result.ResultData;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Retrieve the authentication token required to make web service requests.
        /// </summary>
        /// <param name="username">The name of the user to authenticate.</param>
        /// <param name="password">The user's password.</param>
        /// <returns></returns>
        private static string AuthenticateUser(string username, string password)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.AuthenticateUser(username, password);

            return result.ResultData;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Set the default policy permissions for an email list panel.
        /// </summary>
        /// <param name="authenticationToken">Authentication ticket identifying calling user.</param>
        /// <param name="emailListId">ID of the email list panel to set default policy permissions for.</param>
        /// <param name="permissions">Permissions to set on the default policy.</param>
        private static bool SetEmailListPanelDefaultPolicyPermissions(string authenticationToken, int emailListId, string[] permissions)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.SetEmailListPanelDefaultPolicyPermissions(authenticationToken, emailListId, permissions);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return false;
            }

            return true;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Remove a user group from an email list panel's access list.
        /// </summary>
        /// <param name="authenticationToken">Authentication ticket identifying calling user.</param>
        /// <param name="emailListId">ID of the email list panel.</param>
        /// <param name="userGroupId">ID of the user group to remove a user from.</param>
        private static bool RemoveGroupFromEmailListPanelAccessList(string authenticationToken, int emailListId, int userGroupId)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.RemoveGroupFromEmailListPanelAccessList(authenticationToken, emailListId, userGroupId);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return false;
            }

            return true;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Get a list of email
        /// </summary>
        /// <param name="authenticationToken"></param>
        /// <param name="permission">Permission to check for on the email lists.</param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortField"></param>
        /// <param name="sortAscending"></param>
        /// <param name="filterField"></param>
        /// <param name="filterValue"></param>
        /// <returns>List of email list panel info objects for the panels.</returns>
        private static IEnumerable<EmailListPanelData> ListEmailPanels(string authenticationToken, 
                                                            string permission,
                                                            int pageNumber = 0,
                                                            int pageSize = 0,
                                                            string sortField = "",
                                                            bool sortAscending = true,
                                                            string filterField = "",
                                                            string filterValue = "")
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.ListEmailPanels(authenticationToken, permission, pageNumber, pageSize, sortField, sortAscending, filterField, filterValue);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return null;
            }

            return result.ResultData.ResultPage;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Get a list of permissions set on the default policy of an email list panel.
        /// </summary>
        /// <param name="authenticationToken">Authentication ticket identifying calling user.</param>
        /// <param name="emailListId">ID of the email list panel to get the default policy permissions for.</param>
        /// <returns>List of permissions on the email list panel's default policy.</returns>
        private static string[] ListEmailListPanelDefaultPolicyPermissions(string authenticationToken, int emailListId)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.ListEmailListPanelDefaultPolicyPermissions(authenticationToken, emailListId);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return null;
            }

            return result.ResultData;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// List the email addresses contained in an email list panel.
        /// </summary>
        /// <param name="authenticationToken">Authentication ticket identifying calling user.</param>
        /// <param name="emailListId">ID of the email list panel.</param>
        /// <returns>List of email addresses in the panel.</returns>
        private static IEnumerable<string> ListEmailListPanelAddresses(string authenticationToken, int emailListId)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.ListEmailListPanelAddresses(authenticationToken, emailListId, -1, -1);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return null;
            }

            return result.ResultData.ResultPage;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// List the ACL permissions that a given user has on an email list panel.
        /// </summary>
        /// <param name="authenticationToken">Authentication ticket identifying calling user.</param>
        /// <param name="emailListId">ID of the email list panel.</param>
        /// <param name="uniqueIdentifier">Unique identifier of the user get the permissions list for.</param>
        private static IEnumerable<string> ListEmailListPanelAccessListPermissionsForUser(string authenticationToken, int emailListId, string uniqueIdentifier)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.ListEmailListPanelAccessListPermissionsForUser(authenticationToken, emailListId, uniqueIdentifier);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return null;
            }

            return result.ResultData;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Get a lightweight information object for the specified email list panel.
        /// </summary>
        /// <param name="authenticationToken">Authentication ticket identifying calling user.</param>
        /// <param name="id">ID of the email list panel to get.</param>
        private static EmailListPanelData GetEmailListPanelInfo(string authenticationToken, int id)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.GetEmailListPanelInfo(authenticationToken, id);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return null;
            }

            return result.ResultData;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Create a new email list.
        /// </summary>
        /// <param name="authenticationToken"></param>
        /// <param name="name">The name of the email list.</param>
        /// <param name="description">The new email list's description.</param>
        /// <returns></returns>
        private static int CreateEmailList(string authenticationToken, string name, string description)
        {
            var proxy = new InvitationManagementServiceClient();
            var result = proxy.CreateEmailListPanel(authenticationToken, name, description);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return -1;
            }

            return result.ResultData.DatabaseId;
        }