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– Hornbydd2015年06月22日 10:53:04 +00:00Commented Jun 22, 2015 at 10:53
-
Hi Hornbydd, the data is from ArcSDE geodatabase, thanks.Maple Li– Maple Li2015年06月23日 03:33:44 +00:00Commented Jun 23, 2015 at 3:33
1 Answer 1
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)
Explore related questions
See similar questions with these tags.