Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

ListUserGroup

Posted on February 21, 2013October 26, 2015 By David Kittell
public static string ListUserGroup(int userID)
            {
                string UsersGroups = "";
                if (userID != 0)
                {
                    Ektron.Cms.API.Common CommonApi = new Ektron.Cms.API.Common();
                    Ektron.Cms.API.User.User UserAPI = new Ektron.Cms.API.User.User();
                    Ektron.Cms.GroupData GroupData = new Ektron.Cms.GroupData();
                    //Number of Provider(" + System.Convert.ToString(UserAPI.GetUserGroupByName("Provider").GroupId) + ") Users: " + System.Convert.ToString(UserAPI.GetUserGroupByName("Provider").UserCount);

                    Ektron.Cms.GroupData[] gData = UserAPI.GetGroupsUserIsIn(UserAPI.UserId, "GroupID");
                    foreach (Ektron.Cms.GroupData g in gData)
                    {
                        UsersGroups += g.GroupId + "',";
                    }
                }
                return UsersGroups;
            }
using Ektron.Cms;
using Ektron.Cms.API;
using Ektron.Cms.Common;
using Ektron.Cms.Framework.Content;
using Ektron.Cms.Framework.User;

protected void Page_Load(object sender, EventArgs e)
	{
#region Get User Details
		Ektron.Cms.CommonApi appAPI = new Ektron.Cms.CommonApi();
		if (appAPI.UserId != 0)
		{
			string UserDetails = "";
			Ektron.Cms.API.User.User UserAPI = new Ektron.Cms.API.User.User();

			UserManager Usermanager = new UserManager();
			long UserId = UserAPI.UserId;
			UserData Userdata = Usermanager.GetItem(UserId);
			if (Userdata != null)
			{
				UserDetails += "<br/><strong>UserName:</strong> " + Userdata.Username;
				UserDetails += "<br/><strong>User's Name:</strong> " + Userdata.FirstName + " " + Userdata.LastName;
				UserDetails += "<br/><strong>User's Email:</strong> " + Userdata.Email;

			}

			UserDetails += "<br/><strong>User Groups:</strong> " + ListUserGroupNames(unchecked((int)UserId));

			//"<br/><strong>Username:</strong> " + LoginHelper.UserName()
			Response.Write(UserDetails);
		}
		#endregion Get User Details
	}
 public static string ListUserGroupNames(int userID)
	{
		string UsersGroups = "";
		if (userID != 0)
		{
			Ektron.Cms.API.Common CommonApi = new Ektron.Cms.API.Common();
			Ektron.Cms.API.User.User UserAPI = new Ektron.Cms.API.User.User();
			Ektron.Cms.GroupData GroupData = new Ektron.Cms.GroupData();
			//Number of Provider(" + System.Convert.ToString(UserAPI.GetUserGroupByName("Provider").GroupId) + ") Users: " + System.Convert.ToString(UserAPI.GetUserGroupByName("Provider").UserCount);

			Ektron.Cms.GroupData[] gData = UserAPI.GetGroupsUserIsIn(UserAPI.UserId, "GroupName");
			foreach (Ektron.Cms.GroupData g in gData)
			{
				UsersGroups += g.GroupName + "',";
			}
		}
		return UsersGroups;
	}
Originally Posted on February 21, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

C# Ektron Code Ektron

Post navigation

Previous post
Next post

Related Posts

Ektron DMS File List

Posted on February 3, 2015October 26, 2015

Following my code on Ektron – DMS Content List I created this Ektron Widget <%@ Control Language="C#" AutoEventWireup="true" CodeFile="DMSFileList.aspx.cs" Inherits="widgets_DMSFileList" Debug="true" %> <asp:MultiView ID="ViewSet" runat="server" ActiveViewIndex="0"> <asp:View ID="View" runat="server"> <asp:Label runat="server" ID="lblDMSList">DMS Files</asp:Label> <asp:ListView ID="lvDMSList" runat="server" ItemPlaceholderID="aspItemPlaceholder" Visible="false"> <EmptyDataTemplate> <asp:Literal ID="litEmptyDataBasic" runat="server" Text="text" OnInit="litEmptyData_Init" /> </EmptyDataTemplate> <LayoutTemplate> <div class="form" style="max-width:…

Read More

Execute SQL

Posted on April 20, 2015October 26, 2015

protected void ExecuteNonQuery(string sql) { SqlConnection sqlConn = new SqlConnection(); try { string connString = ConfigurationManager.ConnectionStrings["DbConnection"].ToString(); sqlConn.ConnectionString = connString; sqlConn.Open(); SqlCommand sqlCommand = new SqlCommand(sql, sqlConn); sqlCommand.ExecuteNonQuery(); } catch(Exception ex) { labelSuccess.Text = ex.Message; } finally { if(sqlConn.State == System.Data.ConnectionState.Open) { sqlConn.Close(); } } } Originally Posted on April 20,…

Read More

ProgressBar Control

Posted on September 18, 2013October 26, 2015

Imports System Imports System.Collections Imports System.Data Imports System.Drawing Imports System.Windows.Forms Imports System.ComponentModel Imports System.Drawing.Drawing2D Imports System.IO Public Class MainClass Shared Sub Main() Dim form1 As Form = New Form1 Application.Run(form1) End Sub End Class Public Class Progress Inherits System.Windows.Forms.UserControl #Region " Windows Form Designer generated code " Public Sub New()…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes
 

Loading Comments...
 

You must be logged in to post a comment.