ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Aide
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plateforme cartographique de votre organisation

ArcGIS Desktop

Un SIG professionnel complet

ArcGIS Enterprise

SIG dans votre entreprise

ArcGIS for Developers

Outils de création d'applications de localisation

ArcGIS Solutions

Modèles d'applications et de cartes gratuits pour votre secteur d'activité

ArcGIS Marketplace

Téléchargez des applications et des données pour votre organisation.

  • Documentation
  • Support
Esri
  • Se connecter
user
  • Mon profil
  • Déconnexion

ArcMap

  • Accueil
  • Commencer
  • Carte
  • Analyser
  • Gérer les données
  • Outils
  • Extensions

ListUsers

  • Résumé
  • Discussion
  • Syntaxe
  • Exemple de code

Résumé

Returns a list of named tuples containing information for users who are connected to an enterprise geodatabase.

Discussion

The ListUsers function is used by an administrative user to identify users who are currently connected to an enterprise geodatabase.

  • The ListUsers function must utilize an administrative connection to the database.
  • This function will fail if attempted by a nonadministrative user.

Syntaxe

ListUsers (sde_workspace)
ParamètreExplicationType de données
sde_workspace

An enterprise geodatabase (sde connection file).

The connection properties specified in the enterprise geodatabase must have administrative rights that allow the user to disconnect other connections.

String

Valeur renvoyée

Type de donnéesExplication
tuple

The ListUsers function returns a list of named tuples. The named tuples returned each have the following five items:

NameDatatypeDescription

ClientName

String

Name of the client machine from where the connection is being made.

ConnectionTime

Datetime

The time when the user made the initial connection to the geodatabase.

ID

Integer

The SDE connection identifier. This is the value that can be used in the DisconnectUser function to identify the user to disconnect.

IsDirectConnection

Boolean

True if the connection is a direct connection (two-tier). False if the connection is an application server connection (three-tier).

Name

String

The name of the user who is connected to the database.

Exemple de code

ListUsers example 1
import arcpy

arcpy.ListUsers("Database Connections/admin.sde")
ListUsers example 2

The following example demonstrates how to print a list of connected users along with their connection time.

import arcpy

users = arcpy.ListUsers("Database Connections/admin.sde")
for user in users:
    print("Username: {0}, Connected at: {1}".format(
        user.Name, user.ConnectionTime))
ListUsers example 3

The following example demonstrates how to generate a new list of only SDE IDs from the list returned by ListUsers.

import arcpy

# Set the admistrative workspace connection
arcpy.env.workspace = "Database Connections/tenone@sde.sde"

# Create a list of users
'''
NOTE: When the arcpy.env.workspace environment is set, a workspace
does not need to be provided to the function.
'''
users = arcpy.ListUsers()

# Create a list of SDE ID's.
# Use a list comprehension to get the ID values in a new list.
id_users = [user.ID for user in users]
print(id_users)

Rubriques connexes

  • AcceptConnections
  • DisconnectUser

ArcGIS Desktop

  • Accueil
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

A propos d'Esri

  • A propos de la société
  • Carrières
  • Blog des initiés
  • Conférence des utilisateurs
  • Sommet des développeurs
Esri
Donnez-nous votre avis.
Copyright © 2018 Esri. | Confidentialité | Légal