search
Twitter Rss Feeds
MicrosoftArticlesForumsGroups
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml/Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

Web ProgrammingArticlesForumsGroups
JavaScript
ASP
ASP.NET
Web Services

Non-MicrosoftArticlesForumsGroups
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

DatabasesArticlesForumsGroups
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsGroups
Microsoft Excel
Microsoft Word
Microsoft Powerpoint
Publisher
Money

Operating SystemsArticlesForumsGroups
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsGroups
Share Point
BizTalk
Site Server
Exhange Server
IIS
Transaction Server

Graphic DesignArticlesForumsGroups
Macromedia Flash
Adobe PhotoShop
Microsoft Expression

OtherArticlesForumsGroups
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Reviews
Search Engines
Resumes

 

Previous Thread:   Convert NT4 scripts to AD

8/26/2005 12:03:17 PM    group proxyaddress
I have snipped the code below out of a Function I use to read and write  
  
proxyAddresses of user and contact class accounts in a 20003 Active  
  
Directory.  But, when I recently tried using the same code on a  
  
Distribution Group, I found the code fails on line: "v1 =  
  
cnvt.CStrArray(oRecordset.Fields("proxyaddresses").Value)".  However,  
  
the second below where I simply use "objUserCon.PutEx 3,  
  
"proxyaddresses", Array(priAddr)" works fine.  Can anyone tell me why?  
  
Can I not use convert on proxyAddresses on groups?  
  
Set objUserCon = GetObject("LDAP://CN=" & UserID & "," & LDAPstring)  
  
If UserExists then  
  
err.clear  
  
v1 = ""  
  
Set cnvt = CreateObject("ADs.ArrayConvert")  
  
Set oConnection = CreateObject("ADODB.Connection")  
  
Set oRecordset = CreateObject("ADODB.Recordset")  
  
oConnection.Provider = "ADsDSOObject"  
  
oConnection.Open "ADs Provider"  
  
strUser = "<LDAP://" & objuserCon.distinguishedName & ">"  
  
strQuery = strUser &  
  
";(objectClass=contact);adspath,proxyaddresses;subtree"  
  
Set oRecordset = oConnection.Execute(strQuery)  
  
v1 = cnvt.CStrArray(oRecordset.Fields("proxyaddresses").Value)  
  
If err.number = 0 then  
  
For Each v2 In v1  
  
If left(v2,5) = "SMTP:" then  
  
If lcase(mid(v2,6)) = lcase(pnum) then  
  
If loopCount >= 1 then  
  
f1.writeline mid(v2,6) & " = " & pnum  
  
End If  
  
Else  
  
If loopCount >= 1 then  
  
f1.writeline mid(v2,6) & " becomes " & pnum  
  
End If  
  
If writeEnabled Then  
  
' delete the old primary proxy address  
  
ObjUserCon.PutEx 4, "proxyAddresses", Array(v2)  
  
ObjUserCon.SetInfo  
  
' write the new primary proxy address  
  
ObjUserCon.PutEx 3, "proxyAddresses", Array("SMTP:" & pnum)  
  
'Update the target address  
  
ObjUserCon.Put "targetAddress", "SMTP:" & pnum  
  
ObjUserCon.SetInfo  
  
elem = phUserID  
  
conMembers  
  
scriptRerun = True  
  
End If  
  
End If  
  
End If  
  
End IF  
  
Next  
  
End If  
  
ElseIf writeEnabled Then  
  
priAddr = "SMTP:" & pnum  
  
objUserCon.Put "mailNickname",phUserID  
  
objUserCon.Put "targetAddress",priAddr  
  
objUserCon.PutEx 3, "proxyaddresses", Array(priAddr)  
  
objUserCon.SetInfo  
  
If loopCount >= 1 then  
  
f1.writeline """" & """" & " becomes " & pnum  
  
End If  
  
End If  
  
Set objUserCon = Nothing


Pete's Blog   |    Pete's Resume   |    Robbe's Blog   |    Robbe's Resume   |    Archive #2   |    Archive #3   |    Dotnetslackers   |    XmlPitStop   |    Advertise   |   Contact Us   |   Privacy   |   Copyright (c) 2000 - 2009 eggheadcafe.com  All rights reserved.