<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Sql database query to display all users and emails in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144992#M38461</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I was just wondering if anyone know how to get an sql query to return all users and their emails i have a query that shows all users just nee to edit it to show all email address also.&lt;/P&gt;&lt;PRE&gt;SELECT n.id,

n.uuid,

p1.string_value AS "Username"

FROM alf_node AS n,

alf_qname AS q,

alf_node_properties AS p1,

alf_node_properties AS p2

WHERE n.type_qname_id=q.id

AND n.id=p1.node_id

AND p1.node_id=p2.node_id

AND p1.string_value!=''

AND

((

q.local_name='person'

AND

p1.qname_id IN (SELECT id FROM alf_qname WHERE local_name='userName')

) OR (

q.local_name='user'

AND

p1.qname_id IN (SELECT id FROM alf_qname WHERE local_name='username')

)) AND

p2.qname_id IN (SELECT id FROM alf_qname WHERE local_name='enabled')

ORDER BY p1.string_value;&lt;/PRE&gt;</description>
    <pubDate>Tue, 28 Sep 2021 11:17:02 GMT</pubDate>
    <dc:creator>wshomeworker10</dc:creator>
    <dc:date>2021-09-28T11:17:02Z</dc:date>
    <item>
      <title>Sql database query to display all users and emails</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144992#M38461</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I was just wondering if anyone know how to get an sql query to return all users and their emails i have a query that shows all users just nee to edit it to show all email address also.&lt;/P&gt;&lt;PRE&gt;SELECT n.id,

n.uuid,

p1.string_value AS "Username"

FROM alf_node AS n,

alf_qname AS q,

alf_node_properties AS p1,

alf_node_properties AS p2

WHERE n.type_qname_id=q.id

AND n.id=p1.node_id

AND p1.node_id=p2.node_id

AND p1.string_value!=''

AND

((

q.local_name='person'

AND

p1.qname_id IN (SELECT id FROM alf_qname WHERE local_name='userName')

) OR (

q.local_name='user'

AND

p1.qname_id IN (SELECT id FROM alf_qname WHERE local_name='username')

)) AND

p2.qname_id IN (SELECT id FROM alf_qname WHERE local_name='enabled')

ORDER BY p1.string_value;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Sep 2021 11:17:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144992#M38461</guid>
      <dc:creator>wshomeworker10</dc:creator>
      <dc:date>2021-09-28T11:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sql database query to display all users and emails</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144993#M38462</link>
      <description>&lt;P&gt;Why don't you use the REST Apis:&lt;/P&gt;
&lt;P&gt;V1 rest api: &lt;CODE&gt;&lt;A href="http://localhost:8080/alfresco/api/people" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/api/people&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;V2 rest api:&amp;nbsp;&lt;A href="https://docs.alfresco.com/content-services/6.2/develop/rest-api-guide/people-groups/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/content-services/6.2/develop/rest-api-guide/people-groups/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;GET - &lt;A href="http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/people" target="_blank" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/people&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;$ curl -X GET -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/people' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1686  100  1686    0     0   4052      0 --:--:-- --:--:-- --:--:--  4052
{
  "list": {
    "pagination": {
      "count": 4,
      "hasMoreItems": false,
      "totalItems": 4,
      "skipCount": 0,
      "maxItems": 100
    },
    "entries": [
      {
        "entry": {
          "lastName": "Beecher",
          "userStatus": "Helping to design the look and feel of the new web site",
          "jobTitle": "Graphic Designer",
          "statusUpdatedAt": "2011-02-15T20:20:13.432+0000",
          "mobile": "0112211001100",
          "emailNotificationsEnabled": true,
          "description": "Alice is a demo user for the sample Alfresco Team site.",
          "telephone": "0112211001100",
          "enabled": false,
          "firstName": "Alice",
          "skypeId": "abeecher",
          "avatarId": "198500fc-1e99-4f5f-8926-248cea433366",
          "location": "Tilbury, UK",
          "company": {
            "organization": "Moresby, Garland and Wedge",
            "address1": "200 Butterwick Street",
            "address2": "Tilbury",
            "address3": "UK",
            "postcode": "ALF1 SAM1"
          },
          "id": "abeecher",
          "email": "abeecher@example.com"
        }
      },
      {
        "entry": {
          "firstName": "Administrator",
          "emailNotificationsEnabled": true,
          "company": {},
          "id": "admin",
          "enabled": true,
          "email": "admin@alfresco.com"
        }
      },
      {
        "entry": {
          "firstName": "Guest",
          "emailNotificationsEnabled": true,
          "company": {},
          "id": "guest",
          "enabled": false
        }
      },
      {
        "entry": {
          "lastName": "Jackson",
          "userStatus": "Working on a new web design for the corporate site",
          "jobTitle": "Web Site Manager",
          "statusUpdatedAt": "2011-02-15T20:13:09.649+0000",
          "mobile": "012211331100",
          "emailNotificationsEnabled": true,
          "description": "Mike is a demo user for the sample Alfresco Team site.",
          "telephone": "012211331100",
          "enabled": false,
          "firstName": "Mike",
          "skypeId": "mjackson",
          "avatarId": "3fbde500-298b-4e80-ae50-e65a5cbc2c4d",
          "location": "Threepwood, UK",
          "company": {
            "organization": "Green Energy",
            "address1": "100 Cavendish Street",
            "address2": "Threepwood",
            "address3": "UK",
            "postcode": "ALF1 SAM1"
          },
          "id": "mjackson",
          "email": "mjackson@example.com"
        }
      }
    ]
  }
}
&lt;/PRE&gt;
&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:14:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144993#M38462</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2021-09-28T15:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sql database query to display all users and emails</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144994#M38463</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Just check the following projects, they are using rest api (v1):&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/ecm4u/alfresco-shell-tools/blob/master/bin/alfListUsers.sh" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/ecm4u/alfresco-shell-tools/blob/master/bin/alfListUsers.sh&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or this:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/zylklab/alfresco-export-scripts#getpeoplesh" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/zylklab/alfresco-export-scripts#getpeoplesh&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;--C.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 08:54:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144994#M38463</guid>
      <dc:creator>cesarista</dc:creator>
      <dc:date>2021-09-30T08:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sql database query to display all users and emails</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144995#M38464</link>
      <description>&lt;P&gt;If you really need that as database sql query this should do the job:&lt;/P&gt;&lt;PRE&gt;SELECT 
    n.id AS node_id
    , concat(s.protocol,'://',s.identifier,'/', n.uuid) AS node_ref
    , np1.string_value AS username
    , np2.string_value AS email
FROM alf_node n
JOIN alf_store s ON (n.store_id=s.id)
-- filter on type person
JOIN alf_qname qn ON (n.type_qname_id=qn.id AND qn.local_name='person' 
    AND ns_id=(SELECT id FROM alf_namespace WHERE uri='http://www.alfresco.org/model/content/1.0')
 )
-- join property userName
left JOIN alf_node_properties np1 ON (n.id=np1.node_id 
    AND np1.qname_id =(SELECT id FROM alf_qname WHERE local_name='userName'
        AND ns_id=(SELECT id FROM alf_namespace WHERE uri='http://www.alfresco.org/model/content/1.0')
        )
    )
-- join property email
left JOIN alf_node_properties np2 ON (n.id=np2.node_id 
    AND np2.qname_id =(SELECT id FROM alf_qname WHERE local_name='email'
        AND ns_id=(SELECT id FROM alf_namespace WHERE uri='http://www.alfresco.org/model/content/1.0')
        )
    )&lt;BR /&gt;ORDER BY np1.string_value;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Oct 2021 18:44:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/sql-database-query-to-display-all-users-and-emails/m-p/144995#M38464</guid>
      <dc:creator>heiko_robert</dc:creator>
      <dc:date>2021-10-01T18:44:34Z</dc:date>
    </item>
  </channel>
</rss>

