1

I have a need to get the user value from a layer properties.

The value is from: Layer Properties -> Source -> user in Data Source (sorry not enough score to attach the picture).

I tried to check the ILayerProperties, but haven't found the method related to the user value.

Anybody has the experience?

  • What is the data source? If I load a shapefile I do not see a "user" property in the data source of layer in ArcMap. – Hornbydd Jun 22 '15 at 10:53
  • Hi Hornbydd, the data is from ArcSDE geodatabase, thanks. – Maple Li Jun 23 '15 at 3:33
3

I think you are asking for the username of a layer's SDE connection. You need to use IWorkspace and IPropertySet. Something like this:

Dim pDataset As IDataset = the feature layer/raster layer you want the user name of
Dim pWorkspace As IWorkspace = pDataset.Workspace
Dim pPropertySet As IPropertySet = pWorkspace.ConnectionProperties
Dim userName As String = pPropertySet.GetProperty("USER")

IPropertySet essentially gives you a dictionary of the properties and their values. If you need to get all the properties or all the values you can put them into arrays:

Dim propertyNames() = Nothing
Dim propertyValues() = Nothing
pPropertySet.GetAllProperties(propertyNames, propertyValues)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.