Hi Everyone,
I have ADAM set-up & I've written web-services to complete admin tasks like adding new users etc. (I have multiple applications utilising the same ADAM instance)
What I am trying to achieve will probably sound a bit odd - but basically I want an admin user to be able to select which attributes the web service should return from ADAM. E.g. application 1 should return displayName & telephoneNumber but application 2 might not need the same attributes returned.
Currently I have set up a SQL Server table to store which attributes the user has selected to be returned & then in the web service looped through this to load the required attributes and add the results to an array to be returned (If your interested I'll add the code at the bottom).
I wanted to know whether there was a better way of doing this? Is it possible to store something like this within ADAM itself?
Thanks in advance for any help!
//using linq to access table
DataClasses1DataContext db = new DataClasses1DataContext();
var queryAttributes = from atr in db.AttributesToReturns
where atr.appNumber == appNumber
select atr;
ArrayList userD = new ArrayList();
foreach (var a in queryAttributes)
{
//the col 'attribute' contains the exact name in active direct e.g. displayName
string att = a.attribute.ToString();
searcher.PropertiesToLoad.Add(att);
}
//--code omitted but here perform search & get req Directory Entry
foreach (var a in queryAttributes)
{
string attributeName = a.attribute.ToString();
try
{
string value = user.Properties[attributeName].Value.ToString();
//do something with value - here i am updating a user object which will be added to the ArrayList the webservice is returning
updateUser(u, attributeName, value);
}
//if an error - just set value to empty
catch (Exception ex)
{
string value = "NULL";
updateUser(u, attributeName, value);
}
}
userD.Add(u);