Re: Some or all identity references could not be translated.
- From: "Joe Kaplan" <joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 8 Jun 2008 22:57:56 -0500
I didn't quite follow what you were saying here. You do need to make sure
you are working off of the same server though. Could that be the problem?
Please try to explain again.
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Darko Bazulj" <darko.bazulj@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:15AB08F9-9201-4925-BE5A-4AE0AB5B7888@xxxxxxxxxxxxxxxx
Hi Joe,
it works now :))
Thank you for help.
Can you suggest me something about AD.
what I do:
create OU and then create user.
But I sometimes recive error, like there is no OU which I just created but
OU is there
strDNSADDomain=
I was put just domain(domain.loc) but I then recived error frequently.
Then I put full DC name(ad1.domain.loc) but mistakes were reduce but
nevertheless knows happen.
Can you suggest something??
Code:
----------
create user:
Dim ctx As New PrincipalContext(ContextType.Domain, strDNSADDomain,
strOU)
Dim user As New UserPrincipal(ctx)
user.SamAccountName = strSamAccountName
If Not String.IsNullOrEmpty(strDescription) Then user.Description =
strDescription
user.SetPassword(strPassword)
user.Enabled = True
user.PasswordNeverExpires = True
If Not String.IsNullOrEmpty(strUPN) Then user.UserPrincipalName =
strUPN
user.Save()
user.Dispose()
ctx.Dispose()
create OU:
Dim objAD As DirectoryEntry
Dim objOU As DirectoryEntry
strOU = "OU=" + strOU
objAD = New DirectoryEntry(strPath)
objOU = objAD.Children.Add(strOU, "OrganizationalUnit")
If Not String.IsNullOrEmpty(strDescription) Then
objOU.Properties("description").Add(strDescription)
If Not String.IsNullOrEmpty(struPNSuffix) Then
objOU.Properties("uPNSuffixes").Add(struPNSuffix)
objOU.CommitChanges()
objOU.Dispose()
objAD.Dispose()
Error:
-------
There is no such object on the server. -- at
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInit()
at
System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()
at
System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()
at
System.DirectoryServices.AccountManagement.PrincipalContext.ContextForType(Type
t) at
System.DirectoryServices.AccountManagement.Principal.GetStoreCtxToUse() at
System.DirectoryServices.AccountManagement.Principal.set_SamAccountName(String
value) at serviceprovisioning.ActiveDirectory.CreateUser(String
strSamAccountName, String strPassword, String strOU, String
strDescription, String strUPN, String strDNSADDomain)
----------------------------------------------
#example if someone else have similar problems.
Dim identity As NTAccount
identity = New NTAccount(strUserName)
Dim sid As SecurityIdentifier =
DirectCast(identity.Translate(GetType(SecurityIdentifier)),
SecurityIdentifier)
Dim dInfo As New DirectoryInfo(strFolderName)
Dim dSecurity As DirectorySecurity =
dInfo.GetAccessControl(AccessControlSections.Access)
dSecurity.AddAccessRule(New FileSystemAccessRule(sid, _
rights, _
iFlags, _
pFlags, _
acType))
dInfo.SetAccessControl(dSecurity)
.
- Follow-Ups:
- Re: Some or all identity references could not be translated.
- From: Darko Bazulj
- Re: Some or all identity references could not be translated.
- References:
- Some or all identity references could not be translated.
- From: Darko Bazulj
- Re: Some or all identity references could not be translated.
- From: Joe Kaplan
- Re: Some or all identity references could not be translated.
- From: Darko Bazulj
- Some or all identity references could not be translated.
- Prev by Date: Re: 2 connection strings, one SQL one network MDB
- Next by Date: Re: 2 connection strings, one SQL one network MDB
- Previous by thread: Re: Some or all identity references could not be translated.
- Next by thread: Re: Some or all identity references could not be translated.
- Index(es):
Relevant Pages
|