dinsdag 27 december 2011

Active Directory from extranet to intranet domain... Impersonation


Crap, created a application page that reads Active Directory on a Intranet.
But the infrastructure department has deployed it on a sharepoint on the Extranet domain.

Result, could'nt query the additional information in the Active Directory of the users on the intranet.
Somebody told me to use impersonation, but have no experience with this. If someone can help me... 
don't hesitate...

If I found a solution, I will keep you informed...
   

donderdag 15 december 2011

Access Active Directory in Sharepoint Application Page


Had to create a redirection page this week that forwarded some Active Directory information 
to an external Site for automatic loggon. When deploying my solution to the Sharepoint Server 
my code didn't worked for normal users. Found the solution that my testing user 
had Farm Admin privileges, for accessing the Active Directory normal users 
had'nt enougth rights to excecute the AD call.

Solution found on msdn was to elevate the privileges for specific part of code 
that needs that kind of rights.


SPSecurity.RunWithElevatedPrivileges(delegate() {
// YOUR CODE THAT NEEDS ELEVATED PRIVILEGES
});