stubar
-
Total Posts
:
69
- Scores: 0
-
Reward points
:
0
- Joined: 7/14/2005
-
Status: offline
|
Help with For Each loop in VB.NET
Tuesday, November 11, 2008 9:40 PM
( permalink)
Hi Hopefully someone can help me with this little problem: I have the script below working: But I want to carry the value S out of the For Next loop. The script loops through the proxyaddresses field in AD and I need to capture them all in order to add a new one plus the old ones. Any help would be appreciated. Thanks in advance. Stuart Dim results As SearchResultCollection results = searcher.FindAll() Dim result As SearchResult For Each result In results Dim proxyAddresses As ArrayList = New ArrayList For Each s As String In result.Properties.Item("proxyAddresses") proxyAddresses.Add(s) Dim addys As String addys = s MsgBox(addys) Next Next
Can't type, can't spell, can barely read. Can't you tell?
|
|
|
|
ebgreen
-
Total Posts
:
8227
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
RE: Help with For Each loop in VB.NET
Wednesday, November 12, 2008 3:57 AM
( permalink)
If I understand the question, then Dim ProxyAddresses outside the loop. Then when the loop is finished it would hold a list of the addresses.
|
|
|
|
stubar
-
Total Posts
:
69
- Scores: 0
-
Reward points
:
0
- Joined: 7/14/2005
-
Status: offline
|
RE: Help with For Each loop in VB.NET
Wednesday, November 12, 2008 4:21 AM
( permalink)
Thank you Forest and trees. You don't have any tips on appending to a multi value attribute in AD do you? I would use something like: objUser.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", Array("smtp:" & newmail2) in vb script but can't make the leap to VB.NET I can easily add a new smtp address but the trick is not wiping out those that are already there. I know I can use entry.Invoke("putex", new object() but I don't know how to implement it. Any help would be much appreciated. Thanks in advance
Can't type, can't spell, can barely read. Can't you tell?
|
|
|
|