Access Active Directory from Sharepoint

Here is the sample code thar you can use to access Active Directory details from a sharepoint site,

DirectoryEntry oDE;
oDE = new DirectoryEntry(“LDAP://<ldapserver>,”ADusername”,”ADpassword”,AuthenticationTypes.Secure);

DirectoryEntry de = oDE;

DirectorySearcher deSearch = new DirectorySearcher();

deSearch.Filter = “(&(objectClass=user)(SAMAccountName=” + SPContext.Current.Web.CurrentUser.LoginName + “))”;

deSearch.SearchScope = SearchScope.Subtree;

SearchResult results = deSearch.FindOne();

if (!(results == null))
{
de = new DirectoryEntry(results.Path,”AD username”,”AD password”,AuthenticationTypes.Secure);

//if you know the propertyname you want to get value from you can use this
de.Properties["propertyname"].ToString();

//this code will loop thru all the properties in active directory
ResultPropertyCollection propertiesCollection;

propertiesCollection = results.Properties;

//loop thru all the properties in AD
foreach (string currentProperty in propertiesCollection.PropertyNames)
{

Response.Write(“Property Name: ” + currentProperty);

//loop thru all the sub properties
foreach (Object thisCollection in propertiesCollection[currentProperty])
{

Response.Write(thisCollection.ToString() + “<br/>”);
}
}
}

The above code reads and writes the values of the properties from the Active directory for the current user.
But to be able to run the above code you need to make sure that you import System.DirectoryServices,
<%@ Import Namespace=”System.DirectoryServices” %>
Also you need to make sure Web.config has an entry for the System.DirectoryServices in its Assemblies Section,

<assemblies>
<add assembly=”System.DirectoryServices, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089″ />
</assemblies>

Undercover Shopper – Mystery Shopper

Companies today are paying youngsters to shop at malls, eat at hip food joints, watch movies and have a good time. Yes, they are footing the bills. So if you are a mall rat, movie hopper, foodie, or just plain cash-strapped, then it’s likely that mystery shopping is your dream job.

The funda is simple. When big retailers want to find out what customers think of their service levels, they turn to service consultants. These consultants in turn hire mystery shoppers to visit their clients’ outlets and give feedback. “This unbiased, third party feedback is used by retailers to appraise their staffs’ performance and design training programmes.” Moreover, as Industry insiders say that almost all the big brand names use mystery shopping to monitor their customer service levels and staff. In light of this, mystery shoppers benifit as they get to audit these premier brands and have a gala time in the bargain.

Yes, this job profile des inclued eating pizzas at Pizza Hut and checking out the latest sale at Life Style, however that’s not only it. Each retail company, has its own standards which its outlets ought to follow, and the job of the mystery shopper is to verify these. Shoppers stop employees for instance, have to dress in uniform and use a standard line to greet its customers etc, “so auditing its outlet the mystery shopper would have to note if the staff is in uniform and greets him appropriately among other details like the cleanliness of the place, signs of wear and tear, if the staff is knowledgeable and customer friendly, and so on.”

On the other handd, while auditing a movie hall he oulsd look out for nitty grities like if the ticketing staff is sware of various ratings, if the movie started on time, how long the service took in food court etc. After the first few times you begin to do it subconsciously.

Once the audit is over the mystery shopper has to send his feedback questionnaire to the consultancy within 12 hours. Hence timeliness is a crucial quality for an auditor to have. Being well-versed in English, also helps as depending on the audit the questionnaire has over 10-300 subjective and objective questions that need to be answered. Further being internet savy, is also a big plus as almost every activity in mystery shopping from booking to the assignmnet, to sending the feedback and proofs of the audit is done online.