Re: Some or all identity references could not be translated.
- From: "Darko Bazulj" <darko.bazulj@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 Jun 2008 11:20:01 +0200
Hi Joe,
I will try to explain better.
First I create OU then inside that OU I create otheres OUs, users and groups.
But sometimes I get error "There is no such object on the server", like there is no OU which I just created.
To create users and groups I use "System.DirectoryServices.AccountManagement" class.
http://msdn.microsoft.com/en-us/library/bb348316.aspx
Dim ctx As New PrincipalContext(ContextType.Domain, strDNSADDomain, strOU)
Dim user As New UserPrincipal(ctx)
strOU = DN - name of newly created OU in which I want to create user
strDNSADDomain = I set empty string, domain name or full DNS DC name
If I set empty string or domain name the error occurs often.
But if I set full DNS DC name the error occurs from time to time when I start to use application, then I just enter DNS name of second DC and code start to work.
If I put some sleep(20-30sec) in code the application work but I think that there is some better way.
hmm...
I think I know where is the problem.
Problem is in creation of OU.
When I create OU I don't bind to specific DC but for path enter "LDAP://OU=name,DC=domain,DC=loc"
Maybe if I enter "LDAP://DC1.domain.name:389/OU=name,DC=domain,DC=loc"
But is this good approach, what if this DC stop to work?
Can you suggest what is the good way to create OU and user inside newly created OU and to avoid problem with AD replication?
Is there some trick like with SID/user name?
Thank you for your help.
--
"Darko Bazulj" <darko.bazulj@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:15AB08F9-9201-4925-BE5A-4AE0AB5B7888@xxxxxxxxxxxxxxxxHi 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)
.
- Follow-Ups:
- Re: Some or all identity references could not be translated.
- From: Joe Kaplan
- 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
- Re: Some or all identity references could not be translated.
- From: Joe Kaplan
- Some or all identity references could not be translated.
- Prev by Date: Re: 2 connection strings, one SQL one network MDB
- Next by Date: Exclude Error Status 403 from customErrors Redirect
- 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
|