Link to home
Start Free TrialLog in
Avatar of Edwin_C
Edwin_CFlag for Hong Kong

asked on

How to change file access permission using Active Directory Service?

Hi
Do you know any good example showing how to modify the access right of an AD account to a file/folder using Active Directory Service in managed code?
Thanks
Edwin
Avatar of Arthur_Mino
Arthur_Mino
Flag of Australia image

G'day,

From the "properties" of a folder or file, you should see the security tab. The security section should query the AD and resolve all the AD accounts available to give access to that particular file or folder.
Not sure what you mean by "managed code"

As long as the client machine has been blinded to the AD, you should be able to query the AD.

Hope this helps,

Cheers,

Arthur
Avatar of Edwin_C

ASKER

Hi Arthur
I mean doing the task by code.  I am able to use C# (.NET 2.0) code with System.DirectoryServices objects to create AD account and assign it to a particular user group.  What I want now is to grant read/write permission of a file to this newly created account.  Can you help me on this?
Edwin
Avatar of haim96
haim96

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

this link is for VBscript, but meybe it will help you....
ASKER CERTIFIED SOLUTION
Avatar of Edwin_C
Edwin_C
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in fact, google was full of info about this...it's seems kind of weird to me that you didn't found it before.

:)
Avatar of Edwin_C

ASKER

Hi haim96
In fact, I had found all the links provided by you before but none of them are in managed code.  Most of the resources in the internet are pre 2.0 approaches or using scripts.  The ActiveDS typed library used in the quoted codeproject and MS links is dated back to 1998 and the download link is dead in the MS download site.  

My mistake was that I thought the Acive Directory Services 2.0 can do the job (I'm still not sure whether it can or not because it lacks good documentation) and so wasted much time researching in that area.

Anyway, much thanks for helping me in that and sorry for not using your suggestions.
Cheers
Edwin
Avatar of Edwin_C

ASKER

Sorry, some correction.  The dead download link is the ADSI 2.5 interface which was used by some other links I found.  The ActiveDS type library is included in my VS2005 but it is a COM object and not managed code.