<?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: Update custom properties of Users in QMC through API in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2463801#M20780</link>
    <description>&lt;P&gt;It might be possible, but I'm not sure it's recommended. Working with REST APIs like that through the Qlik scripts is quite cumbersome. Perhaps you could find a way to do this through the APIs outside of Qlik Sense? There's much better support for doing this if you use something like JavaScript or C#. Or curl for that matter.&lt;/P&gt;
&lt;P&gt;But if you want to see if you can build this in a Qlik script then this link might be of interest: &lt;A href="https://community.qlik.com/t5/Design/REST-connector-Using-WITH-CONNECTION/ba-p/1523257" target="_blank"&gt;https://community.qlik.com/t5/Design/REST-connector-Using-WITH-CONNECTION/ba-p/1523257&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2024 10:26:35 GMT</pubDate>
    <dc:creator>Øystein_Kolsrud</dc:creator>
    <dc:date>2024-06-19T10:26:35Z</dc:date>
    <item>
      <title>Update custom properties of Users in QMC through API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2463766#M20779</link>
      <description>&lt;P&gt;Hi, is there any way to update custom properties of QMC/Users from Qlik script or though any Qlik code using REST connectors. Any help on this, as I need to automate the process of providing user access through script and not manually from QMC.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 09:25:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2463766#M20779</guid>
      <dc:creator>AV1</dc:creator>
      <dc:date>2024-06-19T09:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Update custom properties of Users in QMC through API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2463801#M20780</link>
      <description>&lt;P&gt;It might be possible, but I'm not sure it's recommended. Working with REST APIs like that through the Qlik scripts is quite cumbersome. Perhaps you could find a way to do this through the APIs outside of Qlik Sense? There's much better support for doing this if you use something like JavaScript or C#. Or curl for that matter.&lt;/P&gt;
&lt;P&gt;But if you want to see if you can build this in a Qlik script then this link might be of interest: &lt;A href="https://community.qlik.com/t5/Design/REST-connector-Using-WITH-CONNECTION/ba-p/1523257" target="_blank"&gt;https://community.qlik.com/t5/Design/REST-connector-Using-WITH-CONNECTION/ba-p/1523257&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 10:26:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2463801#M20780</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2024-06-19T10:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Update custom properties of Users in QMC through API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2463826#M20782</link>
      <description>&lt;P&gt;As&amp;nbsp;O&lt;SPAN&gt;ystein mentioned it is easier to make such changes outside Qlik script.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The other issue is that in order to update User (this includes changes in the assigned custom properties) you'll have to make PUT request (&lt;A href="https://help.qlik.com/en-US/sense-developer/May2024/APIs/RepositoryServiceAPI/index.html?page=280" target="_self"&gt;API reference&lt;/A&gt;). And the native Qlik rest connector supports only GET and POST requests.&lt;/P&gt;
&lt;P&gt;For such scenario I had to build small web service that accepts POST requests, "converts" them to PUT requests and then calling Qlik API to update the users. And from Qlik script i was calling the web service.&lt;/P&gt;
&lt;P&gt;Stefan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 11:27:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2463826#M20782</guid>
      <dc:creator>stefanstoichev123</dc:creator>
      <dc:date>2024-06-19T11:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Update custom properties of Users in QMC through API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2465655#M20805</link>
      <description>&lt;P&gt;The following code will work,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Custom Property must exist in the environment, and the value you are setting must be one of the available choice values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Function Get-ServicePath($Name) {
    # Find the repository service
    $WinService = Get-WmiObject win32_service | Where-Object { $_.Name -eq $Name } | Select-Object Name, DisplayName, State, PathName
    [regex]$EXEPath = '(\\\\|\w:)(.+)(\..{3})'
    if ($WinService.PathName -match $EXEPath) { [System.IO.FileInfo]$WinServicePath = $Matches[0] }
    $WinService | Add-Member -MemberType NoteProperty -Name Path -Value $WinServicePath
    $WinService
}

# Dynamically locate the Install Directory
$RepositoryService = Get-ServicePath -Name 'QlikSenseRepositoryService'
[System.IO.DirectoryInfo]$InstallDIR = $RepositoryService.Path.Directory.Parent.FullName

# Import the Module
Import-Module "$($InstallDIR.FullName)\Tools\QlikSenseCLI"

# Connect to Qlik Sense
Connect-QlikSense -TrustAllCertificates

#Name of the Custom Property
$CPName = 'UserCP'

# Filter always returns an Array, so we need to select the first one
$QSCustomPropertyDefinition = $(Get-QSCustompropertydefinition -Filter "Name eq '$($CPName)'") | Select-Object -First 1

# We need the Full Object to do a update
$SelectedQSUsers = Get-QSUser -Filter "UserID eq 'Marc'" -Full

foreach($user in $SelectedQSUsers){
    
    # Create the New Custom Property Value we are going to add (the value needs to be one of the possible values in the Custom Property Definition)
    $newCPValue = New-QSCustomPropertyValue -Definition $QSCustomPropertyDefinition -Value "Value1"
    $user.CustomProperties.Add($newCPValue)
    Update-QSUser -Id $user.Id -UserObj $user
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 10:05:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Update-custom-properties-of-Users-in-QMC-through-API/m-p/2465655#M20805</guid>
      <dc:creator>Marc</dc:creator>
      <dc:date>2024-06-26T10:05:36Z</dc:date>
    </item>
  </channel>
</rss>

