<?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 Re: import email from AD group in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282022#M401931</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hahahaha that is amusing, I did choose a rather silly name!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the content for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 10px; color: #798a9b; font-family: Roboto, sans-serif; font-size: 14px;"&gt;The code is pretty straight forward when you think about it. Obviously the first thing to do is to add a linked server if you haven’t already. This doesn’t require any changes to run&lt;/P&gt;&lt;TABLE style="margin: 0 !important; border: none !important; padding: 0 !important;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="code" style="background-color: #eeeeee; padding: 0 !important; border: none !important;"&gt;&lt;PRE class="sql" style="font-family: monospace; color: #333333; font-size: 12px !important; padding: 0 4px !important; margin: 0 !important; background: transparent !important;"&gt;&lt;SPAN style="color: #993333; font-weight: bold;"&gt;EXEC&lt;/SPAN&gt; sp_Addlinkedserver @server&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt; N&lt;SPAN style="color: #ff0000;"&gt;'ADSI'&lt;/SPAN&gt;&lt;SPAN style="color: #66cc66;"&gt;,&lt;/SPAN&gt; @srvproduct&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt;N&lt;SPAN style="color: #ff0000;"&gt;'Active Directory Service Interfaces'&lt;/SPAN&gt;&lt;SPAN style="color: #66cc66;"&gt;,&lt;/SPAN&gt; @provider&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt;N&lt;SPAN style="color: #ff0000;"&gt;'ADSDSOObject'&lt;/SPAN&gt;&lt;SPAN style="color: #66cc66;"&gt;,&lt;/SPAN&gt; @datasrc&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt;N&lt;SPAN style="color: #ff0000;"&gt;'adsdatasource'&lt;/SPAN&gt; &lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 10px; color: #798a9b; font-family: Roboto, sans-serif; font-size: 14px;"&gt;Then you can set up a really quite straight forward cursor to load the data into a table. The reason we need the cursor is we can only query one AD group at a time.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14894957816436466" jivemacro_uid="_14894957816436466"&gt;
&lt;P&gt;--create procedure test.ad_qlik_groups_Test as&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IF OBJECT_ID('tempdb.dbo.#tblqlikgroups', 'U') IS NOT NULL DROP TABLE #tblqlikgroups; &lt;/P&gt;
&lt;P&gt;IF OBJECT_ID('tempdb.dbo.#test', 'U') IS NOT NULL DROP TABLE #test; &lt;/P&gt;
&lt;P&gt;IF OBJECT_ID('dbo.active_directory_qlikview_users_and_groups', 'U') IS NOT NULL TRUNCATE TABLE active_directory_qlikview_users_and_groups;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--get list of AD groups for Qlik&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;SELECT &lt;/P&gt;
&lt;P&gt;REPLACE(ADsPath,'LDAP://','') AS groupPath ,&lt;/P&gt;
&lt;P&gt;LEFT(REPLACE(ADsPath,'LDAP://CN=',''), charindex(',', REPLACE(ADsPath,'LDAP://CN=','')) - 1) AS groupname&lt;/P&gt;
&lt;P&gt;INTO #tblqlikgroups&lt;/P&gt;
&lt;P&gt;FROM OpenQuery ( &lt;/P&gt;
&lt;P&gt; ADSI, &lt;/P&gt;
&lt;P&gt; 'SELECT displayname,&lt;/P&gt;
&lt;P&gt; samAccountName, &lt;/P&gt;
&lt;P&gt; whenCreated ,&lt;/P&gt;
&lt;P&gt; ADsPath &lt;/P&gt;
&lt;P&gt; FROM ''LDAP://DC=yourdomain,DC=co,dc=uk'' &lt;/P&gt;
&lt;P&gt; WHERE objectClass = ''Group'' &lt;/P&gt;
&lt;P&gt; ') AS tblADSI&lt;/P&gt;
&lt;P&gt;WHERE samaccountname LIKE'%Qlik%' --this is where we tell the system what groups we want to call back&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;-- declare the variable to pass to the cursor&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DECLARE @grouppath VARCHAR(MAX), @groupname VARCHAR (MAX) &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt; -- declare the cursor and tell it what we want to use for our loop&lt;/P&gt;
&lt;P&gt; DECLARE active_directory_users_and_groups cursor FOR&lt;/P&gt;
&lt;P&gt; SELECT grouppath, groupname &lt;/P&gt;
&lt;P&gt; FROM #tblqlikgroups&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--open the cursor and find the first row&lt;/P&gt;
&lt;P&gt; OPEN active_directory_users_and_groups &lt;/P&gt;
&lt;P&gt; fetch NEXT FROM active_directory_users_and_groups INTO @grouppath, @groupname&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--now just loop through until there are no more items to fetch from the table&lt;/P&gt;
&lt;P&gt; while @@FETCH_STATUS = 0&lt;/P&gt;
&lt;P&gt; BEGIN &lt;/P&gt;
&lt;P&gt; DECLARE @q VARCHAR(MAX)&lt;/P&gt;
&lt;P&gt; SET @q='INSERT into active_directory_qlikview_users_and_groups &lt;/P&gt;
&lt;P&gt; SELECT DISTINCT '''+@groupname+''' as groupName, displayname, samAccountName,lastLogon,mail&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt; FROM OpenQuery ( &lt;/P&gt;
&lt;P&gt; ADSI, &lt;/P&gt;
&lt;P&gt; ''SELECT displayName,&lt;/P&gt;
&lt;P&gt; samAccountName,&lt;/P&gt;
&lt;P&gt; lastLogon ,&lt;/P&gt;
&lt;P&gt; whenCreated,&lt;/P&gt;
&lt;P&gt; mail&lt;/P&gt;
&lt;P&gt; FROM ''''LDAP://DC=yourdomain,DC=co,dc=uk'''' &lt;/P&gt;
&lt;P&gt; WHERE objectClass = ''''Person'''' and memberOf='''''+@grouppath+'''''&lt;/P&gt;
&lt;P&gt; '') AS tblADSI '&lt;/P&gt;
&lt;P&gt;--print (@q) --use this to test the code, comment out when executing&lt;/P&gt;
&lt;P&gt;EXEC(@q)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;fetch NEXT FROM active_directory_users_and_groups INTO @grouppath, @groupname&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;END&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--close and deallocate the cursor&lt;/P&gt;
&lt;P&gt;close active_directory_users_and_groups&lt;/P&gt;
&lt;P&gt;deallocate active_directory_users_and_groups&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Mar 2017 12:48:45 GMT</pubDate>
    <dc:creator>adamdavi3s</dc:creator>
    <dc:date>2017-03-14T12:48:45Z</dc:date>
    <item>
      <title>import email from AD group</title>
      <link>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282018#M401927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do i import email, name from AD group, what kind of connection do i need. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/171708"&gt;stalwar1&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/178253"&gt;tamilarasu&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2017 22:40:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282018#M401927</guid>
      <dc:creator>everest226</dc:creator>
      <dc:date>2017-03-13T22:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: import email from AD group</title>
      <link>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282019#M401928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ujjwal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the delay in response. I haven't tried this personally, but the below link might be help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/50661"&gt;Connecting to and Querying Active Directory for Users&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2017 12:32:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282019#M401928</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2017-03-14T12:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: import email from AD group</title>
      <link>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282020#M401929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need to pull from multiple groups I wrote a little bit of code here, which you could easily adapt to Qlik using a loop.&lt;/P&gt;&lt;P&gt;We just happen to pull into SQL first (As we use it in other places)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://qlikanddirty.com/2016/08/25/querying-ldap-to-pull-back-people-in-ad-groups/" title="http://qlikanddirty.com/2016/08/25/querying-ldap-to-pull-back-people-in-ad-groups/"&gt;Querying LDAP to pull back people in AD groups – Qlik and Dirty&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2017 12:37:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282020#M401929</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2017-03-14T12:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: import email from AD group</title>
      <link>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282021#M401930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems like your website is restricted due to the name &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;. Anyway I'll go home and check in my laptop. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="156242" alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/156242_Capture.PNG" style="height: 113px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2017 12:47:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282021#M401930</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2017-03-14T12:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: import email from AD group</title>
      <link>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282022#M401931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hahahaha that is amusing, I did choose a rather silly name!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the content for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 10px; color: #798a9b; font-family: Roboto, sans-serif; font-size: 14px;"&gt;The code is pretty straight forward when you think about it. Obviously the first thing to do is to add a linked server if you haven’t already. This doesn’t require any changes to run&lt;/P&gt;&lt;TABLE style="margin: 0 !important; border: none !important; padding: 0 !important;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="code" style="background-color: #eeeeee; padding: 0 !important; border: none !important;"&gt;&lt;PRE class="sql" style="font-family: monospace; color: #333333; font-size: 12px !important; padding: 0 4px !important; margin: 0 !important; background: transparent !important;"&gt;&lt;SPAN style="color: #993333; font-weight: bold;"&gt;EXEC&lt;/SPAN&gt; sp_Addlinkedserver @server&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt; N&lt;SPAN style="color: #ff0000;"&gt;'ADSI'&lt;/SPAN&gt;&lt;SPAN style="color: #66cc66;"&gt;,&lt;/SPAN&gt; @srvproduct&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt;N&lt;SPAN style="color: #ff0000;"&gt;'Active Directory Service Interfaces'&lt;/SPAN&gt;&lt;SPAN style="color: #66cc66;"&gt;,&lt;/SPAN&gt; @provider&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt;N&lt;SPAN style="color: #ff0000;"&gt;'ADSDSOObject'&lt;/SPAN&gt;&lt;SPAN style="color: #66cc66;"&gt;,&lt;/SPAN&gt; @datasrc&lt;SPAN style="color: #66cc66;"&gt;=&lt;/SPAN&gt;N&lt;SPAN style="color: #ff0000;"&gt;'adsdatasource'&lt;/SPAN&gt; &lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 10px; color: #798a9b; font-family: Roboto, sans-serif; font-size: 14px;"&gt;Then you can set up a really quite straight forward cursor to load the data into a table. The reason we need the cursor is we can only query one AD group at a time.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14894957816436466" jivemacro_uid="_14894957816436466"&gt;
&lt;P&gt;--create procedure test.ad_qlik_groups_Test as&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IF OBJECT_ID('tempdb.dbo.#tblqlikgroups', 'U') IS NOT NULL DROP TABLE #tblqlikgroups; &lt;/P&gt;
&lt;P&gt;IF OBJECT_ID('tempdb.dbo.#test', 'U') IS NOT NULL DROP TABLE #test; &lt;/P&gt;
&lt;P&gt;IF OBJECT_ID('dbo.active_directory_qlikview_users_and_groups', 'U') IS NOT NULL TRUNCATE TABLE active_directory_qlikview_users_and_groups;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--get list of AD groups for Qlik&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;SELECT &lt;/P&gt;
&lt;P&gt;REPLACE(ADsPath,'LDAP://','') AS groupPath ,&lt;/P&gt;
&lt;P&gt;LEFT(REPLACE(ADsPath,'LDAP://CN=',''), charindex(',', REPLACE(ADsPath,'LDAP://CN=','')) - 1) AS groupname&lt;/P&gt;
&lt;P&gt;INTO #tblqlikgroups&lt;/P&gt;
&lt;P&gt;FROM OpenQuery ( &lt;/P&gt;
&lt;P&gt; ADSI, &lt;/P&gt;
&lt;P&gt; 'SELECT displayname,&lt;/P&gt;
&lt;P&gt; samAccountName, &lt;/P&gt;
&lt;P&gt; whenCreated ,&lt;/P&gt;
&lt;P&gt; ADsPath &lt;/P&gt;
&lt;P&gt; FROM ''LDAP://DC=yourdomain,DC=co,dc=uk'' &lt;/P&gt;
&lt;P&gt; WHERE objectClass = ''Group'' &lt;/P&gt;
&lt;P&gt; ') AS tblADSI&lt;/P&gt;
&lt;P&gt;WHERE samaccountname LIKE'%Qlik%' --this is where we tell the system what groups we want to call back&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;-- declare the variable to pass to the cursor&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DECLARE @grouppath VARCHAR(MAX), @groupname VARCHAR (MAX) &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt; -- declare the cursor and tell it what we want to use for our loop&lt;/P&gt;
&lt;P&gt; DECLARE active_directory_users_and_groups cursor FOR&lt;/P&gt;
&lt;P&gt; SELECT grouppath, groupname &lt;/P&gt;
&lt;P&gt; FROM #tblqlikgroups&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--open the cursor and find the first row&lt;/P&gt;
&lt;P&gt; OPEN active_directory_users_and_groups &lt;/P&gt;
&lt;P&gt; fetch NEXT FROM active_directory_users_and_groups INTO @grouppath, @groupname&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--now just loop through until there are no more items to fetch from the table&lt;/P&gt;
&lt;P&gt; while @@FETCH_STATUS = 0&lt;/P&gt;
&lt;P&gt; BEGIN &lt;/P&gt;
&lt;P&gt; DECLARE @q VARCHAR(MAX)&lt;/P&gt;
&lt;P&gt; SET @q='INSERT into active_directory_qlikview_users_and_groups &lt;/P&gt;
&lt;P&gt; SELECT DISTINCT '''+@groupname+''' as groupName, displayname, samAccountName,lastLogon,mail&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt; FROM OpenQuery ( &lt;/P&gt;
&lt;P&gt; ADSI, &lt;/P&gt;
&lt;P&gt; ''SELECT displayName,&lt;/P&gt;
&lt;P&gt; samAccountName,&lt;/P&gt;
&lt;P&gt; lastLogon ,&lt;/P&gt;
&lt;P&gt; whenCreated,&lt;/P&gt;
&lt;P&gt; mail&lt;/P&gt;
&lt;P&gt; FROM ''''LDAP://DC=yourdomain,DC=co,dc=uk'''' &lt;/P&gt;
&lt;P&gt; WHERE objectClass = ''''Person'''' and memberOf='''''+@grouppath+'''''&lt;/P&gt;
&lt;P&gt; '') AS tblADSI '&lt;/P&gt;
&lt;P&gt;--print (@q) --use this to test the code, comment out when executing&lt;/P&gt;
&lt;P&gt;EXEC(@q)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;fetch NEXT FROM active_directory_users_and_groups INTO @grouppath, @groupname&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;END&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;--close and deallocate the cursor&lt;/P&gt;
&lt;P&gt;close active_directory_users_and_groups&lt;/P&gt;
&lt;P&gt;deallocate active_directory_users_and_groups&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2017 12:48:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/import-email-from-AD-group/m-p/1282022#M401931</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2017-03-14T12:48:45Z</dc:date>
    </item>
  </channel>
</rss>

