Hi guys,
I know that if I can update a property like this:
If (User.Properties.Contains("test")) Then
User.Properties("test")(0) = "testing 1" 'Update it
Else 'It does not exist, so add it
User.Properties("test").Add("testing 2")
end if
However, If i add the values as multiple values,
e.g. User.Properties("test").AddRange(New Object() {"text 1", "text 2"})
how can i update it? First remove and then add? How to do so?
If you want to replace the values, you can either remove all the values and then add the new ones or more easily you can just use the .Value property and set it directly.
entry.Properties["someAttribute"].Value = new object[] {value1, value2};
If you want to replace the values, you can either remove all the values and then add the new ones or more easily you can just use the .Value property and set it directly.
entry.Properties["someAttribute"].Value = new object[] {value1, value2};
How would I delete a particular value with the multi valued attribute. I have done this in vbscript for ages but I started vb.net a couple of weeks ago and cant figure out.
I am using the accountNameHistory field of the computer object (want allowed to create a new one) to store information on build progress, so e.g. I want to write in start time as something like value(x) = "-st;" & now
If the value is already there I want to clear it first. In vbscript I was reading the whole attribute into a temp array and manipulating that and writing it back with PutEx, what is the best way in .net, has anyone got any sample code to put me out of
my misery?[:P]
None
0 Points
20 Posts
how to replace attribute values?
Jun 30, 2006 03:37 AM|yipchunyu|LINK
I know that if I can update a property like this:
If (User.Properties.Contains("test")) Then
User.Properties("test")(0) = "testing 1" 'Update it
Else 'It does not exist, so add it
User.Properties("test").Add("testing 2")
end if
However, If i add the values as multiple values,
e.g. User.Properties("test").AddRange(New Object() {"text 1", "text 2"})
how can i update it? First remove and then add? How to do so?
Member
135 Points
1801 Posts
Re: how to replace attribute values?
Jul 05, 2006 09:52 AM|dunnry|LINK
entry.Properties["someAttribute"].Value = new object[] {value1, value2};
Weblog
The Book
LDAP Programming Help
None
0 Points
20 Posts
Re: how to replace attribute values?
Jul 05, 2006 10:13 PM|yipchunyu|LINK
None
0 Points
1 Post
Re: how to replace attribute values?
Sep 15, 2006 03:49 PM|mikeyming|LINK
Thats cool!
How would I delete a particular value with the multi valued attribute. I have done this in vbscript for ages but I started vb.net a couple of weeks ago and cant figure out.
I am using the accountNameHistory field of the computer object (want allowed to create a new one) to store information on build progress, so e.g. I want to write in start time as something like value(x) = "-st;" & now
If the value is already there I want to clear it first. In vbscript I was reading the whole attribute into a temp array and manipulating that and writing it back with PutEx, what is the best way in .net, has anyone got any sample code to put me out of my misery?[:P]
Cheers
Mike