Some or all identity references could not be translated.



Hi,

what I try to do:

create user/group in AD(works fine).
set permissions on folder for created user/group(problems)

If I try that I get the following error:

System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated.
at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)
at System.Security.Principal.NTAccount.Translate(Type targetType)
at System.Security.AccessControl.CommonObjectSecurity.ModifyAccess(AccessControlModification modification, AccessRule rule, Boolean& modified)
at System.Security.AccessControl.ObjectSecurity.ModifyAccessRule(AccessControlModification modification, AccessRule rule, Boolean& modified)

If I try set permissions for same user/group about 30 seconds after creation everything went fine.

CODE:

Dim identity As NTAccount

identity = New NTAccount(strUserName)

Dim dInfo As New DirectoryInfo(strFolderName)
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl(AccessControlSections.Access)

dSecurity.AddAccessRule(New FileSystemAccessRule(identity, _
rights, _
iFlags, _
pFlags, _
acType))

dInfo.SetAccessControl(dSecurity)

Can someone help, suggest something??

.



Relevant Pages

  • Re: Whats wrong here
    ... > I made this little script to create user, homedir and set permissions on ... > Dim RootDSE ... > Dim iInput ... sUserName) ...
    (microsoft.public.scripting.vbscript)
  • Whats wrong here
    ... I made this little script to create user, homedir and set permissions on the ... Dim RootDSE ... Dim iInput ... user.Put "samAccountName", sUserName ...
    (microsoft.public.scripting.vbscript)